Initial import of STM32 IoT sensor node
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#ifndef __USART1_H
|
||||
#define __USART1_H
|
||||
|
||||
/*
|
||||
* IO 管脚
|
||||
* 接受管脚 PA10 USART1_RX
|
||||
* 发送管脚 PA9 USART1_TX
|
||||
* 另外一个线 VSS(共地)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "stm32f10x_conf.h"
|
||||
#include "systick.h"
|
||||
#include "queue.h"
|
||||
|
||||
// 初始化 usart1, baud 为波特率
|
||||
void usart1_init(uint32_t baud);
|
||||
|
||||
// 用于串口发送一个字节的数据
|
||||
void usart1_put_char(uint8_t ch);
|
||||
|
||||
// 用于串口发送一段数据,遇到 '\0' 结束
|
||||
void usart1_output(const char *buf);
|
||||
|
||||
// 用于串口发送一段数据,遇到 '\0' 结束,末尾添加 '\r\n' 换行符结束
|
||||
void usart1_output_aline(const char *buf);
|
||||
|
||||
// 从串口读取一行数据放入 buf, buf 的最大长度为 buf_len
|
||||
int usart1_input(char *buf, int buf_len);
|
||||
|
||||
// 从串口读取一行数据放入 buf, 当遇到 '\r\n' 时结束读取,并添加尾零 '\0'
|
||||
int usart1_input_aline(char *buf, int buf_len);
|
||||
|
||||
// 清空串口的接收队列
|
||||
void usart1_clear_rx_queue(void);
|
||||
|
||||
#endif // __USART1_H
|
||||
Reference in New Issue
Block a user