STM8L15x Standard Peripherals Drivers: stm8l15x_usart.h File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_usart.h File Reference

This file contains all the functions prototypes for the USART firmware library. More...

#include "stm8l15x.h" #include "stm8l15x_clk.h"

Go to the source code of this file.

Defines

#define IS_USART_CLEAR_FLAG(Flag)
#define IS_USART_CLEAR_IT(IT)   (((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE))
#define IS_USART_CLOCK(CLOCK)   (((CLOCK) == USART_Clock_Disable) ||((CLOCK) == USART_Clock_Enable))
#define IS_USART_CONFIG_IT(Interrupt)
#define IS_USART_CPHA(CPHA)   (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge))
#define IS_USART_CPOL(CPOL)   (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High))
#define IS_USART_DMAREQ(DMAReq)   ((((DMAReq) & (uint8_t)0x3F) == 0x00) && ((DMAReq) != (uint8_t)0x00))
#define IS_USART_FLAG(Flag)
#define IS_USART_GET_IT(ITPendingBit)
#define IS_USART_IRDAMODE(IrDAMode)
#define IS_USART_LASTBIT(LASTBIT)
#define IS_USART_MODE(MODE)   ((((MODE) & (uint8_t)0xF3) == 0x00) && ((MODE) != (uint16_t)0x00))
#define IS_USART_PARITY(Parity)
#define IS_USART_STOPBITS(StopBit)
#define IS_USART_WAKEUP(WakeUpMode)
#define IS_USART_WORDLENGTH(WordLength)
#define IS_USART_BAUDRATE(NUM)   ((NUM) <= (uint32_t)625000)
 
#define USART_ADDRESS_MAX   ((uint8_t)16)
#define IS_USART_ADDRESS(address)   ((address) < USART_ADDRESS_MAX)
#define USART_DATA_9BITS_MAX   ((uint16_t)0x1FF)
#define IS_USART_DATA_9BITS(DATA)   ((DATA) < USART_DATA_9BITS_MAX)

Enumerations

enum  USART_Clock_TypeDef { USART_Clock_Disable = (uint8_t)0x00, USART_Clock_Enable = (uint8_t)0x08 }
enum  USART_CPHA_TypeDef { USART_CPHA_1Edge = (uint8_t)0x00, USART_CPHA_2Edge = (uint8_t)0x02 }
enum  USART_CPOL_TypeDef { USART_CPOL_Low = (uint8_t)0x00, USART_CPOL_High = (uint8_t)0x04 }
enum  USART_DMAReq_TypeDef { USART_DMAReq_TX = (uint8_t)0x80, USART_DMAReq_RX = (uint8_t)0x40 }
enum  USART_FLAG_TypeDef {
  USART_FLAG_TXE = (uint16_t)0x0080, USART_FLAG_TC = (uint16_t)0x0040, USART_FLAG_RXNE = (uint16_t)0x0020, USART_FLAG_IDLE = (uint16_t)0x0010,
  USART_FLAG_OR = (uint16_t)0x0008, USART_FLAG_NF = (uint16_t)0x0004, USART_FLAG_FE = (uint16_t)0x0002, USART_FLAG_PE = (uint16_t)0x0001,
  USART_FLAG_SBK = (uint16_t)0x0101
}
enum  USART_IrDAMode_TypeDef { USART_IrDAMode_Normal = (uint8_t)0x00, USART_IrDAMode_LowPower = (uint8_t)0x01 }
enum  USART_IT_TypeDef {
  USART_IT_TXE = (uint16_t)0x0277, USART_IT_TC = (uint16_t)0x0266, USART_IT_RXNE = (uint16_t)0x0255, USART_IT_IDLE = (uint16_t)0x0244,
  USART_IT_OR = (uint16_t)0x0235, USART_IT_PE = (uint16_t)0x0100, USART_IT_ERR = (uint16_t)0x0500, USART_IT_NF = (uint16_t)0x0102,
  USART_IT_FE = (uint16_t)0x0101
}
 

USART Interrupt definition USART_IT possible values Elements values convention: 0x0ZYX X: Position of the corresponding Interrupt Y: Flag position Z: Register index.

More...
enum  USART_LastBit_TypeDef { USART_LastBit_Disable = (uint8_t)0x00, USART_LastBit_Enable = (uint8_t)0x01 }
enum  USART_LINBreakDetectionLength_TypeDef { USART_LINBreakDetectionLength_10BITS = (uint8_t)0x00, USART_LINBreakDetectionLength_11BITS = (uint8_t)0x01 }
enum  USART_Mode_TypeDef { USART_Mode_Rx = (uint8_t)0x04, USART_Mode_Tx = (uint8_t)0x08 }
enum  USART_Parity_TypeDef { USART_Parity_No = (uint8_t)0x00, USART_Parity_Even = (uint8_t)0x04, USART_Parity_Odd = (uint8_t)0x06 }
enum  USART_StopBits_TypeDef { USART_StopBits_1 = (uint8_t)0x00, USART_StopBits_2 = (uint8_t)0x20, USART_StopBits_1_5 = (uint8_t)0x30 }
enum  USART_WakeUp_TypeDef { USART_WakeUp_IdleLine = (uint8_t)0x00, USART_WakeUp_AddressMark = (uint8_t)0x08 }
enum  USART_WordLength_TypeDef { USART_WordLength_8b = (uint8_t)0x00, USART_WordLength_9b = (uint8_t)0x10 }

Functions

void USART_ClearFlag (USART_TypeDef *USARTx, USART_FLAG_TypeDef USART_FLAG)
 Clears the USARTx's pending flags.
void USART_ClearITPendingBit (USART_TypeDef *USARTx, USART_IT_TypeDef USART_IT)
 Clears the USARTx�s interrupt pending bits.
void USART_ClockInit (USART_TypeDef *USARTx, USART_Clock_TypeDef USART_Clock, USART_CPOL_TypeDef USART_CPOL, USART_CPHA_TypeDef USART_CPHA, USART_LastBit_TypeDef USART_LastBit)
 Initializes the USART Clock according to the specified parameters.
void USART_Cmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enable the USART peripheral.
void USART_DeInit (USART_TypeDef *USARTx)
 Deinitializes the USART peripheral.
void USART_DMACmd (USART_TypeDef *USARTx, USART_DMAReq_TypeDef USART_DMAReq, FunctionalState NewState)
 Enables or disables the USART DMA interface.
FlagStatus USART_GetFlagStatus (USART_TypeDef *USARTx, USART_FLAG_TypeDef USART_FLAG)
 Checks whether the specified USART flag is set or not.
ITStatus USART_GetITStatus (USART_TypeDef *USARTx, USART_IT_TypeDef USART_IT)
 Checks whether the specified USART interrupt has occurred or not.
void USART_HalfDuplexCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART�s Half Duplex communication.
void USART_Init (USART_TypeDef *USARTx, uint32_t BaudRate, USART_WordLength_TypeDef USART_WordLength, USART_StopBits_TypeDef USART_StopBits, USART_Parity_TypeDef USART_Parity, USART_Mode_TypeDef USART_Mode)
 Initializes the USART according to the specified parameters.
void USART_IrDACmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART�s IrDA interface.
void USART_IrDAConfig (USART_TypeDef *USARTx, USART_IrDAMode_TypeDef USART_IrDAMode)
 Configures the USART�s IrDA interface.
void USART_ITConfig (USART_TypeDef *USARTx, USART_IT_TypeDef USART_IT, FunctionalState NewState)
 Enables or disables the specified USART interrupts.
uint8_t USART_ReceiveData8 (USART_TypeDef *USARTx)
 Returns the most recent received data by the USART peripheral.
uint16_t USART_ReceiveData9 (USART_TypeDef *USARTx)
 Returns the most recent received data by the USART peripheral.
void USART_ReceiverWakeUpCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Determines if the USART is in mute mode or not.
void USART_SendBreak (USART_TypeDef *USARTx)
 Transmits break characters.
void USART_SendData8 (USART_TypeDef *USARTx, uint8_t Data)
 Transmits 8 bit data through the USART peripheral.
void USART_SendData9 (USART_TypeDef *USARTx, uint16_t Data)
 Transmits 9 bit data through the USART peripheral.
void USART_SetAddress (USART_TypeDef *USARTx, uint8_t USART_Address)
 Sets the address of the USART node.
void USART_SetGuardTime (USART_TypeDef *USARTx, uint8_t USART_GuardTime)
 Sets the specified USART guard time.
void USART_SetPrescaler (USART_TypeDef *USARTx, uint8_t USART_Prescaler)
 Sets the system clock prescaler.
void USART_SmartCardCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART Smart Card mode.
void USART_SmartCardNACKCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables NACK transmission.
void USART_WakeUpConfig (USART_TypeDef *USARTx, USART_WakeUp_TypeDef USART_WakeUp)
 Selects the USART WakeUp method.

Detailed Description

This file contains all the functions prototypes for the USART firmware library.

Author:
MCD Application Team
Version:
V1.5.0
Date:
13-May-2011
Attention:

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2011 STMicroelectronics

Definition in file stm8l15x_usart.h.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com