STM8L15x Standard Peripherals Drivers: stm8l15x_usart.c File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_usart.c File Reference

This file provides firmware functions to manage the following functionalities of the Universal synchronous asynchronous receiver transmitter (USART):

  • Initialization and Configuration
  • Data transfers
  • Multi-Processor Communication
  • Half-duplex mode
  • Smartcard mode
  • IrDA mode
  • DMA transfers management
  • Interrupts and flags management.
More...
#include "stm8l15x_usart.h"

Go to the source code of this file.

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 provides firmware functions to manage the following functionalities of the Universal synchronous asynchronous receiver transmitter (USART):

  • Initialization and Configuration
  • Data transfers
  • Multi-Processor Communication
  • Half-duplex mode
  • Smartcard mode
  • IrDA mode
  • DMA transfers management
  • Interrupts and flags management.
Author:
MCD Application Team
Version:
V1.5.0
Date:
13-May-2011
  *      
  *          ===================================================================
  *                                 How to use this driver
  *          ===================================================================
  *          1. Enable peripheral clock using CLK_PeripheralClockConfig(CLK_Peripheral_USARTx,
  *             ENABLE) function (Refer to the product datasheet for the available USART
  *           	peripherals)
  *
  *          2.  Enable the external Pull-up on the used USART Pins using the
  *              GPIO_ExternalPullUpConfig() function or an external pull-up equivalent resistor
	*              (RPU = 45 KOhm typical value). 
	*
  *          3. Program the Baud Rate, Word Length , Stop Bit, Parity and Mode (Receiver/Transmitter)
  *           	using the USART_Init() function.
  *
  *          4. For synchronous mode, enable the clock and program the polarity,
  *             phase and last bit using the USART_ClockInit() function.
  *
  *          5. Enable the corresponding interrupt using the function USART_ITConfig() if you need 
	*             to use interrupt mode. 
  *
  *          6. When using the DMA mode 
  *                   - Configure the DMA using DMA_Init() function
  *                   - Activate the needed channel Request using USART_DMACmd() function
  * 
  *          7. Enable the USART using the USART_Cmd() function.
  * 
  *          8. Enable the DMA using the DMA_Cmd() function, when using DMA mode. 
  *
  *          Refer to Multi-Processor, half-duplex, Smartcard, IrDA sub-sections for more details.
  *          
  *  
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.c.

STM8S Firmware Library: Overview

 

 

 

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