EFM32 Gecko Software Documentation
efm32g-doc-4.2.1
|
Universal Synchronous/Asynchronous Receiver/Transmitter (USART) peripheral API
. More...
Data Structures | |
struct | USART_InitAsync_TypeDef |
struct | USART_PrsTriggerInit_TypeDef |
struct | USART_InitSync_TypeDef |
struct | USART_InitIrDA_TypeDef |
Macros | |
#define | USART_INITASYNC_DEFAULT |
#define | USART_INITPRSTRIGGER_DEFAULT |
#define | USART_INITSYNC_DEFAULT |
#define | USART_INITIRDA_DEFAULT |
Enumerations | |
enum | USART_Databits_TypeDef { usartDatabits4 = USART_FRAME_DATABITS_FOUR, usartDatabits5 = USART_FRAME_DATABITS_FIVE, usartDatabits6 = USART_FRAME_DATABITS_SIX, usartDatabits7 = USART_FRAME_DATABITS_SEVEN, usartDatabits8 = USART_FRAME_DATABITS_EIGHT, usartDatabits9 = USART_FRAME_DATABITS_NINE, usartDatabits10 = USART_FRAME_DATABITS_TEN, usartDatabits11 = USART_FRAME_DATABITS_ELEVEN, usartDatabits12 = USART_FRAME_DATABITS_TWELVE, usartDatabits13 = USART_FRAME_DATABITS_THIRTEEN, usartDatabits14 = USART_FRAME_DATABITS_FOURTEEN, usartDatabits15 = USART_FRAME_DATABITS_FIFTEEN, usartDatabits16 = USART_FRAME_DATABITS_SIXTEEN } |
enum | USART_Enable_TypeDef { usartDisable = 0x0, usartEnableRx = USART_CMD_RXEN, usartEnableTx = USART_CMD_TXEN, usartEnable = (USART_CMD_RXEN | USART_CMD_TXEN) } |
enum | USART_OVS_TypeDef { usartOVS16 = USART_CTRL_OVS_X16, usartOVS8 = USART_CTRL_OVS_X8, usartOVS6 = USART_CTRL_OVS_X6, usartOVS4 = USART_CTRL_OVS_X4 } |
enum | USART_Parity_TypeDef { usartNoParity = USART_FRAME_PARITY_NONE, usartEvenParity = USART_FRAME_PARITY_EVEN, usartOddParity = USART_FRAME_PARITY_ODD } |
enum | USART_Stopbits_TypeDef { usartStopbits0p5 = USART_FRAME_STOPBITS_HALF, usartStopbits1 = USART_FRAME_STOPBITS_ONE, usartStopbits1p5 = USART_FRAME_STOPBITS_ONEANDAHALF, usartStopbits2 = USART_FRAME_STOPBITS_TWO } |
enum | USART_ClockMode_TypeDef { usartClockMode0 = USART_CTRL_CLKPOL_IDLELOW | USART_CTRL_CLKPHA_SAMPLELEADING, usartClockMode1 = USART_CTRL_CLKPOL_IDLELOW | USART_CTRL_CLKPHA_SAMPLETRAILING, usartClockMode2 = USART_CTRL_CLKPOL_IDLEHIGH | USART_CTRL_CLKPHA_SAMPLELEADING, usartClockMode3 = USART_CTRL_CLKPOL_IDLEHIGH | USART_CTRL_CLKPHA_SAMPLETRAILING } |
enum | USART_IrDAPw_Typedef { usartIrDAPwONE = USART_IRCTRL_IRPW_ONE, usartIrDAPwTWO = USART_IRCTRL_IRPW_TWO, usartIrDAPwTHREE = USART_IRCTRL_IRPW_THREE, usartIrDAPwFOUR = USART_IRCTRL_IRPW_FOUR } |
enum | USART_IrDAPrsSel_Typedef { usartIrDAPrsCh0 = USART_IRCTRL_IRPRSSEL_PRSCH0, usartIrDAPrsCh1 = USART_IRCTRL_IRPRSSEL_PRSCH1, usartIrDAPrsCh2 = USART_IRCTRL_IRPRSSEL_PRSCH2, usartIrDAPrsCh3 = USART_IRCTRL_IRPRSSEL_PRSCH3, usartIrDAPrsCh4 = USART_IRCTRL_IRPRSSEL_PRSCH4, usartIrDAPrsCh5 = USART_IRCTRL_IRPRSSEL_PRSCH5, usartIrDAPrsCh6 = USART_IRCTRL_IRPRSSEL_PRSCH6, usartIrDAPrsCh7 = USART_IRCTRL_IRPRSSEL_PRSCH7 } |
enum | USART_PrsTriggerCh_TypeDef { usartPrsTriggerCh0 = USART_TRIGCTRL_TSEL_PRSCH0, usartPrsTriggerCh1 = USART_TRIGCTRL_TSEL_PRSCH1, usartPrsTriggerCh2 = USART_TRIGCTRL_TSEL_PRSCH2, usartPrsTriggerCh3 = USART_TRIGCTRL_TSEL_PRSCH3, usartPrsTriggerCh4 = USART_TRIGCTRL_TSEL_PRSCH4, usartPrsTriggerCh5 = USART_TRIGCTRL_TSEL_PRSCH5, usartPrsTriggerCh6 = USART_TRIGCTRL_TSEL_PRSCH6, usartPrsTriggerCh7 = USART_TRIGCTRL_TSEL_PRSCH7 } |
Functions | |
void | USART_BaudrateAsyncSet (USART_TypeDef *usart, uint32_t refFreq, uint32_t baudrate, USART_OVS_TypeDef ovs) |
Configure USART/UART operating in asynchronous mode to use a given baudrate (or as close as possible to specified baudrate). More... | |
uint32_t | USART_BaudrateCalc (uint32_t refFreq, uint32_t clkdiv, bool syncmode, USART_OVS_TypeDef ovs) |
Calculate baudrate for USART/UART given reference frequency, clock division and oversampling rate (if async mode). More... | |
uint32_t | USART_BaudrateGet (USART_TypeDef *usart) |
Get current baudrate for USART/UART. More... | |
void | USART_BaudrateSyncSet (USART_TypeDef *usart, uint32_t refFreq, uint32_t baudrate) |
Configure USART operating in synchronous mode to use a given baudrate (or as close as possible to specified baudrate). More... | |
void | USART_Enable (USART_TypeDef *usart, USART_Enable_TypeDef enable) |
Enable/disable USART/UART receiver and/or transmitter. More... | |
void | USART_InitAsync (USART_TypeDef *usart, const USART_InitAsync_TypeDef *init) |
Init USART/UART for normal asynchronous mode. More... | |
void | USART_InitSync (USART_TypeDef *usart, const USART_InitSync_TypeDef *init) |
Init USART for synchronous mode. More... | |
void | USART_InitIrDA (const USART_InitIrDA_TypeDef *init) |
Init USART0 for asynchronous IrDA mode. More... | |
void | USART_InitPrsTrigger (USART_TypeDef *usart, const USART_PrsTriggerInit_TypeDef *init) |
Initialize automatic transmissions using PRS channel as trigger. More... | |
__STATIC_INLINE void | USART_IntClear (USART_TypeDef *usart, uint32_t flags) |
Clear one or more pending USART interrupts. More... | |
__STATIC_INLINE void | USART_IntDisable (USART_TypeDef *usart, uint32_t flags) |
Disable one or more USART interrupts. More... | |
__STATIC_INLINE void | USART_IntEnable (USART_TypeDef *usart, uint32_t flags) |
Enable one or more USART interrupts. More... | |
__STATIC_INLINE uint32_t | USART_IntGet (USART_TypeDef *usart) |
Get pending USART interrupt flags. More... | |
__STATIC_INLINE uint32_t | USART_IntGetEnabled (USART_TypeDef *usart) |
Get enabled and pending USART interrupt flags. Useful for handling more interrupt sources in the same interrupt handler. More... | |
__STATIC_INLINE void | USART_IntSet (USART_TypeDef *usart, uint32_t flags) |
Set one or more pending USART interrupts from SW. More... | |
__STATIC_INLINE uint32_t | USART_StatusGet (USART_TypeDef *usart) |
Get USART STATUS register. More... | |
void | USART_Reset (USART_TypeDef *usart) |
Reset USART/UART to same state as after a HW reset. More... | |
uint8_t | USART_Rx (USART_TypeDef *usart) |
Receive one 4-8 bit frame, (or part of 10-16 bit frame). More... | |
uint16_t | USART_RxDouble (USART_TypeDef *usart) |
Receive two 4-8 bit frames, or one 10-16 bit frame. More... | |
uint32_t | USART_RxDoubleExt (USART_TypeDef *usart) |
Receive two 4-9 bit frames, or one 10-16 bit frame with extended information. More... | |
uint16_t | USART_RxExt (USART_TypeDef *usart) |
Receive one 4-9 bit frame, (or part of 10-16 bit frame) with extended information. More... | |
__STATIC_INLINE uint8_t | USART_RxDataGet (USART_TypeDef *usart) |
Receive one 4-8 bit frame, (or part of 10-16 bit frame). More... | |
__STATIC_INLINE uint16_t | USART_RxDoubleGet (USART_TypeDef *usart) |
Receive two 4-8 bit frames, or one 10-16 bit frame. More... | |
__STATIC_INLINE uint32_t | USART_RxDoubleXGet (USART_TypeDef *usart) |
Receive two 4-9 bit frames, or one 10-16 bit frame with extended information. More... | |
__STATIC_INLINE uint16_t | USART_RxDataXGet (USART_TypeDef *usart) |
Receive one 4-9 bit frame, (or part of 10-16 bit frame) with extended information. More... | |
uint8_t | USART_SpiTransfer (USART_TypeDef *usart, uint8_t data) |
Perform one 8 bit frame SPI transfer. More... | |
void | USART_Tx (USART_TypeDef *usart, uint8_t data) |
Transmit one 4-9 bit frame. More... | |
void | USART_TxDouble (USART_TypeDef *usart, uint16_t data) |
Transmit two 4-9 bit frames, or one 10-16 bit frame. More... | |
void | USART_TxDoubleExt (USART_TypeDef *usart, uint32_t data) |
Transmit two 4-9 bit frames, or one 10-16 bit frame with extended control. More... | |
void | USART_TxExt (USART_TypeDef *usart, uint16_t data) |
Transmit one 4-9 bit frame with extended control. More... | |
Universal Synchronous/Asynchronous Receiver/Transmitter Peripheral API
.
#define USART_INITASYNC_DEFAULT |
Default config for USART async init structure.
Definition at line 345 of file em_usart.h.
Referenced by BSP_BccInit(), RETARGET_SerialInit(), and UARTDRV_Init().
#define USART_INITPRSTRIGGER_DEFAULT |
Default config for USART PRS triggering structure.
Definition at line 367 of file em_usart.h.
#define USART_INITSYNC_DEFAULT |
Default config for USART sync init structure.
Definition at line 456 of file em_usart.h.
Referenced by MICROSD_Init(), and SPIDRV_Init().
#define USART_INITIRDA_DEFAULT |
Default config for IrDA mode init structure.
Definition at line 496 of file em_usart.h.
Databit selection.
Definition at line 63 of file em_usart.h.
enum USART_Enable_TypeDef |
Enable selection.
Definition at line 82 of file em_usart.h.
enum USART_OVS_TypeDef |
Oversampling selection, used for asynchronous operation.
Enumerator | |
---|---|
usartOVS16 |
16x oversampling (normal). |
usartOVS8 |
8x oversampling. |
usartOVS6 |
6x oversampling. |
usartOVS4 |
4x oversampling. |
Definition at line 99 of file em_usart.h.
enum USART_Parity_TypeDef |
Parity selection, mainly used for asynchronous operation.
Enumerator | |
---|---|
usartNoParity |
No parity. |
usartEvenParity |
Even parity. |
usartOddParity |
Odd parity. |
Definition at line 109 of file em_usart.h.
Stopbits selection, used for asynchronous operation.
Enumerator | |
---|---|
usartStopbits0p5 |
0.5 stopbits. |
usartStopbits1 |
1 stopbits. |
usartStopbits1p5 |
1.5 stopbits. |
usartStopbits2 |
2 stopbits. |
Definition at line 118 of file em_usart.h.
Clock polarity/phase mode.
Definition at line 128 of file em_usart.h.
enum USART_IrDAPw_Typedef |
Pulse width selection for IrDA mode.
Definition at line 145 of file em_usart.h.
PRS channel selection for IrDA mode.
Definition at line 162 of file em_usart.h.
USART PRS Transmit Trigger Channels
Definition at line 230 of file em_usart.h.
void USART_BaudrateAsyncSet | ( | USART_TypeDef * | usart, |
uint32_t | refFreq, | ||
uint32_t | baudrate, | ||
USART_OVS_TypeDef | ovs | ||
) |
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | refFreq | USART/UART reference clock frequency in Hz that will be used. If set to 0, the currently configured reference clock is assumed. |
[in] | baudrate | Baudrate to try to achieve for USART/UART. |
[in] | ovs | Oversampling to be used. Normal is 16x oversampling, but lower oversampling may be used to achieve higher rates or better baudrate accuracy in some cases. Notice that lower oversampling frequency makes channel more vulnerable to bit faults during reception due to clock inaccuracies compared to link partner. |
Definition at line 162 of file em_usart.c.
References _USART_CLKDIV_DIV_MASK, _USART_CTRL_OVS_MASK, USART_TypeDef::CLKDIV, CMU_ClockFreqGet(), cmuClock_HFPER, USART_TypeDef::CTRL, USART_CTRL_OVS_X16, USART_CTRL_OVS_X4, USART_CTRL_OVS_X6, and USART_CTRL_OVS_X8.
Referenced by USART_InitAsync().
uint32_t USART_BaudrateCalc | ( | uint32_t | refFreq, |
uint32_t | clkdiv, | ||
bool | syncmode, | ||
USART_OVS_TypeDef | ovs | ||
) |
This function returns the baudrate that a USART/UART module will use if configured with the given frequency, clock divisor and mode. Notice that this function will not use actual HW configuration. It can be used to determinate if a given configuration is sufficiently accurate for the application.
[in] | refFreq | USART/UART HF peripheral frequency used. |
[in] | clkdiv | Clock division factor to be used. |
[in] | syncmode |
|
[in] | ovs | Oversampling used if asynchronous mode. Not used if syncmode is true. |
Definition at line 293 of file em_usart.c.
References _USART_CLKDIV_MASK, USART_CTRL_OVS_X16, USART_CTRL_OVS_X6, and USART_CTRL_OVS_X8.
Referenced by USART_BaudrateGet().
uint32_t USART_BaudrateGet | ( | USART_TypeDef * | usart | ) |
This function returns the actual baudrate (not considering oscillator inaccuracies) used by a USART/UART peripheral.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 423 of file em_usart.c.
References _USART_CTRL_OVS_MASK, USART_TypeDef::CLKDIV, CMU_ClockFreqGet(), cmuClock_HFPER, USART_TypeDef::CTRL, USART_BaudrateCalc(), and USART_CTRL_SYNC.
Referenced by SPIDRV_GetBitrate().
void USART_BaudrateSyncSet | ( | USART_TypeDef * | usart, |
uint32_t | refFreq, | ||
uint32_t | baudrate | ||
) |
The configuration will be set to use a baudrate <= the specified baudrate in order to ensure that the baudrate does not exceed the specified value.
Fractional clock division is suppressed, although the HW design allows it. It could cause half clock cycles to exceed specified limit, and thus potentially violate specifications for the slave device. In some special situations fractional clock division may be useful even in synchronous mode, but in those cases it must be directly adjusted, possibly assisted by USART_BaudrateCalc():
[in] | usart | Pointer to USART peripheral register block. (Cannot be used on UART modules.) |
[in] | refFreq | USART reference clock frequency in Hz that will be used. If set to 0, the currently configured reference clock is assumed. |
[in] | baudrate | Baudrate to try to achieve for USART. |
Definition at line 472 of file em_usart.c.
References _USART_CLKDIV_DIV_MASK, BUS_RegMaskedWrite(), USART_TypeDef::CLKDIV, CMU_ClockFreqGet(), and cmuClock_HFPER.
Referenced by MICROSD_SpiClkFast(), MICROSD_SpiClkSlow(), SPIDRV_SetBitrate(), and USART_InitSync().
void USART_Enable | ( | USART_TypeDef * | usart, |
USART_Enable_TypeDef | enable | ||
) |
Notice that this function does not do any configuration. Enabling should normally be done after initialization is done (if not enabled as part of init).
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | enable | Select status for receiver/transmitter. |
Definition at line 541 of file em_usart.c.
References _USART_CMD_RXEN_MASK, _USART_CMD_TXEN_MASK, and USART_TypeDef::CMD.
Referenced by RETARGET_SerialInit(), and UARTDRV_Init().
void USART_InitAsync | ( | USART_TypeDef * | usart, |
const USART_InitAsync_TypeDef * | init | ||
) |
This function will configure basic settings in order to operate in normal asynchronous mode.
Special control setup not covered by this function must be done after using this function by direct modification of the CTRL register.
Notice that pins used by the USART/UART module must be properly configured by the user explicitly, in order for the USART/UART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.)
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | init | Pointer to initialization structure used to configure basic async setup. |
Definition at line 583 of file em_usart.c.
References USART_InitAsync_TypeDef::baudrate, USART_TypeDef::CMD, USART_TypeDef::CTRL, USART_InitAsync_TypeDef::databits, USART_InitAsync_TypeDef::enable, USART_TypeDef::FRAME, USART_InitAsync_TypeDef::oversampling, USART_InitAsync_TypeDef::parity, USART_InitAsync_TypeDef::refFreq, USART_InitAsync_TypeDef::stopbits, USART_BaudrateAsyncSet(), USART_CTRL_AUTOCS, and USART_Reset().
Referenced by BSP_BccInit(), RETARGET_SerialInit(), UARTDRV_Init(), and USART_InitIrDA().
void USART_InitSync | ( | USART_TypeDef * | usart, |
const USART_InitSync_TypeDef * | init | ||
) |
This function will configure basic settings in order to operate in synchronous mode.
Special control setup not covered by this function must be done after using this function by direct modification of the CTRL register.
Notice that pins used by the USART module must be properly configured by the user explicitly, in order for the USART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.)
[in] | usart | Pointer to USART peripheral register block. (UART does not support this mode.) |
[in] | init | Pointer to initialization structure used to configure basic async setup. |
Definition at line 654 of file em_usart.c.
References USART_InitSync_TypeDef::baudrate, USART_InitSync_TypeDef::clockMode, USART_TypeDef::CMD, USART_TypeDef::CTRL, USART_InitSync_TypeDef::databits, USART_InitSync_TypeDef::enable, USART_TypeDef::FRAME, USART_InitSync_TypeDef::master, USART_InitSync_TypeDef::msbf, USART_InitSync_TypeDef::refFreq, USART_BaudrateSyncSet(), USART_CMD_MASTEREN, USART_CTRL_AUTOCS, USART_CTRL_MSBF, USART_CTRL_SYNC, USART_FRAME_PARITY_DEFAULT, USART_FRAME_STOPBITS_DEFAULT, and USART_Reset().
Referenced by MICROSD_Init(), SPI_TFT_Init(), and SPIDRV_Init().
void USART_InitIrDA | ( | const USART_InitIrDA_TypeDef * | init | ) |
This function will configure basic settings in order to operate in asynchronous IrDA mode.
Special control setup not covered by this function must be done after using this function by direct modification of the CTRL and IRCTRL registers.
Notice that pins used by the USART/UART module must be properly configured by the user explicitly, in order for the USART/UART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.)
[in] | init | Pointer to initialization structure used to configure async IrDA setup. |
Definition at line 735 of file em_usart.c.
References _USART_IRCTRL_IRFILT_SHIFT, _USART_IRCTRL_IRPRSEN_SHIFT, USART_InitIrDA_TypeDef::async, USART_TypeDef::CTRL, USART_TypeDef::IRCTRL, USART_InitIrDA_TypeDef::irFilt, USART_InitIrDA_TypeDef::irPrsEn, USART_InitIrDA_TypeDef::irPrsSel, USART_InitIrDA_TypeDef::irPw, USART_InitIrDA_TypeDef::irRxInv, USART0, USART1, USART_CTRL_RXINV, USART_CTRL_TXINV, USART_InitAsync(), and USART_IRCTRL_IREN.
void USART_InitPrsTrigger | ( | USART_TypeDef * | usart, |
const USART_PrsTriggerInit_TypeDef * | init | ||
) |
[in] | usart | Pointer to USART to configure |
[in] | init | Pointer to initialization structure |
Definition at line 836 of file em_usart.c.
References _USART_TRIGCTRL_RXTEN_MASK, _USART_TRIGCTRL_TSEL_MASK, _USART_TRIGCTRL_TXTEN_MASK, USART_PrsTriggerInit_TypeDef::prsTriggerChannel, USART_PrsTriggerInit_TypeDef::rxTriggerEnable, USART_TypeDef::TRIGCTRL, USART_PrsTriggerInit_TypeDef::txTriggerEnable, USART_TRIGCTRL_RXTEN, and USART_TRIGCTRL_TXTEN.
__STATIC_INLINE void USART_IntClear | ( | USART_TypeDef * | usart, |
uint32_t | flags | ||
) |
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | flags | Pending USART/UART interrupt source(s) to clear. Use one or more valid interrupt flags for the USART module (USART_IF_nnn) OR'ed together. |
Definition at line 605 of file em_usart.h.
References USART_TypeDef::IFC.
Referenced by RETARGET_SerialInit(), and UARTDRV_Init().
__STATIC_INLINE void USART_IntDisable | ( | USART_TypeDef * | usart, |
uint32_t | flags | ||
) |
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | flags | USART/UART interrupt source(s) to disable. Use one or more valid interrupt flags for the USART module (USART_IF_nnn) OR'ed together. |
Definition at line 622 of file em_usart.h.
References USART_TypeDef::IEN.
__STATIC_INLINE void USART_IntEnable | ( | USART_TypeDef * | usart, |
uint32_t | flags | ||
) |
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | flags | USART/UART interrupt source(s) to enable. Use one or more valid interrupt flags for the USART module (USART_IF_nnn) OR'ed together. |
Definition at line 644 of file em_usart.h.
References USART_TypeDef::IEN.
Referenced by RETARGET_SerialInit().
__STATIC_INLINE uint32_t USART_IntGet | ( | USART_TypeDef * | usart | ) |
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 664 of file em_usart.h.
References USART_TypeDef::IF.
__STATIC_INLINE uint32_t USART_IntGetEnabled | ( | USART_TypeDef * | usart | ) |
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 689 of file em_usart.h.
References USART_TypeDef::IEN, and USART_TypeDef::IF.
__STATIC_INLINE void USART_IntSet | ( | USART_TypeDef * | usart, |
uint32_t | flags | ||
) |
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | flags | USART/UART interrupt source(s) to set to pending. Use one or more valid interrupt flags for the USART module (USART_IF_nnn) OR'ed together. |
Definition at line 713 of file em_usart.h.
References USART_TypeDef::IFS.
__STATIC_INLINE uint32_t USART_StatusGet | ( | USART_TypeDef * | usart | ) |
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 730 of file em_usart.h.
References USART_TypeDef::STATUS.
void USART_Reset | ( | USART_TypeDef * | usart | ) |
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 876 of file em_usart.c.
References _USART_CLKDIV_RESETVALUE, _USART_CTRL_RESETVALUE, _USART_FRAME_RESETVALUE, _USART_IEN_RESETVALUE, _USART_IFC_MASK, _USART_IRCTRL_RESETVALUE, _USART_ROUTE_RESETVALUE, _USART_TRIGCTRL_RESETVALUE, USART_TypeDef::CLKDIV, USART_TypeDef::CMD, USART_TypeDef::CTRL, USART_TypeDef::FRAME, USART_TypeDef::IEN, USART_TypeDef::IFC, USART_TypeDef::IRCTRL, USART_TypeDef::ROUTE, USART_TypeDef::TRIGCTRL, USART_CMD_CLEARRX, USART_CMD_CLEARTX, USART_CMD_MASTERDIS, USART_CMD_RXBLOCKDIS, USART_CMD_RXDIS, USART_CMD_TXDIS, and USART_CMD_TXTRIDIS.
Referenced by BSP_BccDeInit(), MICROSD_Deinit(), SPI_TFT_Init(), SPIDRV_DeInit(), UARTDRV_DeInit(), USART_InitAsync(), and USART_InitSync().
uint8_t USART_Rx | ( | USART_TypeDef * | usart | ) |
This function is normally used to receive one frame when operating with frame length 4-8 bits. Please refer to USART_RxExt() for reception of 9 bit frames.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 943 of file em_usart.c.
References USART_TypeDef::RXDATA, USART_TypeDef::STATUS, and USART_STATUS_RXDATAV.
Referenced by SPI_TFT_WriteRegister().
uint16_t USART_RxDouble | ( | USART_TypeDef * | usart | ) |
This function is normally used to receive one frame when operating with frame length 10-16 bits. Please refer to USART_RxDoubleExt() for reception of two 9 bit frames.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 976 of file em_usart.c.
References USART_TypeDef::RXDOUBLE, USART_TypeDef::STATUS, and USART_STATUS_RXFULL.
uint32_t USART_RxDoubleExt | ( | USART_TypeDef * | usart | ) |
This function is normally used to receive one frame when operating with frame length 10-16 bits and additional RX status information is required.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 1009 of file em_usart.c.
References USART_TypeDef::RXDOUBLEX, USART_TypeDef::STATUS, and USART_STATUS_RXFULL.
uint16_t USART_RxExt | ( | USART_TypeDef * | usart | ) |
This function is normally used to receive one frame when operating with frame length 4-9 bits and additional RX status information is required.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 1042 of file em_usart.c.
References USART_TypeDef::RXDATAX, USART_TypeDef::STATUS, and USART_STATUS_RXDATAV.
__STATIC_INLINE uint8_t USART_RxDataGet | ( | USART_TypeDef * | usart | ) |
This function is used to quickly receive one 4-8 bits frame by reading the RXDATA register directly, without checking the STATUS register for the RXDATAV flag. This can be useful from the RXDATAV interrupt handler, i.e. waiting is superfluous, in order to quickly read the received data. Please refer to USART_RxDataXGet() for reception of 9 bit frames.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 770 of file em_usart.h.
References USART_TypeDef::RXDATA.
__STATIC_INLINE uint16_t USART_RxDoubleGet | ( | USART_TypeDef * | usart | ) |
This function is used to quickly receive one 10-16 bits frame or two 4-8 bit frames by reading the RXDOUBLE register directly, without checking the STATUS register for the RXDATAV flag. This can be useful from the RXDATAV interrupt handler, i.e. waiting is superfluous, in order to quickly read the received data. This function is normally used to receive one frame when operating with frame length 10-16 bits. Please refer to USART_RxDoubleXGet() for reception of two 9 bit frames.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 808 of file em_usart.h.
References USART_TypeDef::RXDOUBLE.
__STATIC_INLINE uint32_t USART_RxDoubleXGet | ( | USART_TypeDef * | usart | ) |
This function is used to quickly receive one 10-16 bits frame or two 4-9 bit frames by reading the RXDOUBLEX register directly, without checking the STATUS register for the RXDATAV flag. This can be useful from the RXDATAV interrupt handler, i.e. waiting is superfluous, in order to quickly read the received data.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 844 of file em_usart.h.
References USART_TypeDef::RXDOUBLEX.
__STATIC_INLINE uint16_t USART_RxDataXGet | ( | USART_TypeDef * | usart | ) |
This function is used to quickly receive one 4-9 bit frame, (or part of 10-16 bit frame) with extended information by reading the RXDATAX register directly, without checking the STATUS register for the RXDATAV flag. This can be useful from the RXDATAV interrupt handler, i.e. waiting is superfluous, in order to quickly read the received data.
[in] | usart | Pointer to USART/UART peripheral register block. |
Definition at line 879 of file em_usart.h.
References USART_TypeDef::RXDATAX.
uint8_t USART_SpiTransfer | ( | USART_TypeDef * | usart, |
uint8_t | data | ||
) |
[in] | usart | Pointer to USART peripheral register block. |
[in] | data | Data to transmit. |
Definition at line 1070 of file em_usart.c.
References USART_TypeDef::RXDATA, USART_TypeDef::STATUS, USART_TypeDef::TXDATA, USART_STATUS_TXBL, and USART_STATUS_TXC.
Referenced by MICROSD_XferSpi().
void USART_Tx | ( | USART_TypeDef * | usart, |
uint8_t | data | ||
) |
Depending on frame length configuration, 4-8 (least significant) bits from data
are transmitted. If frame length is 9, 8 bits are transmitted from data
and one bit as specified by CTRL register, BIT8DV field. Please refer to USART_TxExt() for transmitting 9 bit frame with full control of all 9 bits.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | data | Data to transmit. See details above for further info. |
Definition at line 1104 of file em_usart.c.
References USART_TypeDef::STATUS, USART_TypeDef::TXDATA, and USART_STATUS_TXBL.
Referenced by SPI_TFT_WriteRegister().
void USART_TxDouble | ( | USART_TypeDef * | usart, |
uint16_t | data | ||
) |
Depending on frame length configuration, 4-8 (least significant) bits from each byte in data
are transmitted. If frame length is 9, 8 bits are transmitted from each byte in data
adding one bit as specified by CTRL register, BIT8DV field, to each byte. Please refer to USART_TxDoubleExt() for transmitting two 9 bit frames with full control of all 9 bits.
If frame length is 10-16, 10-16 (least significant) bits from data
are transmitted.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | data | Data to transmit, the least significant byte holds the frame transmitted first. See details above for further info. |
Definition at line 1140 of file em_usart.c.
References USART_TypeDef::STATUS, USART_TypeDef::TXDOUBLE, and USART_STATUS_TXBL.
void USART_TxDoubleExt | ( | USART_TypeDef * | usart, |
uint32_t | data | ||
) |
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | data | Data to transmit with extended control. Contains two 16 bit words concatenated. Least significant word holds frame transitted first. If frame length is 4-9, two frames with 4-9 least significant bits from each 16 bit word are transmitted. |
Definition at line 1176 of file em_usart.c.
References USART_TypeDef::STATUS, USART_TypeDef::TXDOUBLEX, and USART_STATUS_TXBL.
void USART_TxExt | ( | USART_TypeDef * | usart, |
uint16_t | data | ||
) |
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length.
[in] | usart | Pointer to USART/UART peripheral register block. |
[in] | data | Data to transmit with extended control. Least significant bits contains frame bits, and additional control bits are available as documented in the reference manual (set to 0 if not used). |
Definition at line 1204 of file em_usart.c.
References USART_TypeDef::STATUS, USART_TypeDef::TXDATAX, and USART_STATUS_TXBL.