11 changed files with 168 additions and 38 deletions
@ -0,0 +1,74 @@ |
|||||
|
////////////////////////////////////////////////////////////////////////////
|
||||
|
///@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; |
||||
|
// L0_uart0_uc(ts_uart4_recv_buf.reg);
|
||||
|
LED0 ^= 1; |
||||
|
//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(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,33 @@ |
|||||
|
////////////////////////////////////////////////////////////////////////////
|
||||
|
///@copyright Copyright (c) 2018, 传控科技 All rights reserved.
|
||||
|
///-------------------------------------------------------------------------
|
||||
|
/// @file bsp_drv.h
|
||||
|
/// @brief bsp @ driver config
|
||||
|
///-------------------------------------------------------------------------
|
||||
|
/// @version 1.0
|
||||
|
/// @author CC
|
||||
|
/// @date 20180331
|
||||
|
/// @note cc_AS_stc02
|
||||
|
|
||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
||||
|
#ifndef _APP_TASK_RS485_H |
||||
|
#define _APP_TASK_RS485_H |
||||
|
|
||||
|
#include "../ctask/task.h" |
||||
|
#include "../clib/clib.h" |
||||
|
#include "../tpc/debug.h" |
||||
|
|
||||
|
typedef struct _s_task_rs485 |
||||
|
{ |
||||
|
TS_task task; |
||||
|
}S_TASK_RS485; |
||||
|
|
||||
|
extern S_TASK_RS485 _s_task_rs485; |
||||
|
|
||||
|
extern void L3_task_rs485_init(void); |
||||
|
extern void L3_task_rs485_handler(S_TASK_RS485 *s); |
||||
|
|
||||
|
|
||||
|
#endif // #ifndef _APP_TASK_RS485_H
|
||||
|
|
Loading…
Reference in new issue