82 #include <stm32f4xx.h>
87 #define RCC_APB2Periph_CARME_UART0 RCC_APB2Periph_USART1
88 #define RCC_APB1Periph_CARME_UART1 RCC_APB1Periph_USART3
173 GPIO_InitStruct.
GPIO_PuPd = GPIO_PuPd_UP;
233 *pc = (uint8_t) (i & 0xFF);
259 for (i = 0; i < count; i++) {
262 if ((*pc ==
'\r') || (*pc ==
'\n')
uint8_t ERROR_CODES
Error variable.
void USART_Init(USART_TypeDef *USARTx, USART_InitTypeDef *USART_InitStruct)
Initializes the USARTx peripheral according to the specified parameters in the USART_InitStruct ...
The CARME UART Module provides a function to initialize the GPIOs for the CARME UART ports...
USART Clock Init Structure definition.
void CARME_UART_Init(USART_TypeDef *UARTx, USART_InitTypeDef *pUSART_InitStruct)
UART initialization.
void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
Enables or disables the High Speed APB (APB2) peripheral clock.
#define RCC_APB2Periph_CARME_UART0
#define CARME_ERROR_UART_NO_DATA
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...
void CARME_UART_SendChar(USART_TypeDef *UARTx, char c)
Send a char over the UART port.
GPIOSpeed_TypeDef GPIO_Speed
FlagStatus USART_GetFlagStatus(USART_TypeDef *USARTx, uint16_t USART_FLAG)
Checks whether the specified USART flag is set or not.
#define RCC_APB1Periph_CARME_UART1
GPIOPuPd_TypeDef GPIO_PuPd
void CARME_GPIO_Init(CARME_Port_Pin_t *pPortPinAssociation, GPIO_InitTypeDef *pGPIO_InitStruct, uint8_t size)
Initialize GPIO ports with a CARME_Port_Pin_t table.
void CARME_UART_GPIO_Init(void)
CARME UART port GPIO initialization.
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct)
Fills each GPIO_InitStruct member with its default value.
CARME port and pin association structure.
static CARME_Port_Pin_t CARME_UART_Port_Pin[]
UART Port and Pin association.
GPIO Init structure definition.
void USART_Cmd(USART_TypeDef *USARTx, FunctionalState NewState)
Enables or disables the specified USART peripheral.
void USART_ClockStructInit(USART_ClockInitTypeDef *USART_ClockInitStruct)
Fills each USART_ClockInitStruct member with its default value.
USART Init Structure definition.
void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
Enables or disables the Low Speed APB (APB1) peripheral clock.
#define GPIO_AF_USART1
AF 7 selection.
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitS...
void USART_DeInit(USART_TypeDef *USARTx)
Deinitializes the USARTx peripheral registers to their default reset values.
uint16_t USART_ReceiveData(USART_TypeDef *USARTx)
Returns the most recent received data by the USARTx peripheral.
void USART_SendData(USART_TypeDef *USARTx, uint16_t Data)
Transmits single data through the USARTx peripheral.
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 dat...
ERROR_CODES CARME_UART_ReceiveChar(USART_TypeDef *UARTx, char *pc)
Receive a char from the UART input buffer.