diff options
| author | hathach <[email protected]> | 2014-03-04 22:46:42 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2014-03-04 22:46:42 +0700 |
| commit | e6d7c5fceea4cda835fc62d7bb0c116a6255588f (patch) | |
| tree | 71e8b5d59e63069ae47287d9f7d0405d36808919 /demos/bsp/boards | |
| parent | 2a866365e90f9a899d491162c45d6ec94a06729b (diff) | |
remove lwip code in main.c & boardGetMACaddr (board.c)
NOTE: previous commit also removed some lwip's configure in board_ea4357
fix NGX4330 led blinking
Diffstat (limited to 'demos/bsp/boards')
| -rw-r--r-- | demos/bsp/boards/board.c | 14 | ||||
| -rw-r--r-- | demos/bsp/boards/ngx/board_ngx4330.c | 32 | ||||
| -rw-r--r-- | demos/bsp/boards/ngx/board_ngx4330.h | 2 |
3 files changed, 24 insertions, 24 deletions
diff --git a/demos/bsp/boards/board.c b/demos/bsp/boards/board.c index 4a423c5d2..e766bd206 100644 --- a/demos/bsp/boards/board.c +++ b/demos/bsp/boards/board.c @@ -49,20 +49,6 @@ void SysTick_Handler (void) #endif -#if 0 -// FIXME refractor -void boardGetMACaddr(uint8_t *macaddr) -{ - macaddr[0] = BOARD_MAC_ADDR0; - macaddr[1] = BOARD_MAC_ADDR1; - macaddr[2] = BOARD_MAC_ADDR2; - macaddr[3] = BOARD_MAC_ADDR3; - macaddr[4] = BOARD_MAC_ADDR4; - macaddr[5] = BOARD_MAC_ADDR5; -} - -#endif - void check_failed(uint8_t *file, uint32_t line) { (void) file; diff --git a/demos/bsp/boards/ngx/board_ngx4330.c b/demos/bsp/boards/ngx/board_ngx4330.c index cee98a98b..a8acdd8ff 100644 --- a/demos/bsp/boards/ngx/board_ngx4330.c +++ b/demos/bsp/boards/ngx/board_ngx4330.c @@ -40,11 +40,16 @@ #if BOARD == BOARD_NGX4330 +#define BOARD_UART_PORT LPC_USART0 + #define BOARD_MAX_LEDS 2 const static struct { - uint8_t port; - uint8_t pin; -}leds[BOARD_MAX_LEDS] = { {1, 11}, {1,12} }; + uint8_t mux_port; + uint8_t mux_pin; + + uint8_t gpio_port; + uint8_t gpio_pin; +}leds[BOARD_MAX_LEDS] = { {2, 11, 1, 11}, {2, 12, 1,12} }; void board_init(void) { @@ -61,8 +66,8 @@ void board_init(void) //------------- LED -------------// for (uint8_t i=0; i<BOARD_MAX_LEDS; i++) { - scu_pinmux(leds[i].port, leds[i].pin, MD_PUP|MD_EZI|MD_ZI, FUNC0); - GPIO_SetDir(leds[i].port, BIT_(leds[i].pin), 1); // output + scu_pinmux(leds[i].mux_port, leds[i].mux_pin, MD_PUP|MD_EZI|MD_ZI, FUNC0); + GPIO_SetDir(leds[i].gpio_port, BIT_(leds[i].gpio_pin), 1); // output } #if CFG_UART_ENABLE @@ -90,10 +95,10 @@ void board_leds(uint32_t on_mask, uint32_t off_mask) { if ( on_mask & BIT_(i)) { - GPIO_SetValue(leds[i].port, BIT_(leds[i].pin)); + GPIO_SetValue(leds[i].gpio_port, BIT_(leds[i].gpio_pin)); }else if ( off_mask & BIT_(i)) // on_mask take precedence over off_mask { - GPIO_ClearValue(leds[i].port, BIT_(leds[i].pin)); + GPIO_ClearValue(leds[i].gpio_port, BIT_(leds[i].gpio_pin)); } } } @@ -103,12 +108,21 @@ void board_leds(uint32_t on_mask, uint32_t off_mask) //--------------------------------------------------------------------+ uint32_t board_uart_send(uint8_t *p_buffer, uint32_t length) { - return UART_Send((LPC_USARTn_Type*) LPC_USART0, p_buffer, length, BLOCKING); + return UART_Send(BOARD_UART_PORT, p_buffer, length, BLOCKING); } uint32_t board_uart_recv(uint8_t *p_buffer, uint32_t length) { - return UART_Receive((LPC_USARTn_Type*) LPC_USART0, p_buffer, length, BLOCKING); + return UART_Receive(BOARD_UART_PORT, p_buffer, length, BLOCKING); +} + +uint8_t board_uart_getchar(void) +{ + return UART_ReceiveByte(BOARD_UART_PORT); } +//void board_uart_putchar(uint8_t c) +//{ +// +//} #endif diff --git a/demos/bsp/boards/ngx/board_ngx4330.h b/demos/bsp/boards/ngx/board_ngx4330.h index 09581bcef..3ac30ecb8 100644 --- a/demos/bsp/boards/ngx/board_ngx4330.h +++ b/demos/bsp/boards/ngx/board_ngx4330.h @@ -56,7 +56,7 @@ extern "C" { #endif -#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST +#define CFG_PRINTF_TARGET PRINTF_TARGET_UART #ifdef __cplusplus } |
