From e506f4cae2f3d06b463c28f725692165fec60727 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 7 Mar 2014 15:31:41 +0700 Subject: [PATCH] ported board_buttons API to EA4357 but device is not mounted yet --- .../embedded_artists/ea4357/board_ea4357.c | 49 +++++++- demos/bsp/boards/ngx/board_ngx4330.c | 4 +- demos/device/device_os_none/.cproject | 107 ++++++++++++------ demos/device/src/main.c | 6 + demos/device/src/tusb_config.h | 4 +- 5 files changed, 125 insertions(+), 45 deletions(-) diff --git a/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.c b/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.c index c76b94bd..f65e46b6 100644 --- a/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.c +++ b/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.c @@ -40,12 +40,31 @@ #if BOARD == BOARD_EA4357 - #define BOARD_UART_PORT LPC_USART0 #define BOARD_UART_PIN_PORT 0x0f #define BOARD_UART_PIN_TX 10 // PF.10 : UART0_TXD #define BOARD_UART_PIN_RX 11 // PF.11 : UART0_RXD +const static struct { + uint8_t mux_port; + uint8_t mux_pin; + + uint8_t gpio_port; + uint8_t gpio_pin; +}buttons[] = +{ + {0x0a, 3, 4, 10 }, // Joystick up + {0x09, 1, 4, 13 }, // Joystick down + {0x0a, 2, 4, 9 }, // Joystick left + {0x09, 0, 4, 12 }, // Joystick right + {0x0a, 1, 4, 8 }, // Joystick press + {0x02, 7, 0, 7 }, // SW6 +}; + +enum { + BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0]) +}; + void board_init(void) { CGU_Init(); @@ -66,7 +85,13 @@ void board_init(void) I2C_Cmd(LPC_I2C0, ENABLE); pca9532_init(); -#if CFG_UART_ENABLE + //------------- BUTTON -------------// + for(uint8_t i=0; i - - -