summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-04-22 19:24:19 +0700
committerhathach <[email protected]>2021-04-22 19:24:19 +0700
commit5c5d4b189f08b0ad1da1177e28a04341ded291d2 (patch)
treecba95060ebc76d983d692ab8079b4773d585ff0b
parentd8fd4352a3e6c621c22e6789243a8634ed134acb (diff)
add lpc55 uart write
-rw-r--r--hw/bsp/lpc55/boards/lpcxpresso55s28/board.h6
-rw-r--r--hw/bsp/lpc55/boards/lpcxpresso55s69/board.h6
-rw-r--r--hw/bsp/lpc55/family.c36
3 files changed, 24 insertions, 24 deletions
diff --git a/hw/bsp/lpc55/boards/lpcxpresso55s28/board.h b/hw/bsp/lpc55/boards/lpcxpresso55s28/board.h
index 7e76df953..cbf42c630 100644
--- a/hw/bsp/lpc55/boards/lpcxpresso55s28/board.h
+++ b/hw/bsp/lpc55/boards/lpcxpresso55s28/board.h
@@ -42,9 +42,9 @@
#define BUTTON_STATE_ACTIVE 0
// UART
-//#define UART_DEV USART0
-//#define UART_RX_PINMUX 0U, 29U, IOCON_PIO_DIG_FUNC1_EN
-//#define UART_TX_PINMUX 0U, 30U, IOCON_PIO_DIG_FUNC1_EN
+#define UART_DEV USART0
+#define UART_RX_PINMUX 0, 29, IOCON_PIO_DIG_FUNC1_EN
+#define UART_TX_PINMUX 0, 30, IOCON_PIO_DIG_FUNC1_EN
#ifdef __cplusplus
}
diff --git a/hw/bsp/lpc55/boards/lpcxpresso55s69/board.h b/hw/bsp/lpc55/boards/lpcxpresso55s69/board.h
index 7e76df953..cbf42c630 100644
--- a/hw/bsp/lpc55/boards/lpcxpresso55s69/board.h
+++ b/hw/bsp/lpc55/boards/lpcxpresso55s69/board.h
@@ -42,9 +42,9 @@
#define BUTTON_STATE_ACTIVE 0
// UART
-//#define UART_DEV USART0
-//#define UART_RX_PINMUX 0U, 29U, IOCON_PIO_DIG_FUNC1_EN
-//#define UART_TX_PINMUX 0U, 30U, IOCON_PIO_DIG_FUNC1_EN
+#define UART_DEV USART0
+#define UART_RX_PINMUX 0, 29, IOCON_PIO_DIG_FUNC1_EN
+#define UART_TX_PINMUX 0, 30, IOCON_PIO_DIG_FUNC1_EN
#ifdef __cplusplus
}
diff --git a/hw/bsp/lpc55/family.c b/hw/bsp/lpc55/family.c
index 0e238129d..c11c74e4d 100644
--- a/hw/bsp/lpc55/family.c
+++ b/hw/bsp/lpc55/family.c
@@ -35,19 +35,6 @@
#include "sct_neopixel.h"
//--------------------------------------------------------------------+
-// Forward USB interrupt events to TinyUSB IRQ Handler
-//--------------------------------------------------------------------+
-void USB0_IRQHandler(void)
-{
- tud_int_handler(0);
-}
-
-void USB1_IRQHandler(void)
-{
- tud_int_handler(1);
-}
-
-//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
@@ -67,6 +54,19 @@ void USB1_IRQHandler(void)
#define IOCON_PIO_DIG_FUNC4_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC4) /*!<@brief Digital pin function 2 enabled */
#define IOCON_PIO_DIG_FUNC7_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC7) /*!<@brief Digital pin function 2 enabled */
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+void USB0_IRQHandler(void)
+{
+ tud_int_handler(0);
+}
+
+void USB1_IRQHandler(void)
+{
+ tud_int_handler(1);
+}
+
/****************************************************************
name: BOARD_BootClockFROHF96M
outputs:
@@ -109,10 +109,10 @@ void board_init(void)
// Init 96 MHz clock
BootClockFROHF96M();
-#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
-#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+
+#if CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
@@ -145,7 +145,7 @@ void board_init(void)
gpio_pin_config_t const button_config = { kGPIO_DigitalInput, 0};
GPIO_PinInit(GPIO, BUTTON_PORT, BUTTON_PIN, &button_config);
-#if defined(UART_DEV)
+#ifdef UART_DEV
// UART
IOCON_PinMuxSet(IOCON, UART_RX_PINMUX);
IOCON_PinMuxSet(IOCON, UART_TX_PINMUX);
@@ -237,8 +237,8 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
- (void) buf; (void) len;
- return 0;
+ USART_WriteBlocking(UART_DEV, (uint8_t *)buf, len);
+ return len;
}
#if CFG_TUSB_OS == OPT_OS_NONE