sop板
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.
 
 
 
 

72 lines
2.0 KiB

////////////////////////////////////////////////////////////////////////////
///@copyright Copyright (c) 2018, 传控科技 All rights reserved.
///-------------------------------------------------------------------------
/// @file bsp_drv.c
/// @brief bsp @ driver config
///-------------------------------------------------------------------------
/// @version 1.0
/// @author CC
/// @date 20180331
/// @note cc_AS_stc02
//////////////////////////////////////////////////////////////////////////////
#include "task_rs485.h"
#include "../app/app_config.h"
#include "../bsp/bsp_config.h"
#include "../msp/uart0.h"
#include "../msp/uart4.h"
S_TASK_RS485 _s_task_rs485;
TPC_RS485 tpc_rs485;
//=============================================
void L3_task_rs485_init(void)
{
L1_task_init(&_s_task_rs485.task);
L3_task_s_go(_s_task_rs485,D_task_init);
}
#define D_task_RS485_READ 0x50
#define D_task_RS485_PRINT 0x51
#define D_task_RS485_MODE 0x52
void L3_task_rs485_handler(S_TASK_RS485 *s)
{
TTSS_Task_init()
L2_task_go(D_task_RS485_READ);
TTSS_Task_step(D_task_RS485_READ)
if(ts_uart4_recv_buf.ok == 1)
{
ts_uart4_recv_buf.ok = 0;
Lc_buf_copy_uc((U8*)&tpc_rs485, ts_uart4_recv_buf.buf, ts_uart4_recv_buf.num);
tpc_rs485.ocr = tpc_rs485.buf[tpc_rs485.num[0] << 8 | tpc_rs485.num[1]];
L2_task_go_Tdelay(D_task_RS485_PRINT,0);
}
TTSS_Task_step(D_task_RS485_PRINT)
L0_uart0_sendstr("\r\n--------- Recv RS485 --------\r\n");
L0_uart0_sendstr("slaveId : ");
L0_uart0_uchex(tpc_rs485.slaveId);
L0_uart0_0d0a();
L0_uart0_sendstr("cmd: ");
L0_uart0_uchex(tpc_rs485.cmd);
L0_uart0_0d0a();
L0_uart0_sendstr("num: ");
L0_uart0_uchex(tpc_rs485.num[0]);
L0_uart0_uchex(tpc_rs485.num[1]);
L0_uart0_0d0a();
L0_uart0_sendstr("dat : ");
L0_uart0_sendArrayHex(tpc_rs485.buf, tpc_rs485.num[0] << 8 | tpc_rs485.num[1]);
L0_uart0_0d0a();
L0_uart0_sendstr("ocr: ");
L0_uart0_uchex(tpc_rs485.ocr);
L0_uart0_0d0a();
L2_task_go_Tdelay(D_task_RS485_READ,0);
TTSS_Task_end();
}