#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);
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);
void MyUART_Init_Periph (void (* ptrFonction)(uint8_t));
#endif
