1 Star 0 Fork 0

Fulgora/STM8S-Library

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rs485.h 2.00 KB
一键复制 编辑 原始数据 按行查看 历史
tim 提交于 2014-08-25 17:59 . Add library files
/**
******************************************************************************
* @file rs485.h
* @author Khusainov Timur
* @version 0.0.0.1
* @date 18.01.2012
* @brief
******************************************************************************
* @attention
* <h2><center>&copy; COPYRIGHT timyik@gmail.com </center></h2>
******************************************************************************
*/
#ifndef RS485_H
#define RS485_H
#ifdef __cplusplus
extern "C" {
#endif
//------------------------------------------------------------------------------
typedef enum
{
RS485_SPEED_BAUDRATE_1200 = 0,
RS485_SPEED_BAUDRATE_4800,
RS485_SPEED_BAUDRATE_9600,
RS485_SPEED_BAUDRATE_19200,
RS485_SPEED_BAUDRATE_38400,
RS485_SPEED_BAUDRATE_57600,
RS485_SPEED_BAUDRATE_115200,
RS485_SPEED_BAUDRATE_230400,
RS485_SPEED_BAUDRATE_COUNT,
} tRS485_Speed;
typedef enum
{
RS485_PARITY_NONE = 0,
RS485_PARITY_EVEN,
RS485_PARITY_ODD,
RS485_PARITY_COUNT
} tRS485_Parity;
typedef enum
{
RS485_STOPBIT_1 = 0,
RS485_STOPBIT_2,
RS485_STOPBIT_COUNT
} tRS485_Stopbit;
//------------------------------------------------------------------------------
typedef enum
{
RS485_ACTION_DATA_TX = 0,
RS485_ACTION_DATA_RX,
RS485_ACTION_ERROR_TX,
RS485_ACTION_ERROR_RX,
} tRS485_Action;
typedef void (*tRS485_OnAction)(tRS485_Action action, const uint8_t *data, size_t length);
//------------------------------------------------------------------------------
void BSP_InitRS485(tRS485_Speed speed, tRS485_Parity parity, tRS485_Stopbit stopbits, tRS485_OnAction pOnAction);
void BSP_SetPriority485(tBSP_Priority priority);
void BSP_EnableRS485();
void BSP_DisableRS485();
void RS485_TransmitData(const uint8_t * data, size_t length);
void RS485_ReceiveData(uint8_t * const data, size_t length);
void RS485_Process();
//------------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif
#endif // RS485_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Fulgora/STM8S-Library.git
git@gitee.com:Fulgora/STM8S-Library.git
Fulgora
STM8S-Library
STM8S-Library
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385