35 #if defined(LEUART_COUNT) && (LEUART_COUNT > 0)
66 #if (LEUART_COUNT == 1)
67 #define LEUART_REF_VALID(ref) ((ref) == LEUART0)
68 #elif (LEUART_COUNT == 2)
69 #define LEUART_REF_VALID(ref) (((ref) == LEUART0) || ((ref) == LEUART1))
71 #error "Undefined number of low energy UARTs (LEUART)."
93 __STATIC_INLINE
void LEUART_Sync(
LEUART_TypeDef *leuart, uint32_t mask)
181 divisor = 256 + clkdiv;
182 quotient = refFreq / divisor;
183 remainder = refFreq % divisor;
192 br += (256 * remainder) / divisor;
222 #if (LEUART_COUNT > 1)
223 else if (leuart == LEUART1)
225 clock = cmuClock_LEUART1;
268 EFM_ASSERT(baudrate);
304 #if (LEUART_COUNT > 1)
305 else if (leuart == LEUART1)
307 clock = cmuClock_LEUART1;
320 clkdiv = (32 * refFreq) / baudrate;
362 EFM_ASSERT(LEUART_REF_VALID(leuart));
365 tmp = ~((uint32_t)(enable));
369 tmp |= (uint32_t)(enable);
464 EFM_ASSERT(LEUART_REF_VALID(leuart));
479 | (uint32_t)(init->
parity)
503 EFM_ASSERT(LEUART_REF_VALID(leuart));
518 #if defined(_LEUART_ROUTEPEN_MASK)
519 leuart->ROUTEPEN = _LEUART_ROUTEPEN_RESETVALUE;
520 leuart->ROUTELOC0 = _LEUART_ROUTELOC0_RESETVALUE;
556 return (uint8_t)leuart->
RXDATA;
582 return (uint16_t)leuart->
RXDATAX;
618 leuart->
TXDATA = (uint32_t)data;
650 leuart->
TXDATAX = (uint32_t)data;
Clock management unit (CMU) API.
#define LEUART_CTRL_RXDMAWU
#define _LEUART_SIGFRAME_RESETVALUE
#define LEUART_CMD_CLEARTX
void LEUART_Tx(LEUART_TypeDef *leuart, uint8_t data)
Transmit one frame.
#define LEUART_STATUS_TXBL
LEUART_Stopbits_TypeDef stopbits
Emlib peripheral API "assert" implementation.
#define _LEUART_CLKDIV_RESETVALUE
#define LEUART_SYNCBUSY_CMD
#define LEUART_CMD_CLEARRX
#define _LEUART_CMD_TXEN_MASK
#define LEUART_SYNCBUSY_CTRL
#define _LEUART_PULSECTRL_RESETVALUE
#define LEUART_FREEZE_REGFREEZE
#define _LEUART_CTRL_PARITY_MASK
#define _LEUART_CMD_RXEN_MASK
void LEUART_Init(LEUART_TypeDef *leuart, LEUART_Init_TypeDef const *init)
Init LEUART.
#define LEUART_CMD_RXBLOCKDIS
void LEUART_TxExt(LEUART_TypeDef *leuart, uint16_t data)
Transmit one 8-9 bit frame with extended control.
#define _LEUART_CTRL_STOPBITS_MASK
#define LEUART_SYNCBUSY_TXDATAX
void LEUART_BaudrateSet(LEUART_TypeDef *leuart, uint32_t refFreq, uint32_t baudrate)
Configure baudrate (or as close as possible to specified baudrate).
uint32_t LEUART_BaudrateGet(LEUART_TypeDef *leuart)
Get current baudrate for LEUART.
#define _LEUART_CLKDIV_MASK
__IOM uint32_t STARTFRAME
LEUART_Parity_TypeDef parity
void LEUART_Enable(LEUART_TypeDef *leuart, LEUART_Enable_TypeDef enable)
Enable/disable LEUART receiver and/or transmitter.
Low Energy Universal Asynchronous Receiver/Transmitter (LEUART) peripheral API.
#define LEUART_STATUS_RXDATAV
#define _LEUART_ROUTE_RESETVALUE
void LEUART_Reset(LEUART_TypeDef *leuart)
Reset LEUART to same state as after a HW reset.
#define _LEUART_IEN_RESETVALUE
#define LEUART_CTRL_TXDMAWU
#define LEUART_SYNCBUSY_TXDATA
#define _LEUART_STARTFRAME_RESETVALUE
void LEUART_RxDmaInEM2Enable(LEUART_TypeDef *leuart, bool enable)
Enables handling of LEUART RX by DMA in EM2.
uint16_t LEUART_RxExt(LEUART_TypeDef *leuart)
Receive one 8-9 bit frame, with extended information.
uint32_t LEUART_BaudrateCalc(uint32_t refFreq, uint32_t clkdiv)
Calculate baudrate for LEUART given reference frequency and clock division.
#define _LEUART_CTRL_RESETVALUE
uint8_t LEUART_Rx(LEUART_TypeDef *leuart)
Receive one 8 bit frame, (or part of 9 bit frame).
void LEUART_TxDmaInEM2Enable(LEUART_TypeDef *leuart, bool enable)
Enables handling of LEUART TX by DMA in EM2.
uint32_t CMU_ClockFreqGet(CMU_Clock_TypeDef clock)
Get clock frequency for a clock point.
void LEUART_FreezeEnable(LEUART_TypeDef *leuart, bool enable)
LEUART register synchronization freeze control.
#define LEUART_SYNCBUSY_CLKDIV
LEUART_Databits_TypeDef databits
LEUART_Enable_TypeDef enable