pinpad support
authorNIIBE Yutaka <gniibe@fsij.org>
Mon, 20 Dec 2010 08:00:23 +0000 (17:00 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Mon, 20 Dec 2010 08:00:23 +0000 (17:00 +0900)
ChangeLog
boards/STBEE_MINI/board.c
boards/STBEE_MINI/board.h
boards/STBEE_MINI/mcuconf.h
src/openpgp.c

index a1595e6..5269f63 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-12-20  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * src/openpgp.c (GPGthread): Added PINPAD_SUPPORT.
+       * boards/STBEE_MINI/mcuconf.h: Simplified.
+       * boards/STBEE_MINI/board.h: Include config.h.
+       (PINPAD_SUPPORT): Added.
+       * boards/STBEE_MINI/board.c (hwinit1): Added PINPAD_SUPPORT.
+
 2010-12-15  NIIBE Yutaka  <gniibe@fsij.org>
 
        * src/configure (FLASH_SIZE): Without 'k'.
index 17ce9e4..e3b6a0d 100644 (file)
@@ -14,6 +14,13 @@ void
 hwinit1 (void)
 {
   hwinit1_common ();
+
+#if defined(PINPAD_SUPPORT)
+  palWritePort(IOPORT2, 0x7fff); /* Only clear GPIOB_7SEG_DP */
+  while (palReadPad (IOPORT2, GPIOB_BUTTON) != 0)
+    ;                          /* Wait for JTAG debugger connection */
+  palWritePort(IOPORT2, 0xffff); /* All set */
+#endif
   /*
    * Disable JTAG and SWD, done after hwinit1_common as HAL resets AFIO
    */
index e0026bc..ab1ff29 100644 (file)
@@ -27,6 +27,7 @@
 #ifndef _BOARD_H_
 #define _BOARD_H_
 
+#include "config.h"
 /*
  * Setup for the STBee Mini board.
  */
  * PA15 - Open Drain output (LED2 0:ON 1:OFF)
  */
 #define VAL_GPIOACRL            0x88888888      /*  PA7...PA0 */
-#define VAL_GPIOACRH            0x73788888      /* PA15...PA8 */
+#define VAL_GPIOACRH            0x63688888      /* PA15...PA8 */
 #define VAL_GPIOAODR            0xFFFFFFFF
 
-/*
- * Port B setup.
- * Everything input with pull-up except:
- */
+/* Port B setup. */
+#if defined(PINPAD_SUPPORT)
+#define GPIOB_BUTTON            2
+#define GPIOB_ROT_A             3
+#define GPIOB_ROT_B             4
+
+#define GPIOB_7SEG_DP           15
+#define GPIOB_7SEG_A            14
+#define GPIOB_7SEG_B            13
+#define GPIOB_7SEG_C            12
+#define GPIOB_7SEG_D            11
+#define GPIOB_7SEG_E            10
+#define GPIOB_7SEG_F            9
+#define GPIOB_7SEG_G            8
+
+#define VAL_GPIOBCRL            0x88888888      /*  PB7...PB0 */
+#define VAL_GPIOBCRH            0x66666666      /* PB15...PB8 */
+#define VAL_GPIOBODR            0xFFFFFFFF
+#else
+/* Everything input with pull-up */
 #define VAL_GPIOBCRL            0x88888888      /*  PB7...PB0 */
 #define VAL_GPIOBCRH            0x88888888      /* PB15...PB8 */
 #define VAL_GPIOBODR            0xFFFFFFFF
+#endif
 
 /*
  * Port C setup.
index ea0f434..c2bc654 100644 (file)
@@ -54,7 +54,7 @@
 /*
  * ADC driver system settings.
  */
-#define USE_STM32_ADC1              TRUE
+#define USE_STM32_ADC1              FALSE
 #define STM32_ADC1_DMA_PRIORITY     3
 #define STM32_ADC1_IRQ_PRIORITY     5
 #define STM32_ADC1_DMA_ERROR_HOOK() chSysHalt()
 /*
  * CAN driver system settings.
  */
-#define USE_STM32_CAN1              TRUE
+#define USE_STM32_CAN1              FALSE
 #define STM32_CAN1_IRQ_PRIORITY     11
 
 /*
  * PWM driver system settings.
  */
-#define USE_STM32_PWM1              TRUE
+#define USE_STM32_PWM1              FALSE
 #define USE_STM32_PWM2              FALSE
 #define USE_STM32_PWM3              FALSE
 #define USE_STM32_PWM4              FALSE
@@ -81,7 +81,7 @@
  * SERIAL driver system settings.
  */
 #define USE_STM32_USART1            FALSE
-#define USE_STM32_USART2            TRUE
+#define USE_STM32_USART2            FALSE
 #define USE_STM32_USART3            FALSE
 #if defined(STM32F10X_HD) || defined(STM32F10X_CL)
 #define USE_STM32_UART4             FALSE
@@ -98,7 +98,7 @@
 /*
  * SPI driver system settings.
  */
-#define USE_STM32_SPI1              TRUE
+#define USE_STM32_SPI1              FALSE
 #define USE_STM32_SPI2              FALSE
 #define STM32_SPI1_DMA_PRIORITY     2
 #define STM32_SPI2_DMA_PRIORITY     2
index 60e4780..970eb1a 100644 (file)
@@ -737,6 +737,14 @@ msg_t
 GPGthread (void *arg)
 {
   Thread *icc_thread = (Thread *)arg;
+#if defined(PINPAD_SUPPORT)
+  extern msg_t pindial_main (void *arg);
+  Thread *pindial_thread;
+  static WORKING_AREA(waPINthread, 128);
+
+  pindial_thread = chThdCreateStatic (waPINthread, sizeof(waPINthread),
+                                     NORMALPRIO, pindial_main, NULL);
+#endif
 
   gpg_init ();