From 466052dcd1549bdd5af3ca149be13597b80a6736 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 20 Dec 2010 17:00:23 +0900 Subject: [PATCH] pinpad support --- ChangeLog | 8 ++++++++ boards/STBEE_MINI/board.c | 7 +++++++ boards/STBEE_MINI/board.h | 28 +++++++++++++++++++++++----- boards/STBEE_MINI/mcuconf.h | 10 +++++----- src/openpgp.c | 8 ++++++++ 5 files changed, 51 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1595e6..5269f63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-12-20 NIIBE Yutaka + + * 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 * src/configure (FLASH_SIZE): Without 'k'. diff --git a/boards/STBEE_MINI/board.c b/boards/STBEE_MINI/board.c index 17ce9e4..e3b6a0d 100644 --- a/boards/STBEE_MINI/board.c +++ b/boards/STBEE_MINI/board.c @@ -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 */ diff --git a/boards/STBEE_MINI/board.h b/boards/STBEE_MINI/board.h index e0026bc..ab1ff29 100644 --- a/boards/STBEE_MINI/board.h +++ b/boards/STBEE_MINI/board.h @@ -27,6 +27,7 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#include "config.h" /* * Setup for the STBee Mini board. */ @@ -93,16 +94,33 @@ * 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. diff --git a/boards/STBEE_MINI/mcuconf.h b/boards/STBEE_MINI/mcuconf.h index ea0f434..c2bc654 100644 --- a/boards/STBEE_MINI/mcuconf.h +++ b/boards/STBEE_MINI/mcuconf.h @@ -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() @@ -62,13 +62,13 @@ /* * 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 diff --git a/src/openpgp.c b/src/openpgp.c index 60e4780..970eb1a 100644 --- a/src/openpgp.c +++ b/src/openpgp.c @@ -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 ();