You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
3.4 KiB

#ifndef __asp_oid_H__
#define __asp_oid_H__
/**************************************************************************************
asp_oid.c
****************************************************************************************/
#include "../bsp/bsp_oid.h"
#include "msp_uart0.h"
#include "../ctask/task.h"
#include "../app/app_config.h"
/**********
``````` `\___________________/` ` ` ` ` ` ` `````````\___________________/````````
222222 2 21000000000000000000032 2 2 2 2 2 2 222222221000000000000000000032222222
package no 0 1 2 3 0 1 2 3
package no 0 1 2 3 4 5 6 7
packageNo 00000111112222233333xxxxx xxxxxxxxxxx00000111112222233333xxxxx
111111111 12222222
123456789012345678 901234567890
gcode收到固定码
,
,
: ,
:,,()
************/
/*******************.
write to uart -->send
Layer3: app tcp
s->ts_frame.cd->R.point
-----------------------------
Layer2: asp asp_oid
ts.oid ->s->ts_frame.cd
-------------------------
L1_Oid_readoid
Layer1: bsp: bsp_oid
*******************/
#define POINT_LEN 20///cc fixme
typedef struct
{///6Byte
U16 x100;
U16 y100;
}TS_xy100;
typedef union{
TS_xy100 xy100;
U32 gcode;
}TU_code;
#define D_PEN_normal 0
#define D_PEN_down 1
#define D_PEN_none 2
#define D_PEN_up 3
#define D_PEN_gcode 4
typedef struct
{
U16 angle:9;///360
U16 packageNo:4; ///0-2^5
U16 sta:3; /// =0 nomal =1 按下 =3 抬起 =2 没有按下 =4 gcode
}Oid_flag;
////一帧数据,也是一个点
typedef struct
{
Oid_flag flag;
TU_code cd;
TtimeStamp time; ///最好一个包一个时间戳 一个点(一帧)一个时间戳有点浪费
/// 前提1 是采样的点是固定间隔而且连续
////时间戳甚至是相对的 甚至误差相对于采样而言也比较大
}Ts_OID_frame_xy_;///8Bytes
typedef struct _s_task_oid_
{
TS_task task;
vU8 can_send;///
U16 p_ok;///
U16 send_t;
TtimeStamp tts;
U16 point;
U16 extra;
U16 send_p;
Ts_OID_frame_xy_ ts_frame;
/// Ts_OID_out_ out;
}TS_task_oid_;
extern TS_task_oid_ ts_task_oid;
extern void L3_task_oid_handle(TS_task_oid_ *s);
extern Ts_OID_frame_xy_ oid_buf[POINT_LEN+10];
extern Ts_OID_frame_xy_ points[POINT_LEN+10];
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>for debug
typedef struct _ts_debug_oid_cmd_
{///6bytes 去掉了filter和命令字
U8 cmd;
/// U8 rw; /// 写还是读: =1 读,=0写
U8 dat; ///数据
U16 reg; ///
U16 end; ///
}TS_oid_cmd;
#define UDCMD_wakeup 0x11 ///
#define UDCMD_cmdsend 0x22 ///
#define UDCMD_readreg 0x23 ///
#define UDCMD_log 0x33 ///
#define UDCMD_get 0x44 ///
#define UDCMD_CheckVersion 0x45 ///
#define UDCMD_testtime_us 0x55 ///
#define UDCMD_testtime_ms 0x66 ///
///<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<for debug
extern void L1_oid_init(void);
extern void L1_oid_main(void);
extern void L1_oid_debug(u8 *para);
#endif