2024-01-24 22:08:32 +08:00
|
|
|
#ifndef __USART_H__
|
|
|
|
#define __USART_H__
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2024-01-24 22:08:32 +08:00
|
|
|
extern "C"{
|
|
|
|
#endif
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
#include "stm32f10x.h"
|
2024-01-24 22:08:32 +08:00
|
|
|
#include "stdarg.h"
|
|
|
|
#include "stdio.h"
|
2024-01-20 13:19:09 +08:00
|
|
|
|
2024-01-24 22:08:32 +08:00
|
|
|
// Initilaize the serial, First Parameter:USART1,USART2,USART3;
|
|
|
|
// 2nd Para:bits rate; 3rd: IO reuse
|
|
|
|
void USART_InitGPIO(uint8_t USART_Channel, uint32_t BaudRate, uint8_t GPIO_AF);
|
|
|
|
// USARTx to print 1 byte
|
|
|
|
void USART_PutChar(uint8_t USART_Channel, uint8_t Tx_Byte);
|
|
|
|
// format output as printf in C standard library
|
|
|
|
void USART_printf(USART_TypeDef *USARTx, uint8_t *Data, ...);
|
2024-01-20 13:19:09 +08:00
|
|
|
|
2024-01-24 22:08:32 +08:00
|
|
|
// int fputc(int ch, FILE *f);
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2024-01-24 22:08:32 +08:00
|
|
|
#endif
|
2024-01-20 13:19:09 +08:00
|
|
|
|
2024-01-24 22:08:32 +08:00
|
|
|
#endif // #ifndef __USART_H__
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
|