Simple "hello world" style program for X-NUCLEO-IKS01A1 MEMS Inertial
Dependencies: BLE_API X_NUCLEO_IDB0XA1 X_NUCLEO_IKS01A1 mbed
Fork of HelloWorld_IKS01A1 by
stm32f4xx_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
- LIN mode
- Half-duplex mode
- Smartcard mode
- IrDA mode
- DMA transfers management
- Interrupts and flags management.
Go to the source code of this file.
Functions | |
void | USART_DeInit (USART_TypeDef *USARTx) |
Deinitializes the USARTx peripheral registers to their default reset values. | |
void | USART_Init (USART_TypeDef *USARTx, USART_InitTypeDef *USART_InitStruct) |
Initializes the USARTx peripheral according to the specified parameters in the USART_InitStruct . | |
void | USART_StructInit (USART_InitTypeDef *USART_InitStruct) |
Fills each USART_InitStruct member with its default value. | |
void | USART_ClockInit (USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct) |
Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . | |
void | USART_ClockStructInit (USART_ClockInitTypeDef *USART_ClockInitStruct) |
Fills each USART_ClockInitStruct member with its default value. | |
void | USART_Cmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the specified USART peripheral. | |
void | USART_SetPrescaler (USART_TypeDef *USARTx, uint8_t USART_Prescaler) |
Sets the system clock prescaler. | |
void | USART_OverSampling8Cmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's 8x oversampling mode. | |
void | USART_OneBitMethodCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's one bit sampling method. | |
void | USART_SendData (USART_TypeDef *USARTx, uint16_t Data) |
Transmits single data through the USARTx peripheral. | |
uint16_t | USART_ReceiveData (USART_TypeDef *USARTx) |
Returns the most recent received data by the USARTx peripheral. | |
void | USART_SetAddress (USART_TypeDef *USARTx, uint8_t USART_Address) |
Sets the address of the USART node. | |
void | USART_ReceiverWakeUpCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Determines if the USART is in mute mode or not. | |
void | USART_WakeUpConfig (USART_TypeDef *USARTx, uint16_t USART_WakeUp) |
Selects the USART WakeUp method. | |
void | USART_LINBreakDetectLengthConfig (USART_TypeDef *USARTx, uint16_t USART_LINBreakDetectLength) |
Sets the USART LIN Break detection length. | |
void | USART_LINCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's LIN mode. | |
void | USART_SendBreak (USART_TypeDef *USARTx) |
Transmits break characters. | |
void | USART_HalfDuplexCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's Half Duplex communication. | |
void | USART_SetGuardTime (USART_TypeDef *USARTx, uint8_t USART_GuardTime) |
Sets the specified USART guard time. | |
void | USART_SmartCardCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's Smart Card mode. | |
void | USART_SmartCardNACKCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables NACK transmission. | |
void | USART_IrDAConfig (USART_TypeDef *USARTx, uint16_t USART_IrDAMode) |
Configures the USART's IrDA interface. | |
void | USART_IrDACmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's IrDA interface. | |
void | USART_DMACmd (USART_TypeDef *USARTx, uint16_t USART_DMAReq, FunctionalState NewState) |
Enables or disables the USART's DMA interface. | |
void | USART_ITConfig (USART_TypeDef *USARTx, uint16_t USART_IT, FunctionalState NewState) |
Enables or disables the specified USART interrupts. | |
FlagStatus | USART_GetFlagStatus (USART_TypeDef *USARTx, uint16_t USART_FLAG) |
Checks whether the specified USART flag is set or not. | |
void | USART_ClearFlag (USART_TypeDef *USARTx, uint16_t USART_FLAG) |
Clears the USARTx's pending flags. | |
ITStatus | USART_GetITStatus (USART_TypeDef *USARTx, uint16_t USART_IT) |
Checks whether the specified USART interrupt has occurred or not. | |
void | USART_ClearITPendingBit (USART_TypeDef *USARTx, uint16_t USART_IT) |
Clears the USARTx's interrupt pending bits. |
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
- LIN mode
- Half-duplex mode
- Smartcard mode
- IrDA mode
- DMA transfers management
- Interrupts and flags management.
- Version:
- V1.0.0
- Date:
- 30-September-2011
* * =================================================================== * How to use this driver * =================================================================== * 1. Enable peripheral clock using the follwoing functions * RCC_APB2PeriphClockCmd(RCC_APB2Periph_USARTx, ENABLE) for USART1 and USART6 * RCC_APB1PeriphClockCmd(RCC_APB1Periph_USARTx, ENABLE) for USART2, USART3, UART4 or UART5. * * 2. According to the USART mode, enable the GPIO clocks using * RCC_AHB1PeriphClockCmd() function. (The I/O can be TX, RX, CTS, * or/and SCLK). * * 3. Peripheral's alternate function: * - Connect the pin to the desired peripherals' Alternate * Function (AF) using GPIO_PinAFConfig() function * - Configure the desired pin in alternate function by: * GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF * - Select the type, pull-up/pull-down and output speed via * GPIO_PuPd, GPIO_OType and GPIO_Speed members * - Call GPIO_Init() function * * 4. Program the Baud Rate, Word Length , Stop Bit, Parity, Hardware * flow control and Mode(Receiver/Transmitter) using the USART_Init() * function. * * 5. For synchronous mode, enable the clock and program the polarity, * phase and last bit using the USART_ClockInit() function. * * 5. Enable the NVIC and 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 * - Active 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, LIN, half-duplex, Smartcard, IrDA sub-sections * for more details * * In order to reach higher communication baudrates, it is possible to * enable the oversampling by 8 mode using the function USART_OverSampling8Cmd(). * This function should be called after enabling the USART clock (RCC_APBxPeriphClockCmd()) * and before calling the function USART_Init(). * *
- 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 stm32f4xx_usart.c.
Generated on Tue Jul 12 2022 19:53:13 by 1.7.2