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.
95 lines
2.2 KiB
95 lines
2.2 KiB
#include "task_pen_head.h"
|
|
#include "../msp/uart0.h"
|
|
struct _s_task_pen_head_ s_task_pen_write;
|
|
struct _s_task_pen_head_ s_task_pen_read;
|
|
|
|
|
|
|
|
void L3_task_pen_head_write_init(void)
|
|
{
|
|
L1_task_init(&s_task_pen_write.task);
|
|
L3_task_s_go(s_task_pen_write,D_task_init);
|
|
s_task_pen_write.full = 0;
|
|
}
|
|
void L3_task_pen_head_read_init(void)
|
|
{
|
|
L1_task_init(&s_task_pen_read.task);
|
|
L3_task_s_go(s_task_pen_read,D_task_init);
|
|
}
|
|
|
|
#define TTSS_TASK_HEAD_DATA_WRITE 0x01
|
|
#define TTSS_TASK_HEAD_DATA 0x02
|
|
|
|
U8 i = 0;
|
|
U8 j ;
|
|
void L3_task_pen_head_write_handle(struct _s_task_pen_head_ *s)
|
|
{
|
|
TTSS_Task_init()
|
|
L2_task_go_Tdelay(TTSS_TASK_HEAD_DATA_WRITE,0);
|
|
TTSS_Task_step(TTSS_TASK_HEAD_DATA_WRITE)
|
|
s->point.x_axis = i;
|
|
s->point.y_axis = i;
|
|
s->point.time = D_sys_now;
|
|
i++;
|
|
L0_uart2_ushex(s->point.x_axis);
|
|
if(Lc_write_cyc_buf(&s->point,&wr_buf,1) == 0)
|
|
{
|
|
s->full = 1;
|
|
}
|
|
|
|
#if 0
|
|
for(j = 0;j<POINT_LEN*2;j++)
|
|
{
|
|
L0_uart0_ushex(wr_buf.buf[j].x_axis);
|
|
L0_uart0_uc(' ');
|
|
L0_uart0_ushex(wr_buf.buf[j].y_axis);
|
|
L0_uart0_uc(' ');
|
|
L0_uart0_ulhex(wr_buf.buf[j].time);
|
|
L0_uart0_0d0a();
|
|
}
|
|
L2_task_go_Tdelay(TTSS_TASK_HEAD_DATA,D_Tdelay_100ms);
|
|
|
|
U16 k = Lc_read_cyc_buf(R.points,&wr_buf, POINT_LEN);
|
|
for(j = 0;j<k;j++)
|
|
{
|
|
L0_uart0_ushex(R.points[j].x_axis);
|
|
L0_uart0_uc(' ');
|
|
L0_uart0_ushex(R.points[j].y_axis);
|
|
L0_uart0_uc(' ');
|
|
L0_uart0_ulhex(R.points[j].time);
|
|
L0_uart0_0d0a();
|
|
}//Lc_buf_full(&wr_buf);
|
|
}
|
|
#endif
|
|
L2_task_go_Tdelay(TTSS_TASK_HEAD_DATA_WRITE,D_Tdelay_100ms);
|
|
TTSS_Task_end();
|
|
}
|
|
|
|
#define TTSS_TASK_HEAD_DATA_READ 0x21
|
|
|
|
void L3_task_pen_head_read_handle(struct _s_task_pen_head_ *s)
|
|
{
|
|
TTSS_Task_init()
|
|
L2_task_go_Tdelay(TTSS_TASK_HEAD_DATA_READ,0);
|
|
TTSS_Task_step(TTSS_TASK_HEAD_DATA_READ)
|
|
if(s_task_pen_write.full)
|
|
{
|
|
s_task_pen_write.full = 0;
|
|
Lc_read_cyc_buf(R.points,&wr_buf, 10);
|
|
//G.ccmd_slaver_info[2].extra_num = sizeof(R.points)/2;
|
|
for(j = 0;j<10;j++)
|
|
{
|
|
L0_uart0_ushex(R.points[j].x_axis);
|
|
L0_uart0_uc(' ');
|
|
L0_uart0_ushex(R.points[j].y_axis);
|
|
L0_uart0_uc(' ');
|
|
L0_uart0_ulhex(R.points[j].time);
|
|
L0_uart0_0d0a();
|
|
}
|
|
}
|
|
|
|
L2_task_go_Tdelay(TTSS_TASK_HEAD_DATA_READ,D_Tdelay_50ms);
|
|
TTSS_Task_end();
|
|
}
|
|
|
|
|
|
|