2023-03-31 09:37:30 +02:00
|
|
|
#ifndef UART_H
|
|
|
|
#define UART_H
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
|
2023-04-02 22:53:49 +02:00
|
|
|
typedef enum {
|
|
|
|
lengthBit8,
|
|
|
|
lengthBit9
|
|
|
|
} MyUART_Enum_Length;
|
2023-03-31 09:37:30 +02:00
|
|
|
|
2023-03-31 12:18:42 +02:00
|
|
|
typedef enum {
|
2023-04-02 22:53:49 +02:00
|
|
|
parityNone,
|
|
|
|
parityEven = 0b10,
|
|
|
|
parityOdd = 0b11
|
|
|
|
} MyUART_Enum_Parity;
|
2023-03-31 12:18:42 +02:00
|
|
|
|
2023-04-02 22:53:49 +02:00
|
|
|
typedef enum {
|
|
|
|
stopBit1,
|
|
|
|
stopBit0d5,
|
|
|
|
stopBit2,
|
|
|
|
stopBit1d5
|
|
|
|
} MyUART_Enum_StopBits;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
USART_TypeDef * UART;
|
|
|
|
uint32_t BaudRate;
|
|
|
|
MyUART_Enum_Length length;
|
|
|
|
MyUART_Enum_Parity parity;
|
|
|
|
MyUART_Enum_StopBits stop;
|
|
|
|
}MyUART_Struct_Typedef;
|
2023-03-31 09:37:30 +02:00
|
|
|
|
|
|
|
void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr);
|
2023-04-04 13:14:09 +02:00
|
|
|
void MyUART_InitGPIO(MyUART_Struct_Typedef * UARTStructPtr);
|
2023-04-02 22:53:49 +02:00
|
|
|
void MyUART_Send(MyUART_Struct_Typedef *UART, uint8_t data);
|
|
|
|
uint8_t MyUART_Receive(MyUART_Struct_Typedef *UART);
|
2023-04-04 14:34:09 +02:00
|
|
|
void MyUART_Init_Periph (void (* ptrFonction)(uint16_t));
|
2023-03-31 12:18:42 +02:00
|
|
|
#endif
|