From c16632da0bf8d042388018c667cfbc176ed56436 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 17 Jan 2013 14:40:46 +0700 Subject: [PATCH] add UART support for ea4357 (tested) --- demos/bsp/boards/board_ea4357.c | 76 ++++++++++++++++++++--------- demos/bsp/boards/board_ea4357.h | 11 +++-- demos/device/keyboard/.cproject | 18 +++---- demos/device/keyboard/descriptors.h | 2 +- demos/device/keyboard/main.c | 6 +-- tinyusb/class/cdc.c | 5 +- tinyusb/device/dcd.c | 2 +- tinyusb/hal/hal_lpc11uxx.h | 1 + tinyusb/hal/hal_lpc13uxx.h | 2 +- tinyusb/hal/hal_lpc43xx.c | 2 +- tinyusb/hal/hal_lpc43xx.h | 1 + tinyusb/tusb.h | 4 ++ 12 files changed, 88 insertions(+), 42 deletions(-) diff --git a/demos/bsp/boards/board_ea4357.c b/demos/bsp/boards/board_ea4357.c index 90ac83af..70b9fb7e 100644 --- a/demos/bsp/boards/board_ea4357.c +++ b/demos/bsp/boards/board_ea4357.c @@ -39,35 +39,69 @@ #if BOARD == BOARD_EA4357 +#define UART_PORT LPC_USART0 + +#if 0 +static const struct { + uint8_t port; + uint8_t pin; +}leds[CFG_LED_NUMBER] = { {0, 8} }; +#endif + void board_init(void) { -// SystemInit(); -// SysTick_Config(SystemCoreClock / CFG_TICKS_PER_SECOND); // 1 msec tick timer -// GPIOInit(); -// -// // Leds Init -// GPIOSetDir(CFG_LED_PORT, CFG_LED_PIN, 1); -// LPC_GPIO->CLR[CFG_LED_PORT] = (1 << CFG_LED_PIN); -// -//#if CFG_UART_ENABLE -// UARTInit(CFG_UART_BAUDRATE); -//#endif -// -//#if CFG_PRINTF_TARGET == PRINTF_TARGET_SWO + SystemInit(); + CGU_Init(); + + SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / CFG_TICKS_PER_SECOND); // 1 msec tick timer + +#if 0 + // Leds Init + uint8_t i; + for (i=0; iPIO0_9 &= ~0x07; /* UART I/O config */ // LPC_IOCON->PIO0_9 |= 0x03; /* UART RXD */ -//#endif +#endif } //--------------------------------------------------------------------+ // LEDS //--------------------------------------------------------------------+ +void board_leds(uint32_t mask, uint32_t state) __attribute__ ((deprecated("not supported yet"))); void board_leds(uint32_t mask, uint32_t state) { -// if (mask) -// { -// GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, mask & state ? CFG_LED_ON : CFG_LED_OFF); -// } +#if 0 + uint8_t i; + for(i=0; i - - -