EFM32 Gecko Software Documentation
efm32g-doc-5.1.2
|
Universal synchronous/asynchronous receiver/transmitter (USART/UART) peripheral API.
Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no obligation to support this Software. Silicon Labs is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.
Silicon Labs will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.
Definition in file em_usart.h.
Go to the source code of this file.
Data Structures | |
struct | USART_InitAsync_TypeDef |
struct | USART_InitIrDA_TypeDef |
struct | USART_InitSync_TypeDef |
struct | USART_PrsTriggerInit_TypeDef |
Macros | |
#define | USART_INITASYNC_DEFAULT |
#define | USART_INITIRDA_DEFAULT |
#define | USART_INITPRSTRIGGER_DEFAULT |
#define | USART_INITSYNC_DEFAULT |
Enumerations | |
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_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_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_IrDAPw_Typedef { usartIrDAPwONE = USART_IRCTRL_IRPW_ONE, usartIrDAPwTWO = USART_IRCTRL_IRPW_TWO, usartIrDAPwTHREE = USART_IRCTRL_IRPW_THREE, usartIrDAPwFOUR = USART_IRCTRL_IRPW_FOUR } |
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_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 } |
enum | USART_Stopbits_TypeDef { usartStopbits0p5 = USART_FRAME_STOPBITS_HALF, usartStopbits1 = USART_FRAME_STOPBITS_ONE, usartStopbits1p5 = USART_FRAME_STOPBITS_ONEANDAHALF, usartStopbits2 = USART_FRAME_STOPBITS_TWO } |
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... | |
__STATIC_INLINE void | USART_InitIrDA (const USART_InitIrDA_TypeDef *init) |
Init DEFAULT_IRDA_USART 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... | |
void | USART_InitSync (USART_TypeDef *usart, const USART_InitSync_TypeDef *init) |
Init USART for synchronous mode. 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... | |
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... | |
__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_RxDataXGet (USART_TypeDef *usart) |
Receive one 4-9 bit frame, (or part of 10-16 bit frame) with extended information. 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... | |
__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... | |
uint16_t | USART_RxExt (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... | |
__STATIC_INLINE uint32_t | USART_StatusGet (USART_TypeDef *usart) |
Get USART STATUS register. 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... | |
void | USARTn_InitIrDA (USART_TypeDef *usart, const USART_InitIrDA_TypeDef *init) |
Init USART for asynchronous IrDA mode. More... | |