29 #if defined(RETARGET_USART)
33 #if defined(RETARGET_LEUART)
39 static volatile int rxReadIndex = 0;
40 static volatile int rxWriteIndex = 0;
41 static volatile int rxCount = 0;
42 static volatile uint8_t rxBuffer[RXBUFSIZE];
43 static uint8_t LFtoCRLF = 0;
44 static bool initialized = false;
49 void RETARGET_IRQ_NAME(void)
51 #if defined(RETARGET_USART)
105 #if defined(RETARGET_USART)
110 RETARGET_PERIPHERAL_ENABLE();
119 #if defined( USART_ROUTEPEN_RXPEN )
127 usart->ROUTE = USART_ROUTE_RXPEN | USART_ROUTE_TXPEN | RETARGET_LOCATION;
132 NVIC_ClearPendingIRQ(RETARGET_IRQn);
136 NVIC_EnableIRQ(RETARGET_IRQn);
146 RETARGET_PERIPHERAL_ENABLE();
151 #if defined(RETARGET_VCOM)
153 #if defined(_CMU_LFCLKSEL_LFB_HFCORECLKLEDIV2)
170 #if defined(RETARGET_VCOM)
175 #if defined( LEUART_ROUTEPEN_RXPEN )
183 leuart->ROUTE = LEUART_ROUTE_RXPEN | LEUART_ROUTE_TXPEN | RETARGET_LOCATION;
188 NVIC_ClearPendingIRQ(RETARGET_IRQn);
192 NVIC_EnableIRQ(RETARGET_IRQn);
198 #if !defined(__CROSSWORKS_ARM) && defined(__GNUC__)
199 setvbuf(stdout, NULL, _IONBF, 0);
251 RETARGET_TX(RETARGET_UART,
'\r');
253 RETARGET_TX(RETARGET_UART, c);
257 RETARGET_TX(RETARGET_UART,
'\n');
Clock management unit (CMU) API.
void CMU_ClockSelectSet(CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
Select reference clock/oscillator used for a clock branch.
int RETARGET_ReadChar(void)
Receive a byte from USART/LEUART and put into global buffer.
#define CORE_DECLARE_IRQ_STATE
#define _USART_ROUTELOC0_RXLOC_MASK
#define _LEUART_ROUTELOC0_RXLOC_MASK
__STATIC_INLINE void USART_IntClear(USART_TypeDef *usart, uint32_t flags)
Clear one or more pending USART interrupts.
#define _USART_ROUTELOC0_TXLOC_SHIFT
#define USART_STATUS_RXDATAV
#define USART_ROUTEPEN_TXPEN
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
Universal synchronous/asynchronous receiver/transmitter (USART/UART) peripheral API.
__STATIC_INLINE void USART_IntEnable(USART_TypeDef *usart, uint32_t flags)
Enable one or more USART interrupts.
USART_Enable_TypeDef enable
#define _LEUART_ROUTELOC0_RXLOC_SHIFT
Retarget stdout to a serial port.
__STATIC_INLINE void LEUART_IntClear(LEUART_TypeDef *leuart, uint32_t flags)
Clear one or more pending LEUART interrupts.
void LEUART_Init(LEUART_TypeDef *leuart, LEUART_Init_TypeDef const *init)
Init LEUART.
__STATIC_INLINE void LEUART_IntEnable(LEUART_TypeDef *leuart, uint32_t flags)
Enable one or more LEUART interrupts.
#define CORE_ENTER_ATOMIC()
void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out)
Set the mode for a GPIO pin.
General Purpose IO (GPIO) peripheral API.
#define _LEUART_ROUTELOC0_TXLOC_SHIFT
int RETARGET_WriteChar(char c)
Transmit single byte to USART/LEUART.
#define _USART_ROUTELOC0_TXLOC_MASK
Core interrupt handling API.
void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable)
Enable/disable a clock.
void LEUART_Enable(LEUART_TypeDef *leuart, LEUART_Enable_TypeDef enable)
Enable/disable LEUART receiver and/or transmitter.
static volatile int rxCount
Low Energy Universal Asynchronous Receiver/Transmitter (LEUART) peripheral API.
static volatile int rxWriteIndex
static volatile int rxReadIndex
void RETARGET_SerialInit(void)
Intializes UART/LEUART.
#define CORE_EXIT_ATOMIC()
#define LEUART_IF_RXDATAV
static volatile uint8_t rxBuffer[RXBUFSIZE]
#define USART_ROUTEPEN_RXPEN
#define USART_INITASYNC_DEFAULT
#define _LEUART_ROUTELOC0_TXLOC_MASK
void USART_Enable(USART_TypeDef *usart, USART_Enable_TypeDef enable)
Enable/disable USART/UART receiver and/or transmitter.
void USART_InitAsync(USART_TypeDef *usart, const USART_InitAsync_TypeDef *init)
Init USART/UART for normal asynchronous mode.
#define LEUART_INIT_DEFAULT
void RETARGET_SerialCrLf(int on)
UART/LEUART toggle LF to CRLF conversion.
void CMU_ClockDivSet(CMU_Clock_TypeDef clock, CMU_ClkDiv_TypeDef div)
Set clock divisor/prescaler.
#define _USART_ROUTELOC0_RXLOC_SHIFT
LEUART_Enable_TypeDef enable