diff options
| author | hathach <[email protected]> | 2023-02-22 15:13:27 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-02-22 15:13:27 +0700 |
| commit | 78a014ef187666da82c348b10958503c4c1d0e2b (patch) | |
| tree | 7312e7749ba105778e3bddc426068d8f2d3e946a | |
| parent | 9e7e8908a34a4ef2a4b271b9d6b0598ed72e064f (diff) | |
move check LIB_PICO_STDIO_UART to board.h
| -rw-r--r-- | hw/bsp/rp2040/board.h | 3 | ||||
| -rw-r--r-- | hw/bsp/rp2040/family.c | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/hw/bsp/rp2040/board.h b/hw/bsp/rp2040/board.h index f25f80e09..e7eab088e 100644 --- a/hw/bsp/rp2040/board.h +++ b/hw/bsp/rp2040/board.h @@ -40,7 +40,8 @@ #define BUTTON_BOOTSEL #define BUTTON_STATE_ACTIVE 0 -#if defined(PICO_DEFAULT_UART_TX_PIN) && defined(PICO_DEFAULT_UART_RX_PIN) && defined(PICO_DEFAULT_UART) +#if defined(PICO_DEFAULT_UART_TX_PIN) && defined(PICO_DEFAULT_UART_RX_PIN) && \ + defined(PICO_DEFAULT_UART) && defined(LIB_PICO_STDIO_UART) #define UART_DEV PICO_DEFAULT_UART #define UART_TX_PIN PICO_DEFAULT_UART_TX_PIN #define UART_RX_PIN PICO_DEFAULT_UART_RX_PIN diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c index 75328027b..8a426d655 100644 --- a/hw/bsp/rp2040/family.c +++ b/hw/bsp/rp2040/family.c @@ -115,7 +115,7 @@ void stdio_rtt_init(void) #endif -#if defined(UART_DEV) && defined(LIB_PICO_STDIO_UART) +#if defined(UART_DEV) static uart_inst_t *uart_inst; #endif @@ -148,7 +148,7 @@ void board_init(void) #ifndef BUTTON_BOOTSEL #endif -#if defined(UART_DEV) && defined(LIB_PICO_STDIO_UART) +#if defined(UART_DEV) bi_decl(bi_2pins_with_func(UART_TX_PIN, UART_TX_PIN, GPIO_FUNC_UART)); uart_inst = uart_get_instance(UART_DEV); stdio_uart_init_full(uart_inst, CFG_BOARD_UART_BAUDRATE, UART_TX_PIN, UART_RX_PIN); @@ -191,7 +191,7 @@ uint32_t board_button_read(void) int board_uart_read(uint8_t* buf, int len) { -#if defined(UART_DEV) && defined(LIB_PICO_STDIO_UART) +#if defined(UART_DEV) int count = 0; while ( (count < len) && uart_is_readable(uart_inst) ) { @@ -207,7 +207,7 @@ int board_uart_read(uint8_t* buf, int len) int board_uart_write(void const * buf, int len) { -#if defined(UART_DEV) && defined(LIB_PICO_STDIO_UART) +#if defined(UART_DEV) char const* bufch = (char const*) buf; for(int i=0;i<len;i++) { uart_putc(uart_inst, bufch[i]); |
