voilier-team-1/driver/uart.h

40 lines
933 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_setClockBit(MyUART_Struct_Typedef * UARTStructPtr);
void MyUART_Send(MyUART_Struct_Typedef *UART, uint8_t data);
uint8_t MyUART_Receive(MyUART_Struct_Typedef *UART);
void MyUART_ActiveIT(USART_TypeDef * UART, uint8_t Prio);
uint8_t MyUART_GetInterruptNum(USART_TypeDef * UART);
2023-03-31 09:37:30 +02:00
char MyUART_Read(MyUART_Struct_Typedef * UARTStructPtr);
#endif