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.
111 lines
2.7 KiB
111 lines
2.7 KiB
1 year ago
|
#include "bsp_lora.h"
|
||
|
//#include "tpc_debug.h"
|
||
|
#include "tpc_lora.h"
|
||
|
////#include "tpc_x.h"
|
||
|
#include "c_lib.h"
|
||
|
#include "msp_uart1.h"
|
||
|
#include "msp_uart2.h"
|
||
|
|
||
|
#include "debug_drv.h"
|
||
|
|
||
|
u8 test[]={
|
||
|
0x68 ,0x00 ,0x0D ,0x90 ,0x01 ,0x61 ,0x61 ,0x62 ,0x62 ,0x63 ,0x63 ,0xEA ,0x16
|
||
|
//1 2 3 4 5 6 7 8 9 10 11 12 13
|
||
|
|
||
|
//0 1 2 3 4 5 6 7 8 9 10 11 12
|
||
|
|
||
|
};
|
||
|
u8 test2[]={
|
||
|
0x68 ,0x00 ,0x07 ,0x91 ,0x03 ,0x9B ,0x16
|
||
|
//1 2 3 4 5 6 7 8 9 10 11 12 13
|
||
|
|
||
|
//0 1 2 3 4 5 6 7 8 9 10 11 12
|
||
|
|
||
|
};
|
||
|
#define D_lora_reset_ON() D_P47_ON()
|
||
|
|
||
|
#define D_lora_reset_OFF() D_P47_OFF()
|
||
|
#define D_lora_reset(); D_stdIO_P4(BITN7); D_lora_reset_OFF();Lc_delay_ms(1);D_lora_reset_ON();Lc_delay_ms(1);
|
||
|
|
||
|
#define D_lora_wakeup_ON() D_P24_ON()
|
||
|
#define D_lora_wakeup_OFF() D_P24_OFF()
|
||
|
|
||
|
#define D_lora_wakeup(); D_stdIO_P2(BITN4); D_lora_wakeup_ON();Lc_delay_ms(1);D_lora_wakeup_OFF();Lc_delay_ms(1);
|
||
|
|
||
|
|
||
|
void L2_lora_init(void)
|
||
|
{
|
||
|
D_lora_wakeup_ON();
|
||
|
D_lora_reset();
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
void L3_lora_debug(u8 filter)
|
||
|
{
|
||
|
if(filter == ts_debug_rec.filter)
|
||
|
{///filter num d1 d2 d3 ....dn
|
||
|
//// FD 08 11 22 33 44 55 66 77 88 Lc_delay_ms(1);
|
||
|
|
||
|
/// L1_uartD_uchexArray(TS_s2b_debug.sp,TS_debug_rec.R1);
|
||
|
|
||
|
printf("\r\n FD ok");
|
||
|
|
||
|
switch (ts_debug_rec.ocr)
|
||
|
{
|
||
|
case 0x11:
|
||
|
|
||
|
printf("11");
|
||
|
D_lora_wakeup(); L0_uart2_sendArray(test, 13);
|
||
|
printf(" lora send ");
|
||
|
L1_uartD_uchexArray(test, 13);
|
||
|
//1 2 3 4 5 6 7 8 9 10 11 12 13
|
||
|
break;
|
||
|
case 0x12:
|
||
|
printf("12");
|
||
|
D_lora_wakeup(); L0_uart2_sendArray(test2, 7);
|
||
|
printf(" lora send2 ");
|
||
|
L1_uartD_uchexArray(test2, 7);
|
||
|
//1 2 3 4 5 6 7 8 9 10 11 12 13
|
||
|
break;
|
||
|
|
||
|
|
||
|
default:
|
||
|
printf(" pp error\r\n ");
|
||
|
|
||
|
break;
|
||
|
};
|
||
|
|
||
|
printf("333");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void LORA_send(void)
|
||
|
|
||
|
{
|
||
|
vU8 add;
|
||
|
ts_lrdlora_send.filter = 0x68;
|
||
|
//// ts_lrdlora_send.len = DATA_LORA_LEN;
|
||
|
ts_lrdlora_send.DIR = 1;
|
||
|
ts_lrdlora_send.CMD = 0x37; /// 取值范围:0x7F~0x00;
|
||
|
/// ts_lrdlora_send.req = 0x01;
|
||
|
ts_lrdlora_send.filtert = 0x16;
|
||
|
L0_uart1_0d0a();
|
||
|
///L1_uartD_sendArray(&TS_lrdlora_send.filter,1);
|
||
|
///L1_uartD_sendArray(&TS_lrdlora_send.len,2);
|
||
|
///L1_uartD_sendArray(&TS_lrdlora_send.order,1);
|
||
|
///L1_uartD_sendArray(&TS_lrdlora_send.REQ,1);
|
||
|
///L1_uartD_sendArray(&TS_lrdlora_send.buf,6);
|
||
|
/// add = Fun_SC_Check(&ts_lrdlora_send.buf,4);
|
||
|
L1_uartD_sendArray(&add,1);
|
||
|
ts_lrdlora_send.ocr = add;
|
||
|
//buf 确定长度 for(i = 0;i<len;i++)(len是buf长度)
|
||
|
//打包函数 把数据整合 重新定义一个结构体(输入参数)
|
||
|
L1_uartD_sendArray(&ts_lrdlora_send.buf,14);
|
||
|
L0_uart1_0d0a();
|
||
|
|
||
|
}
|
||
|
|
||
|
|