80 denominator = LPUART_Config->
Baudrate;
82 bdr = numerator / n / denominator - 1;
84 LPUART->BDR = ( uint16_t )( bdr & 0xffff );
97 if( LPUART_Config == NULL )
109 | ( LPUART_Config->
OverSampling << LPUART_CR1_OVRS_Pos )
110 | ( LPUART_Config->
DataBit << LPUART_CR1_DLEN_Pos )
111 | ( LPUART_Config->
ParityBit << LPUART_CR1_PSEL_Pos )
112 | ( LPUART_Config->
StopBit << LPUART_CR1_STOPB_Pos )
113 | ( 1 << LPUART_CR1_TXE_Pos )
114 | ( 1 << LPUART_CR1_RXE_Pos )
151 if( LPUART_Config == NULL )
156 LPUART_Config->
BaseClock = SystemPeriClock;
187 switch( LPUART_IntCfg )
190 mask = LPUART_IER_RXCIEN_Msk;
193 mask = LPUART_IER_TXCIEN_Msk;
196 mask = LPUART_IER_SBDIEN_Msk;
199 mask = LPUART_IER_RTOIEN_Msk;
202 mask = LPUART_IER_RCDIEN_Msk;
216 LPUART->IER &= ~mask;
255 mask = LPUART_CR1_PEN_Msk;
258 mask = LPUART_CR1_STKPEN_Msk;
261 mask = LPUART_CR1_PSEL_Msk;
264 mask = LPUART_CR1_STOPB_Msk;
267 mask = LPUART_CR1_HDCOM_Msk;
270 mask = LPUART_CR1_TXE_Msk;
273 mask = LPUART_CR1_RXE_Msk;
276 mask = LPUART_CR1_WAKEN_Msk;
279 mask = LPUART_CR1_LPUEN_Msk;
293 LPUART->CR1 &= ~mask;
304 mask = LPUART_CR2_DEPOL_Msk;
307 mask = LPUART_CR2_DEPEN_Msk;
310 mask = LPUART_CR2_RCDEN_Msk;
313 mask = LPUART_CR2_RTOEN_Msk;
327 LPUART->CR2 &= ~mask;
342 LPUART->CR1_b.LPUEN = state;
370 reg |= LPUART_IFSR_RXCIFLAG_Msk;
373 reg |= LPUART_IFSR_TXCIFLAG_Msk;
376 reg |= LPUART_IFSR_SBDIFLAG_Msk;
379 reg |= LPUART_IFSR_RTOIFLAG_Msk;
382 reg |= LPUART_IFSR_RCDIFLAG_Msk;
385 reg |= LPUART_IFSR_RXBUSY_Msk;
388 reg |= LPUART_IFSR_PE_Msk;
391 reg |= LPUART_IFSR_FE_Msk;
394 reg |= LPUART_IFSR_DOR_Msk;
452 uint32_t bToSend, bSent, timeOut;
453 uint8_t* pChar = txbuf;
468 timeOut = LPUART_BLOCKING_TIMEOUT;
469 while( !( LPUART->IFSR & LPUART_IFSR_TXCIFLAG_Msk ) )
499 if( !( LPUART->IFSR & LPUART_IFSR_TXCIFLAG_Msk ) )
533 uint32_t bToRecv, bRecv, timeOut;
534 uint8_t* pChar = rxbuf;
546 timeOut = LPUART_BLOCKING_TIMEOUT;
547 while( !( LPUART->IFSR & LPUART_IFSR_RXCIFLAG_Msk ) )
577 if( !( LPUART->IFSR & LPUART_IFSR_RXCIFLAG_Msk ) )
LPUART_OVER_SAMPLING_Type OverSampling
uint8_t HAL_LPUART_ReceiveByte(void)
Receive a single data from USART peripheral.
HAL_Status_Type HAL_LPUART_ConfigInterrupt(LPUART_INT_Type LPUART_IntCfg, FunctionalState NewState)
Configure the interrupt source of selected LPUART peripheral.
HAL_Status_Type HAL_LPUART_DeInit(void)
Deinitialize the LPUART peripheral registers to their default reset values.
void HAL_SCU_Peripheral_EnableClock2(uint32_t u32PeriClk2, uint32_t u32Ind)
Set Each Peripheral Clock.
HAL_Status_Type HAL_LPUART_Init(LPUART_CFG_Type *LPUART_Config)
Initialize the LPUART peripheral with the specified parameters.
HAL_Status_Type HAL_LPUART_DataControlConfig(LPUART_CONTROL_Type Mode, FunctionalState NewState)
Configure Data Control mode for LPUART peripheral.
HAL_Status_Type HAL_LPUART_Enable(FunctionalState state)
LPUART enable control.
HAL_Status_Type HAL_LPUART_ClearStatus(LPUART_STATUS_Type Status)
This function clears Interrupt Flag and Status Register.
uint32_t HAL_LPUART_Receive(uint8_t *rxbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag)
Receive a block of data via LPUART peripheral.
uint32_t HAL_LPUART_Transmit(uint8_t *txbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag)
Send a block of data via LPUART peripheral.
Contains all macro definitions and function prototypes support for lpuart firmware library on A31L12x...
LPUART_STOP_BIT_Type StopBit
LPUART_PARITY_BIT_Type ParityBit
HAL_Status_Type HAL_LPUART_ConfigStructInit(LPUART_CFG_Type *LPUART_Config)
Fills each LPUART_Config member with its default value:
uint8_t HAL_LPUART_GetStatus(void)
This function returns the current value of Interrupt Flag and Status Register.
static void lpuart_set_divisors(LPUART_CFG_Type *LPUART_Config)
Determines best dividers to get a target clock rate.
void HAL_SCU_Peripheral_SetReset2(uint32_t u32EachPeri2)
Set/Reset Each Peripheral Block Reset of PPRST2 Register.
LPUART_DATA_BIT_Type DataBit
Contains all macro definitions and function prototypes support for scu firmware library on A31L12x.
HAL_Status_Type HAL_LPUART_TransmitByte(uint8_t Data)
Transmit a single data through USART peripheral.