diff --git a/demos/bsp/boards/board.h b/demos/bsp/boards/board.h index 8ea13ade0..5ac586a1c 100644 --- a/demos/bsp/boards/board.h +++ b/demos/bsp/boards/board.h @@ -107,11 +107,7 @@ // Common Configuration //--------------------------------------------------------------------+ #define CFG_TICKS_PER_SECOND 1000 - -#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART - #define CFG_UART_ENABLE 1 - #define CFG_UART_BAUDRATE 115200 -#endif +#define CFG_UART_BAUDRATE 115200 //--------------------------------------------------------------------+ // Board Common API diff --git a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.c b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.c index b816784a3..1a6f9493f 100644 --- a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.c +++ b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.c @@ -40,19 +40,50 @@ #if BOARD == BOARD_LPCXPRESSO1347 +#define LED_PORT (0) +#define LED_PIN (7) +#define LED_ON (1) +#define LED_OFF (0) + +const static struct { + uint8_t port; + uint8_t pin; +} buttons[] = +{ + {1, 22 }, // Joystick up + {1, 20 }, // Joystick down + {1, 23 }, // Joystick left + {1, 21 }, // Joystick right + {1, 19 }, // Joystick press + {0, 1 }, // SW3 +// {1, 4 }, // SW4 (require to remove J28) +}; + +enum { + BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0]) +}; + + void board_init(void) { SystemInit(); + +#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c SysTick_Config(SystemCoreClock / CFG_TICKS_PER_SECOND); // 1 msec tick timer +#endif + GPIOInit(); - // Leds Init - GPIOSetDir(CFG_LED_PORT, CFG_LED_PIN, 1); - LPC_GPIO->CLR[CFG_LED_PORT] = (1 << CFG_LED_PIN); + //------------- LED -------------// + GPIOSetDir(LED_PORT, LED_PIN, 1); + LPC_GPIO->CLR[LED_PORT] = (1 << LED_PIN); -#if CFG_UART_ENABLE + //------------- BUTTON -------------// + for(uint8_t i=0; i - - -