voilier-team-1/driver/uart.h

38 lines
841 B
C
Raw Normal View History

2023-03-31 09:37:30 +02:00
#ifndef UART_H
#define UART_H
#include "stm32f10x.h"
typedef enum {
lengthBit8,
lengthBit9
} MyUART_Enum_Length;
2023-03-31 09:37:30 +02:00
typedef enum {
parityNone,
parityEven = 0b10,
parityOdd = 0b11
} MyUART_Enum_Parity;
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);
void MyUART_InitGPIO(MyUART_Struct_Typedef * UARTStructPtr);
int MyUART_SendArray(MyUART_Struct_Typedef *UART, uint8_t * data, int dataLength);
void MyUART_Send(MyUART_Struct_Typedef *UART, uint8_t data);
uint8_t MyUART_Receive(MyUART_Struct_Typedef *UART);
2023-04-07 13:21:27 +02:00
void MyUART_Init_Periph (void (* ptrFonction)(uint8_t));
#endif