voilier-team-1/driver/uart.h

38 lines
872 B
C

#ifndef UART_H
#define UART_H
#include "stm32f10x.h"
typedef enum {
lengthBit8,
lengthBit9
} MyUART_Enum_Length;
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;
void MyUART_Init(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);
char MyUART_Read(MyUART_Struct_Typedef * UARTStructPtr);
#endif