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)
268 EFM_ASSERT(baudrate);
304 #if (LEUART_COUNT > 1)
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.
void LEUART_Tx(LEUART_TypeDef *leuart, uint8_t data)
Transmit one frame.
#define _LEUART_CTRL_RESETVALUE
LEUART_Stopbits_TypeDef stopbits
#define LEUART_FREEZE_REGFREEZE
Emlib peripheral API "assert" implementation.
#define LEUART_CMD_CLEARTX
#define _LEUART_CTRL_STOPBITS_MASK
#define LEUART_CMD_CLEARRX
#define LEUART_CMD_RXBLOCKDIS
#define LEUART_SYNCBUSY_CLKDIV
#define _LEUART_CTRL_PARITY_MASK
#define LEUART_SYNCBUSY_CMD
#define LEUART_CTRL_RXDMAWU
#define _LEUART_CMD_TXEN_MASK
#define _LEUART_PULSECTRL_RESETVALUE
#define _LEUART_ROUTE_RESETVALUE
void LEUART_Init(LEUART_TypeDef *leuart, LEUART_Init_TypeDef const *init)
Init LEUART.
#define _LEUART_CMD_RXEN_MASK
void LEUART_TxExt(LEUART_TypeDef *leuart, uint16_t data)
Transmit one 8-9 bit frame with extended control.
#define LEUART_SYNCBUSY_CTRL
void LEUART_BaudrateSet(LEUART_TypeDef *leuart, uint32_t refFreq, uint32_t baudrate)
Configure baudrate (or as close as possible to specified baudrate).
#define _LEUART_CLKDIV_MASK
uint32_t LEUART_BaudrateGet(LEUART_TypeDef *leuart)
Get current baudrate for LEUART.
__IOM uint32_t STARTFRAME
LEUART_Parity_TypeDef parity
#define LEUART_STATUS_RXDATAV
void LEUART_Enable(LEUART_TypeDef *leuart, LEUART_Enable_TypeDef enable)
Enable/disable LEUART receiver and/or transmitter.
#define LEUART_CTRL_TXDMAWU
Low Energy Universal Asynchronous Receiver/Transmitter (LEUART) peripheral API.
void LEUART_Reset(LEUART_TypeDef *leuart)
Reset LEUART to same state as after a HW reset.
#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.
#define LEUART_SYNCBUSY_TXDATAX
#define LEUART_SYNCBUSY_TXDATA
#define LEUART_STATUS_TXBL
uint32_t LEUART_BaudrateCalc(uint32_t refFreq, uint32_t clkdiv)
Calculate baudrate for LEUART given reference frequency and clock division.
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.
#define _LEUART_CLKDIV_RESETVALUE
#define _LEUART_IEN_RESETVALUE
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_SIGFRAME_RESETVALUE
LEUART_Databits_TypeDef databits
LEUART_Enable_TypeDef enable