pile_com_stm32/main_old/communication_pad/inc/communication_pad.h

63 lines
1.4 KiB
C
Raw Normal View History

2024-03-27 16:13:03 +08:00
#ifndef __COMMUNICATION_PAD_H
#define __COMMUNICATION_PAD_H
#include <stdint.h>
#define MAX_NOTIFY_DATA 20
#define NOTIFY_TAG 0xF2
struct measureData // 测量数据
{
int16_t speed;
uint16_t time;
int16_t depth;
uint16_t pile_id;
int16_t flow1;
uint16_t flow_10cm1;
int32_t flow_total1;
int16_t flow2;
uint16_t flow_10cm2;
int32_t flow_total2;
uint16_t current[3];
};
typedef struct gps_message
{
uint8_t gps_status; // GPS定位状态
uint8_t gps_view; // GPS可视状态
uint8_t gps_use; // GPS使用状态
uint8_t reg[1]; // 保留
uint32_t utc; // utc时间
double x; // 大地平面坐标
double y;
double dir; // 方向
double pitch; // 俯仰角
} gps_message_t;
typedef void (*padUpdataFun)(void);
typedef struct padDataStruct
{
uint8_t tag;
int len;
uint8_t *data;
padUpdataFun updata_fun;
} padData_t;
typedef struct padDataCtrlStruct
{
int cnt;
padData_t datas[MAX_NOTIFY_DATA]; // 输出数据,即上报数据
} padDataCtrl_t;
void pad_communication_init(void);
int register_pad_data(padDataCtrl_t *data_ctrl, uint8_t tag, uint8_t *data, int len, padUpdataFun updata_fun);
void pad_deal_recived_data(uint8_t *data, int len, int *enable_notify, uint8_t **retbuf, int *ret_len);
#endif