29 lines
949 B
C
29 lines
949 B
C
#ifndef __PT100_H__
|
|
#define __PT100_H__
|
|
#include "board.h"
|
|
#include "agile_modbus.h"
|
|
#define PT100_RS485_PORT UART_NUM_3
|
|
|
|
#define PT100_SLAVER_ADDR 1U // 从机地址
|
|
#define PT100_DATA_CHANNEL_NUM 3U // 通道数
|
|
#define PT100_MODBUS_RECV_LENGTH 30U // 接收缓冲区大小
|
|
#define PT100_MODBUS_SEND_LENGTH 30U // modbus最大数据长度
|
|
|
|
typedef struct
|
|
{
|
|
BOOL idel_flag; // 通过这个标识位来判断是否需要初始化modbus
|
|
uart_t *huart;
|
|
float32_t temperature; // 温度
|
|
|
|
agile_modbus_rtu_t ctx_rtu;
|
|
uint8_t ctx_send_buf[PT100_MODBUS_SEND_LENGTH];
|
|
uint8_t ctx_recv_buf[PT100_MODBUS_RECV_LENGTH]; // 公用一个接收缓冲区
|
|
send_data_cb_t send_data_cb; // 发送数据回调函数,外部传入
|
|
} pt100_t;
|
|
|
|
extern float32 pt100_tempture[PT100_DATA_CHANNEL_NUM];
|
|
void pt100_init(send_data_cb_t cb);
|
|
void pt100_process(void);
|
|
void pt100_data_deal(void);
|
|
#endif // __PT100_H__
|