//////////////////////////////////////////////////////////////////////////// ///@copyright Copyright (c) 2018, 传控科技 All rights reserved. ///------------------------------------------------------------------------- /// @file bsp_test.c.c /// @brief bsp @ driver config ///------------------------------------------------------------------------- /// @version 1.0 /// @author CC /// @date 20180331 /// @note cc_AS_stc02 ////////////////////////////////////////////////////////////////////////////// #include "app_task_report.h" #include "../msp/uart0.h" #include "../app/app_common.h" struct _s_task_report_ s_task_report; //FF FE num0 num1 addr oper box1[3] box2[3] boardstatus[3] ir[1] crc[2] void L3_task_report_init(void) { L1_task_init(&s_task_report.task); L3_task_s_go(s_task_report,D_task_init); s_task_report.p_pkg_report = &g_pkg_report; s_task_report.pkg_data_len = 10; } #define TASK_HEARTBEAT_REPORT_01 0x1 #define TASK_HEARTBEAT_REPORT_02 0x2 #define TASK_HEARTBEAT_REPORT_03 0x3 void L3_task_report_handle(struct _s_task_report_ *s) { TTSS_Task_init() //数据长度为10(box1[3] + box2 [3] + boardstatus[3] + ir[1]) //num = addr[1] + oper[1] + data[10] + crc[2] s->p_pkg_report->filter1 = 0xFF; s->p_pkg_report->filter2 = 0xFE; s->p_pkg_report->num0 = (s->pkg_data_len + 4) >> 8 & 0xFF; s->p_pkg_report->num1 = (s->pkg_data_len + 4) >> 0 & 0xFF; s->p_pkg_report->addr = ADDR_UPPER; s->p_pkg_report->oper = OPER_REPORT; L2_task_go(TASK_HEARTBEAT_REPORT_01); TTSS_Task_step(TASK_HEARTBEAT_REPORT_01) byte_copy_uc(s->p_pkg_report->buf + 0,(U8*)&G.papers[0],3); byte_copy_uc(s->p_pkg_report->buf + 3,(U8*)&G.papers[1],3); byte_copy_uc(s->p_pkg_report->buf + 6,(U8*)&G.boardstatus,3); s->p_pkg_report->buf[9] = 0; L2_task_go(TASK_HEARTBEAT_REPORT_02); TTSS_Task_step(TASK_HEARTBEAT_REPORT_02) crc16(s->p_pkg_report->crc, &s->p_pkg_report->addr, s->pkg_data_len + 2); s->p_pkg_report->buf[10] = s->p_pkg_report->crc[1]; s->p_pkg_report->buf[11] = s->p_pkg_report->crc[0]; L2_task_go(TASK_HEARTBEAT_REPORT_03); TTSS_Task_step(TASK_HEARTBEAT_REPORT_03) if(G.runmode == MODE_RUN) { L0_uart0_sendArray((U8*)s->p_pkg_report,s->pkg_data_len + 6 + 2); } L2_task_go_Tdelay(TASK_HEARTBEAT_REPORT_01 , D_Tdelay_3s); TTSS_Task_end(); }