|
CARME-M4 BSP
V1.5
|
USART driver modules. More...
Collaboration diagram for USART:Modules | |
| USART_Exported_Constants | |
| USART_Private_Functions | |
Files | |
| file | uart.h |
| The CARME UART Module provides a function to initialize the GPIOs for the CARME UART ports. | |
| file | uart.c |
| The CARME UART Module provides a function to initialize the GPIOs for the CARME UART ports. | |
Data Structures | |
| struct | USART_InitTypeDef |
| USART Init Structure definition. More... | |
| struct | USART_ClockInitTypeDef |
| USART Clock Init Structure definition. More... | |
Macros | |
| #define | CR1_CLEAR_MASK |
| #define | CR2_CLOCK_CLEAR_MASK |
| #define | CR3_CLEAR_MASK ((uint16_t)(USART_CR3_RTSE | USART_CR3_CTSE)) |
| #define | IT_MASK ((uint16_t)0x001F) |
| #define | CARME_UART0 USART1 |
| #define | CARME_UART1 USART3 |
| #define | CARME_ERROR_UART_NO_DATA (CARME_ERROR_UART_BASE+0) |
| #define | RCC_APB2Periph_CARME_UART0 RCC_APB2Periph_USART1 |
| #define | RCC_APB1Periph_CARME_UART1 RCC_APB1Periph_USART3 |
Functions | |
| void | USART_DeInit (USART_TypeDef *USARTx) |
| Deinitializes the USARTx peripheral registers to their default reset values. More... | |
| void | USART_Init (USART_TypeDef *USARTx, USART_InitTypeDef *USART_InitStruct) |
| Initializes the USARTx peripheral according to the specified parameters in the USART_InitStruct . More... | |
| void | USART_StructInit (USART_InitTypeDef *USART_InitStruct) |
| Fills each USART_InitStruct member with its default value. More... | |
| void | USART_ClockInit (USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct) |
| Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . More... | |
| void | USART_ClockStructInit (USART_ClockInitTypeDef *USART_ClockInitStruct) |
| Fills each USART_ClockInitStruct member with its default value. More... | |
| void | USART_Cmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables the specified USART peripheral. More... | |
| void | USART_SetPrescaler (USART_TypeDef *USARTx, uint8_t USART_Prescaler) |
| Sets the system clock prescaler. More... | |
| void | USART_OverSampling8Cmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables the USART's 8x oversampling mode. More... | |
| void | USART_OneBitMethodCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables the USART's one bit sampling method. More... | |
| void | USART_SendData (USART_TypeDef *USARTx, uint16_t Data) |
| Transmits single data through the USARTx peripheral. More... | |
| uint16_t | USART_ReceiveData (USART_TypeDef *USARTx) |
| Returns the most recent received data by the USARTx peripheral. More... | |
| void | USART_SetAddress (USART_TypeDef *USARTx, uint8_t USART_Address) |
| Sets the address of the USART node. More... | |
| void | USART_WakeUpConfig (USART_TypeDef *USARTx, uint16_t USART_WakeUp) |
| Selects the USART WakeUp method. More... | |
| void | USART_ReceiverWakeUpCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Determines if the USART is in mute mode or not. More... | |
| void | USART_LINBreakDetectLengthConfig (USART_TypeDef *USARTx, uint16_t USART_LINBreakDetectLength) |
| Sets the USART LIN Break detection length. More... | |
| void | USART_LINCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables the USART's LIN mode. More... | |
| void | USART_SendBreak (USART_TypeDef *USARTx) |
| Transmits break characters. More... | |
| void | USART_HalfDuplexCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables the USART's Half Duplex communication. More... | |
| void | USART_SmartCardCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables the USART's Smart Card mode. More... | |
| void | USART_SmartCardNACKCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables NACK transmission. More... | |
| void | USART_SetGuardTime (USART_TypeDef *USARTx, uint8_t USART_GuardTime) |
| Sets the specified USART guard time. More... | |
| void | USART_IrDAConfig (USART_TypeDef *USARTx, uint16_t USART_IrDAMode) |
| Configures the USART's IrDA interface. More... | |
| void | USART_IrDACmd (USART_TypeDef *USARTx, FunctionalState NewState) |
| Enables or disables the USART's IrDA interface. More... | |
| void | USART_DMACmd (USART_TypeDef *USARTx, uint16_t USART_DMAReq, FunctionalState NewState) |
| Enables or disables the USART's DMA interface. More... | |
| void | USART_ITConfig (USART_TypeDef *USARTx, uint16_t USART_IT, FunctionalState NewState) |
| Enables or disables the specified USART interrupts. More... | |
| FlagStatus | USART_GetFlagStatus (USART_TypeDef *USARTx, uint16_t USART_FLAG) |
| Checks whether the specified USART flag is set or not. More... | |
| void | USART_ClearFlag (USART_TypeDef *USARTx, uint16_t USART_FLAG) |
| Clears the USARTx's pending flags. More... | |
| ITStatus | USART_GetITStatus (USART_TypeDef *USARTx, uint16_t USART_IT) |
| Checks whether the specified USART interrupt has occurred or not. More... | |
| void | USART_ClearITPendingBit (USART_TypeDef *USARTx, uint16_t USART_IT) |
| Clears the USARTx's interrupt pending bits. More... | |
| void | CARME_UART_Init (USART_TypeDef *UARTx, USART_InitTypeDef *pUSART_InitStruct) |
| UART initialization. More... | |
| void | CARME_UART_GPIO_Init (void) |
| CARME UART port GPIO initialization. More... | |
| void | CARME_UART_SendChar (USART_TypeDef *UARTx, char c) |
| Send a char over the UART port. More... | |
| void | CARME_UART_SendString (USART_TypeDef *UARTx, char *pStr) |
| Send a string over the UART port. You can use printf() to send a formated String over the CARME_UART0. More... | |
| ERROR_CODES | CARME_UART_ReceiveChar (USART_TypeDef *UARTx, char *pc) |
| Receive a char from the UART input buffer. More... | |
| ERROR_CODES | CARME_UART_ReceiveString (USART_TypeDef *UARTx, char *pc, uint8_t count) |
| Receive a string from the UART input buffer until new line or carriage return or there is no more data. More... | |
Variables | |
| static CARME_Port_Pin_t | CARME_UART_Port_Pin [] |
| UART Port and Pin association. More... | |
USART driver modules.
| #define CARME_ERROR_UART_NO_DATA (CARME_ERROR_UART_BASE+0) |
| #define CARME_UART0 USART1 |
| #define CR1_CLEAR_MASK |
< USART CR1 register clear Mask ((~(uint16_t)0xE9F3)) USART CR2 register clock bits clear Mask ((~(uint16_t)0xF0FF))
Definition at line 108 of file stm32f4xx_usart.c.
| #define CR2_CLOCK_CLEAR_MASK |
USART CR3 register clear Mask ((~(uint16_t)0xFCFF))
Definition at line 113 of file stm32f4xx_usart.c.
| #define CR3_CLEAR_MASK ((uint16_t)(USART_CR3_RTSE | USART_CR3_CTSE)) |
USART Interrupts mask
Definition at line 117 of file stm32f4xx_usart.c.
| #define RCC_APB1Periph_CARME_UART1 RCC_APB1Periph_USART3 |
| #define RCC_APB2Periph_CARME_UART0 RCC_APB2Periph_USART1 |
| void CARME_UART_GPIO_Init | ( | void | ) |
| void CARME_UART_Init | ( | USART_TypeDef * | UARTx, |
| USART_InitTypeDef * | pUSART_InitStruct | ||
| ) |
UART initialization.
| [in] | UARTx | The UART port which will be used. Possible values are CARME_UART0 and CARME_UART1. |
| [in] | pUSART_InitStruct | Pointer to the USART init structure. |
Definition at line 125 of file uart.c.
Here is the call graph for this function:| ERROR_CODES CARME_UART_ReceiveChar | ( | USART_TypeDef * | UARTx, |
| char * | pc | ||
| ) |
Receive a char from the UART input buffer.
| [in] | UARTx | The UART port you want to use. Possible values are CARME_UART0 and CARME_UART1. |
| [out] | pc | Pointer to unsigned char to write data. |
Definition at line 225 of file uart.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ERROR_CODES CARME_UART_ReceiveString | ( | USART_TypeDef * | UARTx, |
| char * | pc, | ||
| uint8_t | count | ||
| ) |
Receive a string from the UART input buffer until new line or carriage return or there is no more data.
| [in] | UARTx | The UART port you want to use. Possible values are CARME_UART0 and CARME_UART1. |
| [out] | pc | Pointer to the start of the string |
| [in] | count | Maximal length of the string |
Definition at line 253 of file uart.c.
Here is the call graph for this function:| void CARME_UART_SendChar | ( | USART_TypeDef * | UARTx, |
| char | c | ||
| ) |
Send a char over the UART port.
| [in] | UARTx | The UART port you want to use. Possible values are CARME_UART0 and CARME_UART1. |
| [in] | c | Character you want to send. |
Definition at line 188 of file uart.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void CARME_UART_SendString | ( | USART_TypeDef * | UARTx, |
| char * | pStr | ||
| ) |
Send a string over the UART port. You can use printf() to send a formated String over the CARME_UART0.
| [in] | UARTx | The UART port you want to use. Possible values are CARME_UART0 and CARME_UART1. |
| [in] | pStr | Pointer to the string you want to send. |
Definition at line 206 of file uart.c.
Here is the call graph for this function:| void USART_ClearFlag | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_FLAG | ||
| ) |
Clears the USARTx's pending flags.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_FLAG | specifies the flag to clear. This parameter can be any combination of the following values:
|
| None |
Definition at line 1344 of file stm32f4xx_usart.c.
| void USART_ClearITPendingBit | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_IT | ||
| ) |
Clears the USARTx's interrupt pending bits.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_IT | specifies the interrupt pending bit to clear. This parameter can be one of the following values:
|
| None |
Definition at line 1452 of file stm32f4xx_usart.c.
| void USART_ClockInit | ( | USART_TypeDef * | USARTx, |
| USART_ClockInitTypeDef * | USART_ClockInitStruct | ||
| ) |
Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct .
| USARTx | where x can be 1, 2, 3 or 6 to select the USART peripheral. |
| USART_ClockInitStruct | pointer to a USART_ClockInitTypeDef structure that contains the configuration information for the specified USART peripheral. |
| None |
Definition at line 379 of file stm32f4xx_usart.c.
Here is the caller graph for this function:| void USART_ClockStructInit | ( | USART_ClockInitTypeDef * | USART_ClockInitStruct | ) |
Fills each USART_ClockInitStruct member with its default value.
| USART_ClockInitStruct | pointer to a USART_ClockInitTypeDef structure which will be initialized. |
| None |
Definition at line 410 of file stm32f4xx_usart.c.
Here is the caller graph for this function:| void USART_Cmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables the specified USART peripheral.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| NewState | new state of the USARTx peripheral. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 427 of file stm32f4xx_usart.c.
Here is the caller graph for this function:| void USART_DeInit | ( | USART_TypeDef * | USARTx | ) |
Deinitializes the USARTx peripheral registers to their default reset values.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| None |
Definition at line 187 of file stm32f4xx_usart.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void USART_DMACmd | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_DMAReq, | ||
| FunctionalState | NewState | ||
| ) |
Enables or disables the USART's DMA interface.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_DMAReq | specifies the DMA request. This parameter can be any combination of the following values:
|
| NewState | new state of the DMA Request sources. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 1099 of file stm32f4xx_usart.c.
| FlagStatus USART_GetFlagStatus | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_FLAG | ||
| ) |
Checks whether the specified USART flag is set or not.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_FLAG | specifies the flag to check. This parameter can be one of the following values:
|
| The | new state of USART_FLAG (SET or RESET). |
Definition at line 1295 of file stm32f4xx_usart.c.
Here is the caller graph for this function:| ITStatus USART_GetITStatus | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_IT | ||
| ) |
Checks whether the specified USART interrupt has occurred or not.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_IT | specifies the USART interrupt source to check. This parameter can be one of the following values:
|
| The | new state of USART_IT (SET or RESET). |
Definition at line 1378 of file stm32f4xx_usart.c.
| void USART_HalfDuplexCmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables the USART's Half Duplex communication.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| NewState | new state of the USART Communication. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 836 of file stm32f4xx_usart.c.
| void USART_Init | ( | USART_TypeDef * | USARTx, |
| USART_InitTypeDef * | USART_InitStruct | ||
| ) |
Initializes the USARTx peripheral according to the specified parameters in the USART_InitStruct .
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_InitStruct | pointer to a USART_InitTypeDef structure that contains the configuration information for the specified USART peripheral. |
| None |
Definition at line 246 of file stm32f4xx_usart.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void USART_IrDACmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables the USART's IrDA interface.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| NewState | new state of the IrDA mode. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 1053 of file stm32f4xx_usart.c.
| void USART_IrDAConfig | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_IrDAMode | ||
| ) |
Configures the USART's IrDA interface.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_IrDAMode | specifies the IrDA mode. This parameter can be one of the following values:
|
| None |
Definition at line 1035 of file stm32f4xx_usart.c.
| void USART_ITConfig | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_IT, | ||
| FunctionalState | NewState | ||
| ) |
Enables or disables the specified USART interrupts.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_IT | specifies the USART interrupt sources to be enabled or disabled. This parameter can be one of the following values:
|
| NewState | new state of the specified USARTx interrupts. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 1231 of file stm32f4xx_usart.c.
| void USART_LINBreakDetectLengthConfig | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_LINBreakDetectLength | ||
| ) |
Sets the USART LIN Break detection length.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_LINBreakDetectLength | specifies the LIN break detection length. This parameter can be one of the following values:
|
| None |
Definition at line 741 of file stm32f4xx_usart.c.
| void USART_LINCmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables the USART's LIN mode.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| NewState | new state of the USART LIN mode. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 759 of file stm32f4xx_usart.c.
| void USART_OneBitMethodCmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables the USART's one bit sampling method.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| NewState | new state of the USART one bit sampling method. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 500 of file stm32f4xx_usart.c.
| void USART_OverSampling8Cmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables the USART's 8x oversampling mode.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| NewState | new state of the USART 8x oversampling mode. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 474 of file stm32f4xx_usart.c.
| uint16_t USART_ReceiveData | ( | USART_TypeDef * | USARTx | ) |
Returns the most recent received data by the USARTx peripheral.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| The | received data. |
Definition at line 573 of file stm32f4xx_usart.c.
Here is the caller graph for this function:| void USART_ReceiverWakeUpCmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Determines if the USART is in mute mode or not.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| NewState | new state of the USART mute mode. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 645 of file stm32f4xx_usart.c.
| void USART_SendBreak | ( | USART_TypeDef * | USARTx | ) |
Transmits break characters.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| None |
Definition at line 783 of file stm32f4xx_usart.c.
| void USART_SendData | ( | USART_TypeDef * | USARTx, |
| uint16_t | Data | ||
| ) |
Transmits single data through the USARTx peripheral.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| Data | the data to transmit. |
| None |
Definition at line 557 of file stm32f4xx_usart.c.
Here is the caller graph for this function:| void USART_SetAddress | ( | USART_TypeDef * | USARTx, |
| uint8_t | USART_Address | ||
| ) |
Sets the address of the USART node.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_Address | Indicates the address of the USART node. |
| None |
Definition at line 625 of file stm32f4xx_usart.c.
| void USART_SetGuardTime | ( | USART_TypeDef * | USARTx, |
| uint8_t | USART_GuardTime | ||
| ) |
Sets the specified USART guard time.
| USARTx | where x can be 1, 2, 3 or 6 to select the USART or UART peripheral. |
| USART_GuardTime | specifies the guard time. |
| None |
Definition at line 920 of file stm32f4xx_usart.c.
| void USART_SetPrescaler | ( | USART_TypeDef * | USARTx, |
| uint8_t | USART_Prescaler | ||
| ) |
Sets the system clock prescaler.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_Prescaler | specifies the prescaler clock. |
| None |
Definition at line 453 of file stm32f4xx_usart.c.
| void USART_SmartCardCmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables the USART's Smart Card mode.
| USARTx | where x can be 1, 2, 3 or 6 to select the USART or UART peripheral. |
| NewState | new state of the Smart Card mode. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 939 of file stm32f4xx_usart.c.
| void USART_SmartCardNACKCmd | ( | USART_TypeDef * | USARTx, |
| FunctionalState | NewState | ||
| ) |
Enables or disables NACK transmission.
| USARTx | where x can be 1, 2, 3 or 6 to select the USART or UART peripheral. |
| NewState | new state of the NACK transmission. This parameter can be: ENABLE or DISABLE. |
| None |
Definition at line 964 of file stm32f4xx_usart.c.
| void USART_StructInit | ( | USART_InitTypeDef * | USART_InitStruct | ) |
Fills each USART_InitStruct member with its default value.
| USART_InitStruct | pointer to a USART_InitTypeDef structure which will be initialized. |
| None |
Definition at line 359 of file stm32f4xx_usart.c.
| void USART_WakeUpConfig | ( | USART_TypeDef * | USARTx, |
| uint16_t | USART_WakeUp | ||
| ) |
Selects the USART WakeUp method.
| USARTx | where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral. |
| USART_WakeUp | specifies the USART wakeup method. This parameter can be one of the following values:
|
| None |
Definition at line 672 of file stm32f4xx_usart.c.
|
static |
UART Port and Pin association.