mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
add lpc55 uart write
This commit is contained in:
parent
d8fd4352a3
commit
5c5d4b189f
@ -42,9 +42,9 @@
|
|||||||
#define BUTTON_STATE_ACTIVE 0
|
#define BUTTON_STATE_ACTIVE 0
|
||||||
|
|
||||||
// UART
|
// UART
|
||||||
//#define UART_DEV USART0
|
#define UART_DEV USART0
|
||||||
//#define UART_RX_PINMUX 0U, 29U, IOCON_PIO_DIG_FUNC1_EN
|
#define UART_RX_PINMUX 0, 29, IOCON_PIO_DIG_FUNC1_EN
|
||||||
//#define UART_TX_PINMUX 0U, 30U, IOCON_PIO_DIG_FUNC1_EN
|
#define UART_TX_PINMUX 0, 30, IOCON_PIO_DIG_FUNC1_EN
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@
|
|||||||
#define BUTTON_STATE_ACTIVE 0
|
#define BUTTON_STATE_ACTIVE 0
|
||||||
|
|
||||||
// UART
|
// UART
|
||||||
//#define UART_DEV USART0
|
#define UART_DEV USART0
|
||||||
//#define UART_RX_PINMUX 0U, 29U, IOCON_PIO_DIG_FUNC1_EN
|
#define UART_RX_PINMUX 0, 29, IOCON_PIO_DIG_FUNC1_EN
|
||||||
//#define UART_TX_PINMUX 0U, 30U, IOCON_PIO_DIG_FUNC1_EN
|
#define UART_TX_PINMUX 0, 30, IOCON_PIO_DIG_FUNC1_EN
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -34,19 +34,6 @@
|
|||||||
#include "fsl_sctimer.h"
|
#include "fsl_sctimer.h"
|
||||||
#include "sct_neopixel.h"
|
#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
|
// 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_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 */
|
#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
|
name: BOARD_BootClockFROHF96M
|
||||||
outputs:
|
outputs:
|
||||||
@ -109,10 +109,10 @@ void board_init(void)
|
|||||||
// Init 96 MHz clock
|
// Init 96 MHz clock
|
||||||
BootClockFROHF96M();
|
BootClockFROHF96M();
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
|
||||||
// 1ms tick timer
|
// 1ms tick timer
|
||||||
SysTick_Config(SystemCoreClock / 1000);
|
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 )
|
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
|
||||||
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
#endif
|
#endif
|
||||||
@ -145,7 +145,7 @@ void board_init(void)
|
|||||||
gpio_pin_config_t const button_config = { kGPIO_DigitalInput, 0};
|
gpio_pin_config_t const button_config = { kGPIO_DigitalInput, 0};
|
||||||
GPIO_PinInit(GPIO, BUTTON_PORT, BUTTON_PIN, &button_config);
|
GPIO_PinInit(GPIO, BUTTON_PORT, BUTTON_PIN, &button_config);
|
||||||
|
|
||||||
#if defined(UART_DEV)
|
#ifdef UART_DEV
|
||||||
// UART
|
// UART
|
||||||
IOCON_PinMuxSet(IOCON, UART_RX_PINMUX);
|
IOCON_PinMuxSet(IOCON, UART_RX_PINMUX);
|
||||||
IOCON_PinMuxSet(IOCON, UART_TX_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)
|
int board_uart_write(void const * buf, int len)
|
||||||
{
|
{
|
||||||
(void) buf; (void) len;
|
USART_WriteBlocking(UART_DEV, (uint8_t *)buf, len);
|
||||||
return 0;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user