From f14af7fd579daa29e44bf227f0f6cbef5d02f316 Mon Sep 17 00:00:00 2001 From: arighi Date: Thu, 23 Sep 2010 10:38:14 +0000 Subject: [PATCH] STM32-P103: implement WAKEUP button driver git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4270 38d2e660-2303-0410-9eaa-f027e97ec537 --- boards/stm32-p103/hw/hw_kbd.h | 25 ++++++++++--------------- boards/stm32-p103/hw/kbd_map.h | 19 +++++-------------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/boards/stm32-p103/hw/hw_kbd.h b/boards/stm32-p103/hw/hw_kbd.h index e78a1ce0..905c3c7d 100644 --- a/boards/stm32-p103/hw/hw_kbd.h +++ b/boards/stm32-p103/hw/hw_kbd.h @@ -26,16 +26,13 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2003, 2004, 2005, 2006, 2008 Develer S.r.l. (http://www.develer.com/) - * Copyright 2000 Bernie Innocenti - * All Rights Reserved. - * --> + * Copyright 2010 Develer S.r.l. (http://www.develer.com/) * - * \brief Keyboard hardware-specific definitions + * --> * + * \author Andrea Righi * - * \author Francesco Sacchi - * \author Stefano Fedrigo + * \brief Keyboard driver of the STM32-P103 evaluation board */ #ifndef HW_KBD_H @@ -44,14 +41,15 @@ #include "hw/kbd_map.h" #include +#include -#warning TODO:This is an example implementation, you must implement it! - -#define K_RPT_MASK (K_UP | K_DOWN | K_OK | K_CANCEL) +#define K_RPT_MASK (K_WAKEUP) #define KBD_HW_INIT \ do { \ - /* Put here code to init hw */ \ + stm32_gpioPinConfig((struct stm32_gpio *)GPIOA_BASE, \ + BV(0), GPIO_MODE_IN_FLOATING, \ + GPIO_SPEED_50MHZ); \ } while (0) EXTERN_C int emul_kbdReadCols(void); @@ -62,10 +60,7 @@ EXTERN_C int emul_kbdReadCols(void); */ INLINE keymask_t kbd_readkeys(void) { - /* Implement me! */ - - //Only for test remove when implement this function - return 0; + return stm32_gpioPinRead((struct stm32_gpio *)GPIOA_BASE, BV(0)); } #endif /* HW_KBD_H */ diff --git a/boards/stm32-p103/hw/kbd_map.h b/boards/stm32-p103/hw/kbd_map.h index 15e4f083..d19ab81e 100644 --- a/boards/stm32-p103/hw/kbd_map.h +++ b/boards/stm32-p103/hw/kbd_map.h @@ -26,16 +26,13 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2003, 2004, 2005, 2006, 2008 Develer S.r.l. (http://www.develer.com/) - * Copyright 2000 Bernie Innocenti - * All Rights Reserved. - * --> + * Copyright 2010 Develer S.r.l. (http://www.develer.com/) * - * \brief Keyboard map definitions. + * --> * + * \author Andrea Righi * - * \author Francesco Sacchi - * \author Stefano Fedrigo + * \brief Keyboard map definitions for the STM32-P103 evaluation board */ #ifndef HW_KBD_MAP_H @@ -43,9 +40,6 @@ #include -#warning TODO:This is an example implentation, you must implement it! - - /** * Type for keyboard mask. */ @@ -55,10 +49,7 @@ typedef uint16_t keymask_t; * \name Keycodes. */ /*@{*/ -#define K_UP BV(0) -#define K_DOWN BV(1) -#define K_OK BV(2) -#define K_CANCEL BV(3) +#define K_WAKEUP BV(0) #define K_REPEAT BV(13) /**< This is a repeated keyevent. */ #define K_TIMEOUT BV(14) /**< Fake key event for timeouts. */ -- 2.25.1