stm32_ota/HARDWARE/RS485/rs485.h

31 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef __RS485x_H
#define __RS485x_H
#include "stm32f10x.h"
#include "syslib.h"
/*****************************************
*驱动可供外部使用的常变量
****************************************/
#define RS485_RT_PORT PD //RS485收发切换IO引脚端口
#define RS485_RT_PIN PIN0 //RS485收发切换IO引脚引脚
#define RS485_TX PDout(0) = 1 //RS485切换到发送模式
#define RS485_RX PDout(0) = 0 //RS485切换到接收模式
#define RS485_COM COM4 //RS485映射的串口
extern FrameQueue_s sRS485Queue ; //RS485 接收数据帧数据环形缓冲区上层只需要在初始化RS485后处理该缓冲区数据即可
/*****************************************
*内部函数声明
****************************************/
void Rs485RecFrameCallback(char *recvBuf, uint16_t recvLen) ; //RS485接收帧数据回调函数
/*****************************************
*对外接口函数声明
****************************************/
extern void RS485Init(uint32_t baudrate) ; //RS485串口初始化
extern void RS485SendData(char* sendData, uint16_t dataLen) ; //通过RS485_COM端口输出dataLen长度的数据 sendData
#endif