|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
///@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_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
|
|
|
|
|
|
|
|
|
|
|
|
U8 array[D_s_SSTR_0D0A_len+1];
|
|
|
|
|
|
|
|
void L3_UARTcom4_exp_protocol(TS_Handle_0d0a *p)
|
|
|
|
{
|
|
|
|
if (1 == p->ok )
|
|
|
|
{
|
|
|
|
#if 1
|
|
|
|
U8 num = p->buf[0];
|
|
|
|
byte_copy_uc(array,p->buf+1,num);
|
|
|
|
|
|
|
|
array[num] = 0;
|
|
|
|
L3_protocol_handler_uart4_fun(array);
|
|
|
|
#else
|
|
|
|
if(p->buf[0] > D_s_SSTR_0D0A_len)
|
|
|
|
{
|
|
|
|
p->buf[0] = D_s_SSTR_0D0A_len;
|
|
|
|
}
|
|
|
|
p->buf[p->buf[0]] = 0;
|
|
|
|
L3_protocol_handler_uart4_fun(p->buf + 1);
|
|
|
|
#endif
|
|
|
|
p->ok = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void L3_UARTcom3_exp_protocol(TS_Handle_PH3 *p)
|
|
|
|
{
|
|
|
|
if (1 == p->ok)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
TS_PH3_ccmodbus ccmodbus;
|
|
|
|
byte_copy_uc((U8*)&ccmodbus,(U8*)&p->ts_ccmodbus,p->ts_ccmodbus.num + 3);
|
|
|
|
if(ccmodbus.buf[0] != G._rfid) //rfid发生改变
|
|
|
|
{
|
|
|
|
G.rfid = G._rfid = ccmodbus.buf[0];
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if(p->ts_ccmodbus.buf[0] != G._rfid) //rfid发生改变
|
|
|
|
{
|
|
|
|
G.rfid = G._rfid = p->ts_ccmodbus.buf[0];
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
p->ok = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void L3_UARTcom0_exp_protocol(TS_Handle_PH3 *p)
|
|
|
|
{
|
|
|
|
if (1 == p->ok)
|
|
|
|
{
|
|
|
|
p->ok = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|