平车主控板(运维板)
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.
 
 
 
 
 

128 lines
3.3 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 "app_drv.h"
#include "../clib/clib.h"
#include "../app/app_common.h"
#include "../app/app_task_485.h"
#include "../app/app_task_gm35.h"
#include "../msp/uart3.h"
/// reg.H,reg.L data0 data1 data2;
/// (reg.HL)=data0 (reg.HL+1)=data1 (reg.HL+2)=data2 (reg.HL+3)=data3
/// 0x0f 0----14 15
#if 0
TS_drv_ ts_drv[TS_DRV_MAX]=
{
0x0e,NULL, /// FE 01 02 03 04
0x12,NULL, //uart0 reply
0x0d,NULL, //433 camera //fd 01 02 03 06
0x99,NULL, //a9 gprs
0x00,NULL,
};
#endif
#if 0
void L3_UARTcom4_exp_protocol(TS_Handle_0d0a *p)
{
if (1 == p->ok )
{
U8 array[D_s_SSTR_0D0A_len+1];
U8 num = p->buf[0];
byte_copy_uc(array,p->buf+1,num);
p->ok = 0;
array[num] = 0;
L3_protocol_handler_uart4_fun(array,0);
}
}
void L3_task_a9_rcv_handle(TS_Handle_PH3 *p)
{
if (1 == p->ok)
{
TS_PH3_ccmodbus ccmodbus;
byte_copy_uc((U8*)&ccmodbus,(U8*)&p->ts_ccmodbus,p->ts_ccmodbus.num + 3);
p->ok = 0;
g_at_send_status.tcp_last_recv_stmp = s_nos_tick.t_1s;
L3_protocol_handler_uart0_fun(&ccmodbus,1);
}
}
#endif
void L3_UARTcom3_exp_protocol(TS_Handle_PH3 *p)
{
if (1 == p->ok)
{
#if 1
TS_PH3_ccmodbus ccmodbus;
byte_copy_uc((U8*)&ccmodbus,(U8*)&p->ts_ccmodbus,p->ts_ccmodbus.num + 3);
G.rfid = ccmodbus.buf[0];
L0_uart3_uc(G.rfid & 0xFF);
#else
L0_uart3_uc(p->reg);
#endif
p->ok = 0;
}
}
void L3_UARTcom0_exp_protocol(TS_Handle_PH3 *p)
{
if (1 == p->ok)
{
TS_PH3_ccmodbus ccmodbus;
//L0_uart0_uc(0xaa);
byte_copy_uc((U8*)&ccmodbus,(U8*)&p->ts_ccmodbus,p->ts_ccmodbus.num + 3);
p->ok = 0;
//L3_protocol_handler_uart0_fun(&ccmodbus,0);
}
}
#if 0
void L3_UARTcom2_exp_protocol(TS_Handle_PH1A *p)
{
if (1 == p->ok )
{
U8 slaveId = s_task_485.slaveId;
TS_PH1A_DAT tsph1A;
byte_copy_uc((U8*)&tsph1A,(U8*)&p->buf,D_HETU_FXA_buf_max);
p->ok = 0;
switch(tsph1A.oper)
{
case OPER_ANGLE_DAT:{
s_task_485.received = 1;
G.currentSensorVal[slaveId - U485_BASE] = (U16)tsph1A.xaxis[0] << 8 | tsph1A.xaxis[1];
//ID已经在协议解析处过滤,这里不��?要再处理
#if 0
L0_uart0_uc(tsph1A.filter);L0_uart0_uc(tsph1A.id);
L0_uart0_uc(tsph1A.xaxis[0]);L0_uart0_uc(tsph1A.xaxis[1]);
L0_uart0_uc(tsph1A.yaxis[0]);L0_uart0_uc(tsph1A.yaxis[1]);
L0_uart0_uc(tsph1A.zaxis[0]);L0_uart0_uc(tsph1A.zaxis[1]);
#endif
G.papers[slaveId - U485_BASE].version = APP_VERSION_HEX;
G.papers[slaveId - U485_BASE].LowPower = 0x00; //1bit
G.papers[slaveId - U485_BASE].cameraNotWorking = 0x00; //1bit
G.papers[slaveId - U485_BASE].cameraIndex = 0x00; //4bit
G.papers[slaveId - U485_BASE].paperNum =
L2_paper_count(slaveId - U485_BASE, (U16)tsph1A.xaxis[0] << 8 | tsph1A.xaxis[1]); //10bit
break;
}
case OPER_ANGLE_SET_ID:
L2_do_angle_setid_ack(tsph1A.xaxis[0]);
break;
}
}
}
#endif