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)
522 leuart->ROUTE = _LEUART_ROUTE_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_PARITY_MASK
LEUART_Stopbits_TypeDef stopbits
Emlib peripheral API "assert" implementation.
#define LEUART_STATUS_TXBL
#define LEUART_FREEZE_REGFREEZE
#define _LEUART_STARTFRAME_RESETVALUE
#define LEUART_CMD_RXBLOCKDIS
#define LEUART_CMD_CLEARRX
#define _LEUART_CTRL_RESETVALUE
void LEUART_Init(LEUART_TypeDef *leuart, LEUART_Init_TypeDef const *init)
Init LEUART.
void LEUART_TxExt(LEUART_TypeDef *leuart, uint16_t data)
Transmit one 8-9 bit frame with extended control.
#define _LEUART_IEN_RESETVALUE
#define _LEUART_ROUTELOC0_RESETVALUE
#define _LEUART_SIGFRAME_RESETVALUE
#define LEUART_SYNCBUSY_TXDATAX
#define LEUART_STATUS_RXDATAV
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
#define _LEUART_ROUTEPEN_RESETVALUE
__IOM uint32_t STARTFRAME
#define LEUART_SYNCBUSY_CTRL
LEUART_Parity_TypeDef parity
void LEUART_Enable(LEUART_TypeDef *leuart, LEUART_Enable_TypeDef enable)
Enable/disable LEUART receiver and/or transmitter.
#define LEUART_SYNCBUSY_TXDATA
Low Energy Universal Asynchronous Receiver/Transmitter (LEUART) peripheral API.
#define LEUART_CMD_CLEARTX
void LEUART_Reset(LEUART_TypeDef *leuart)
Reset LEUART to same state as after a HW reset.
#define _LEUART_CTRL_STOPBITS_MASK
#define _LEUART_PULSECTRL_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_CLKDIV
#define _LEUART_CMD_TXEN_MASK
#define LEUART_CTRL_TXDMAWU
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_CTRL_RXDMAWU
#define LEUART_SYNCBUSY_CMD
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_CLKDIV_RESETVALUE
LEUART_Databits_TypeDef databits
#define _LEUART_CMD_RXEN_MASK
LEUART_Enable_TypeDef enable