2023-03-31 09:37:30 +02:00
|
|
|
#ifndef UART_H
|
|
|
|
#define UART_H
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
USART_TypeDef * UART;
|
|
|
|
unsigned int BaudRate;
|
|
|
|
unsigned char Wlengh;
|
|
|
|
unsigned char Wparity;
|
|
|
|
unsigned char Wstop;
|
|
|
|
}MyUART_Struct_Typedef;
|
|
|
|
|
2023-03-31 12:18:42 +02:00
|
|
|
typedef enum {
|
|
|
|
//DIV_Fraction ->
|
|
|
|
//1D4C
|
|
|
|
}MyUART_BRR
|
|
|
|
|
2023-03-31 09:37:30 +02:00
|
|
|
#define parity_none 0x0
|
|
|
|
#define parity_even 0x1
|
|
|
|
#define parity_odd 0x2
|
|
|
|
#define Wlengh8 0x0
|
|
|
|
#define Wlengh9 0X1
|
|
|
|
#define stop1b 0x0
|
|
|
|
#define stop2b 0x2
|
|
|
|
|
|
|
|
void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr);
|
2023-03-31 12:18:42 +02:00
|
|
|
int MyUART_setClockBit(USART_TypeDef * UART);
|
2023-03-31 09:37:30 +02:00
|
|
|
char MyUART_Read(MyUART_Struct_Typedef * UARTStructPtr);
|
2023-03-31 12:18:42 +02:00
|
|
|
#endif
|