智能模块于传感器能通过串口通讯,协处理器部分的发送还未使用中断

This commit is contained in:
起床就犯困 2024-08-19 16:58:08 +08:00
parent d9c0372cc9
commit f4e52a8813
17 changed files with 12997 additions and 11160 deletions

View File

@ -9,16 +9,15 @@
#define APP_INC_INFLASH_H_
#include "debug.h"
#include "communication_protocol.h"
#pragma pack(push,1)
typedef struct _config_info{
uint8_t start_Flag[2]; /* お宎梓祩 */
uint8_t address[7]; /* 華硊 */
uint8_t end_Flag; /* 賦旰梓祩 */
uint16_t Access_Node_Type; /* 接入节点类型 */
uint16_t Communication_Methods; /* 通信方式 */
uint32_t bat485_Baud; /* 串口波特率 */
uint32_t gw485_Baud; /* 串口波特率 */
SL_Head_pack headPack; /* 관庫 */
SL_Tail_pack tailPack; /* 관庫 */
}config_info;
#define CONFIG_INFO_SIZE (sizeof(config_info))
#pragma pack(pop)

View File

@ -12,9 +12,10 @@
#include "uart_dev.h"
/* UartSend队列的格式 */
#define UART_MQ_SEND_LENGTH 20
#define UART_MQ_SEND_LENGTH 50
typedef struct _SL_UartSend_pack{
device_handle device; /* 串口 */
rt_uint8_t Channel; /* ͨµÀ */
rt_uint8_t len; /* 长度 */
rt_uint8_t recv_Data[UART_MQ_SEND_LENGTH]; /* 其他部分 */
}SL_UartSend_pack;

View File

@ -9,7 +9,7 @@
#include "inflash.h"
#include <string.h>
#include "thread_communication.h"
#include "UART.h"
/* 用于解析串口包时的长度 */
@ -119,115 +119,458 @@ uint8_t Check_485_bus_busy(device_handle device)
void SL_MsgProcFuncReadSensor_Read_Register(device_handle device, void *pMsg, uint32_t MsgLen)
{
// memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
// MqUartSend_pack.device = device;
// MqUartSend_pack.len = MsgLen;
//
// uint8_t *buf = (uint8_t *)pMsg;
// for (uint8_t var = 0; var < MsgLen; ++var) {
// MqUartSend_pack.recv_Data[var] = buf[var];
// }
//
// /* 发 送 消 息 到 消 息 队 列 中 */
// if (rt_mq_send(mqSend, &MqUartSend_pack, MsgLen) != RT_EOK) {
// rt_kprintf("rt_mq_send ERR\n");
// }
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.device = g_Upward_UART5_handle;
// MqUartSend_pack.Channel = ((uart_device_info *)device)->uart_num;
MqUartSend_pack.len = MsgLen + 5;
/* 包头 */
MqUartSend_pack.recv_Data[0] = g_slConfigInfo.headPack.start_Flag[0];
MqUartSend_pack.recv_Data[1] = g_slConfigInfo.headPack.start_Flag[1];
if (device == g_J1RS485_UART6_handle) {
MqUartSend_pack.recv_Data[2] = 6;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J2RS485_UART7_handle) {
MqUartSend_pack.recv_Data[2] = 7;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J3RS485_USART2_handle) {
MqUartSend_pack.recv_Data[2] = 2;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J4RS485_UART8_handle) {
MqUartSend_pack.recv_Data[2] = 8;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J50RS485_USART3_handle) {
MqUartSend_pack.recv_Data[2] = 3;
MqUartSend_pack.recv_Data[3] = ((uart_device_info *)device)->uart_num;
} else if (device == g_LORA_UART4_handle) {
MqUartSend_pack.recv_Data[2] = 4;
MqUartSend_pack.recv_Data[3] = 1;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen; ++var) {
MqUartSend_pack.recv_Data[var + 4] = buf[var];
}
MqUartSend_pack.recv_Data[MsgLen + 4] = 0x17;
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Sensor_Read_Register \n ");
}
void SL_MsgProcFuncReadSensor_Registration_request(device_handle device, void *pMsg, uint32_t MsgLen)
{
// memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
// MqUartSend_pack.device = device;
// MqUartSend_pack.len = SL_MPPT_REGISTRATIONREPLY_PACK_SIZE;
//
//// uint8_t *buf = (uint8_t *)pMsg;
//// for (uint8_t var = 0; var < MsgLen; ++var) {
//// MqUartSend_pack.recv_Data[var] = buf[var];
//// }
//
// SL_Mppt_RegistrationReply_pack *rrpack = (SL_Mppt_RegistrationReply_pack *)MqUartSend_pack.recv_Data;
// SL_Mppt_RegistrationRequest_pack *rpack = (SL_Mppt_RegistrationRequest_pack *)pMsg;
//
// rrpack->start_Flag[0] = rpack->start_Flag[0];
// rrpack->start_Flag[1] = rpack->start_Flag[1];
//
// rrpack->address[0] = rpack->access_Node_ID[0];
// rrpack->address[1] = rpack->access_Node_ID[1];
// rrpack->address[2] = rpack->access_Node_ID[2];
// rrpack->address[3] = rpack->access_Node_ID[3];
// rrpack->address[4] = rpack->access_Node_ID[4];
// rrpack->address[5] = rpack->access_Node_ID[5];
// rrpack->address[6] = rpack->access_Node_ID[6];
// rrpack->address[7] = rpack->access_Node_ID[7];
//
// rrpack->function_Code = rpack->function_Code;
//
// rrpack->register_Length_H = rpack->register_Length_H;
// rrpack->register_Length_L = rpack->register_Length_L;
//
// rrpack->registration_Status_H = 0x00;
// rrpack->registration_Status_L = 0x02;
//
// uint16_t crc_16 = CheckFunc(MqUartSend_pack.recv_Data, SL_MPPT_REGISTRATIONREPLY_PACK_SIZE - 3);
// rrpack->check_Bit_H = crc_16 >> 8;
// rrpack->check_Bit_L = crc_16;
//
// rrpack->end_Flag = 0x16;
//
// /* 发 送 消 息 到 消 息 队 列 中 */
// if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
// rt_kprintf("rt_mq_send ERR\n");
// }
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.device = g_Upward_UART5_handle;
// MqUartSend_pack.Channel = ((uart_device_info *)device)->uart_num;
MqUartSend_pack.len = MsgLen + 5;
rt_kprintf(" in Sensor_Registration_request \n ");
/* 包头 */
MqUartSend_pack.recv_Data[0] = g_slConfigInfo.headPack.start_Flag[0];
MqUartSend_pack.recv_Data[1] = g_slConfigInfo.headPack.start_Flag[1];
if (device == g_J1RS485_UART6_handle) {
MqUartSend_pack.recv_Data[2] = 6;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J2RS485_UART7_handle) {
MqUartSend_pack.recv_Data[2] = 7;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J3RS485_USART2_handle) {
MqUartSend_pack.recv_Data[2] = 2;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J4RS485_UART8_handle) {
MqUartSend_pack.recv_Data[2] = 8;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J50RS485_USART3_handle) {
MqUartSend_pack.recv_Data[2] = 3;
MqUartSend_pack.recv_Data[3] = ((uart_device_info *)device)->uart_num;
} else if (device == g_LORA_UART4_handle) {
MqUartSend_pack.recv_Data[2] = 4;
MqUartSend_pack.recv_Data[3] = 1;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen; ++var) {
MqUartSend_pack.recv_Data[var + 4] = buf[var];
}
MqUartSend_pack.recv_Data[MsgLen + 4] = 0x17;
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
// rt_kprintf(" in Sensor_Registration_request \n ");
}
void SL_MsgProcFuncReadSensor_Update_Profile(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.device = g_Upward_UART5_handle;
// MqUartSend_pack.Channel = ((uart_device_info *)device)->uart_num;
MqUartSend_pack.len = MsgLen + 5;
/* 包头 */
MqUartSend_pack.recv_Data[0] = g_slConfigInfo.headPack.start_Flag[0];
MqUartSend_pack.recv_Data[1] = g_slConfigInfo.headPack.start_Flag[1];
if (device == g_J1RS485_UART6_handle) {
MqUartSend_pack.recv_Data[2] = 6;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J2RS485_UART7_handle) {
MqUartSend_pack.recv_Data[2] = 7;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J3RS485_USART2_handle) {
MqUartSend_pack.recv_Data[2] = 2;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J4RS485_UART8_handle) {
MqUartSend_pack.recv_Data[2] = 8;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J50RS485_USART3_handle) {
MqUartSend_pack.recv_Data[2] = 3;
MqUartSend_pack.recv_Data[3] = ((uart_device_info *)device)->uart_num;
} else if (device == g_LORA_UART4_handle) {
MqUartSend_pack.recv_Data[2] = 4;
MqUartSend_pack.recv_Data[3] = 1;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen; ++var) {
MqUartSend_pack.recv_Data[var + 4] = buf[var];
}
MqUartSend_pack.recv_Data[MsgLen + 4] = 0x17;
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Sensor_Update_Profile \n ");
}
void SL_MsgProcFuncReadSensor_Remote_Upgrade(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.device = g_Upward_UART5_handle;
// MqUartSend_pack.Channel = ((uart_device_info *)device)->uart_num;
MqUartSend_pack.len = MsgLen + 5;
/* 包头 */
MqUartSend_pack.recv_Data[0] = g_slConfigInfo.headPack.start_Flag[0];
MqUartSend_pack.recv_Data[1] = g_slConfigInfo.headPack.start_Flag[1];
if (device == g_J1RS485_UART6_handle) {
MqUartSend_pack.recv_Data[2] = 6;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J2RS485_UART7_handle) {
MqUartSend_pack.recv_Data[2] = 7;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J3RS485_USART2_handle) {
MqUartSend_pack.recv_Data[2] = 2;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J4RS485_UART8_handle) {
MqUartSend_pack.recv_Data[2] = 8;
MqUartSend_pack.recv_Data[3] = 1;
} else if (device == g_J50RS485_USART3_handle) {
MqUartSend_pack.recv_Data[2] = 3;
MqUartSend_pack.recv_Data[3] = ((uart_device_info *)device)->uart_num;
} else if (device == g_LORA_UART4_handle) {
MqUartSend_pack.recv_Data[2] = 4;
MqUartSend_pack.recv_Data[3] = 1;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen; ++var) {
MqUartSend_pack.recv_Data[var + 4] = buf[var];
}
MqUartSend_pack.recv_Data[MsgLen + 4] = 0x17;
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Sensor_Remote_Upgrade \n ");
}
void SL_MsgProcFuncReadIntelligentModule_Read_Register(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.len = MsgLen - 4;
SL_Mppt_Recv_pack1 *rpack = (SL_Mppt_Recv_pack1 *)pMsg;
switch (rpack->head.uart) {
case 2:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 3:
MqUartSend_pack.device = g_J50RS485_USART3_handle;
MqUartSend_pack.Channel = rpack->head.Channel;
break;
case 4:
MqUartSend_pack.device = g_LORA_UART4_handle;
break;
case 6:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 7:
MqUartSend_pack.device = g_J2RS485_UART7_handle;
break;
case 8:
MqUartSend_pack.device = g_J4RS485_UART8_handle;
break;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen - 1; ++var) {
MqUartSend_pack.recv_Data[var] = buf[var + 4];
}
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Read_Register \n ");
}
void SL_MsgProcFuncReadIntelligentModule_Write_Register(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.len = MsgLen - 4;
SL_Mppt_Recv_pack1 *rpack = (SL_Mppt_Recv_pack1 *)pMsg;
switch (rpack->head.uart) {
case 2:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 3:
MqUartSend_pack.device = g_J50RS485_USART3_handle;
MqUartSend_pack.Channel = rpack->head.Channel;
break;
case 4:
MqUartSend_pack.device = g_LORA_UART4_handle;
break;
case 6:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 7:
MqUartSend_pack.device = g_J2RS485_UART7_handle;
break;
case 8:
MqUartSend_pack.device = g_J4RS485_UART8_handle;
break;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen - 1; ++var) {
MqUartSend_pack.recv_Data[var] = buf[var + 4];
}
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Write_Register \n ");
}
void SL_MsgProcFuncReadIntelligentModule_Broadcast_Scan(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.len = MsgLen - 4;
SL_Mppt_Recv_pack1 *rpack = (SL_Mppt_Recv_pack1 *)pMsg;
switch (rpack->head.uart) {
case 2:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 3:
MqUartSend_pack.device = g_J50RS485_USART3_handle;
MqUartSend_pack.Channel = rpack->head.Channel;
break;
case 4:
MqUartSend_pack.device = g_LORA_UART4_handle;
break;
case 6:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 7:
MqUartSend_pack.device = g_J2RS485_UART7_handle;
break;
case 8:
MqUartSend_pack.device = g_J4RS485_UART8_handle;
break;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen - 1; var++) {
MqUartSend_pack.recv_Data[var] = buf[var + 4];
}
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Broadcast_Scan \n ");
}
void SL_MsgProcFuncReadIntelligentModule_Registration_request(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.len = MsgLen - 4;
SL_Mppt_Recv_pack1 *rpack = (SL_Mppt_Recv_pack1 *)pMsg;
switch (rpack->head.uart) {
case 2:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 3:
MqUartSend_pack.device = g_J50RS485_USART3_handle;
MqUartSend_pack.Channel = rpack->head.Channel;
break;
case 4:
MqUartSend_pack.device = g_LORA_UART4_handle;
break;
case 6:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 7:
MqUartSend_pack.device = g_J2RS485_UART7_handle;
break;
case 8:
MqUartSend_pack.device = g_J4RS485_UART8_handle;
break;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen - 1; ++var) {
MqUartSend_pack.recv_Data[var] = buf[var + 4];
}
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Registration_request \n ");
}
void SL_MsgProcFuncReadIntelligentModule_Update_Profile(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.len = MsgLen - 4;
SL_Mppt_Recv_pack1 *rpack = (SL_Mppt_Recv_pack1 *)pMsg;
switch (rpack->head.uart) {
case 2:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 3:
MqUartSend_pack.device = g_J50RS485_USART3_handle;
MqUartSend_pack.Channel = rpack->head.Channel;
break;
case 4:
MqUartSend_pack.device = g_LORA_UART4_handle;
break;
case 6:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 7:
MqUartSend_pack.device = g_J2RS485_UART7_handle;
break;
case 8:
MqUartSend_pack.device = g_J4RS485_UART8_handle;
break;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen - 1; ++var) {
MqUartSend_pack.recv_Data[var] = buf[var + 4];
}
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Update_Profile \n ");
}
void SL_MsgProcFuncReadIntelligentModule_Remote_Upgrade(device_handle device, void *pMsg, uint32_t MsgLen)
{
memset(&MqUartSend_pack, 0, sizeof(MqUartSend_pack));
MqUartSend_pack.len = MsgLen - 4;
SL_Mppt_Recv_pack1 *rpack = (SL_Mppt_Recv_pack1 *)pMsg;
switch (rpack->head.uart) {
case 2:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 3:
MqUartSend_pack.device = g_J50RS485_USART3_handle;
MqUartSend_pack.Channel = rpack->head.Channel;
break;
case 4:
MqUartSend_pack.device = g_LORA_UART4_handle;
break;
case 6:
MqUartSend_pack.device = g_J3RS485_USART2_handle;
break;
case 7:
MqUartSend_pack.device = g_J2RS485_UART7_handle;
break;
case 8:
MqUartSend_pack.device = g_J4RS485_UART8_handle;
break;
}
uint8_t *buf = (uint8_t *)pMsg;
for (uint8_t var = 0; var < MsgLen - 1; ++var) {
MqUartSend_pack.recv_Data[var] = buf[var + 4];
}
/* 发 送 消 息 到 消 息 队 列 中 */
if (rt_mq_send(mqSend, &MqUartSend_pack, sizeof(MqUartSend_pack)) != RT_EOK) {
rt_kprintf("rt_mq_send ERR\n");
}
rt_kprintf(" in Remote_Upgrade \n ");
}
@ -545,7 +888,7 @@ void read_and_process_intelligentModuleUart_data(device_handle device)
{
if (uart_dev_char_present(device)) {
rt_thread_mdelay(10);
rt_kprintf("ring_queue_length = %d \n", ring_queue_length(device));
// rt_kprintf("ring_queue_length = %d \n", ring_queue_length(device));
memset(uart_buff, 0, sizeof(uart_buff));
int ret = uart_read_intelligentModule_pack(device, uart_buff, sizeof(uart_buff));
if(ret > 0){
@ -563,7 +906,27 @@ void send_uart_data(uint8_t *buff)
{
SL_UartSend_pack *upack = (SL_UartSend_pack *)buff;
uart_dev_write(upack->device, upack->recv_Data, upack->len + 1);
if (upack->device == g_J50RS485_USART3_handle) {
if (upack->Channel == 5) {
USART_CONNET_J5();
} else if (upack->Channel == 6) {
USART_CONNET_J6();
} else if (upack->Channel == 7) {
USART_CONNET_J7();
} else if (upack->Channel == 8) {
USART_CONNET_J8();
} else if (upack->Channel == 9) {
USART_CONNET_J9();
} else {
USART_CONNET_J0();
}
}
for (int var = 0; var < upack->len; ++var) {
rt_kprintf("%x ", upack->recv_Data[var]);
}
rt_kprintf("\n");
uart_dev_write(upack->device, upack->recv_Data, upack->len);
}

View File

@ -8,9 +8,17 @@
#include "inflash.h"
#include "flash.h"
uint8_t address[7]; /* 뒈囹 */
uint8_t end_Flag; /* 써監깃羚 */
SL_Head_pack headPack; /* 관庫 */
SL_Tail_pack tailPack; /* 관庫 */
config_info g_slConfigInfo = {
.start_Flag = {'S', 'L'},
.end_Flag = 0x16,
.headPack.start_Flag = {'S', 'L'},
.tailPack.end_Flag = 0x17,
};

View File

@ -80,18 +80,18 @@ void Recv_thread_entry(void* parameter)
read_and_process_sensorUart_data(g_J50RS485_USART3_handle);
read_and_process_sensorUart_data(g_LORA_UART4_handle);
read_and_process_intelligentModuleUart_data(g_Upward_UART5_handle);
// rt_thread_mdelay(100);
rt_thread_mdelay(5);
}
}
static uint8_t buff[100];
void Send_thread_entry(void* parameter)
{
// uint8_t buff[100];
while (1) {
// memset(buff, 0, sizeof(buff));
// rt_mq_recv(mqSend, buff, sizeof(buff), RT_WAITING_FOREVER);
// rt_kprintf("\n Send buff \n");
// send_uart_data(buff);
memset(buff, 0, sizeof(buff));
rt_mq_recv(mqSend, buff, sizeof(buff), RT_WAITING_FOREVER);
rt_kprintf("\n Send buff \n");
send_uart_data(buff);
// uart_dev_write(g_Upward_UART5_handle, "hello world\n", sizeof("hello world\n"));
// rt_thread_mdelay(1000);

View File

@ -38,9 +38,9 @@ void hareware_init()
void software_init()
{
uart_all_dev_init();
// Send_mq_Init();
Send_mq_Init();
Recv_thread_Init();
// Send_thread_Init();
Send_thread_Init();
// while (1) {
//// uart_dev_write(g_J4RS485_UART8_handle, "hello world\n", sizeof("hello world\n"));

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,9 @@ Software/src/communication_protocol.o: \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/inflash.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/UART.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h:
@ -161,4 +163,8 @@ D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/inflash.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/thread_communication.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/UART.h:

View File

@ -29,15 +29,30 @@ Software/src/inflash.o: ../Software/src/inflash.c \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_wwdg.h \
D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_it.h \
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_misc.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/flash.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtthread.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread/rtconfig.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdebug.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtdef.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtservice.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/rtdevice.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/ringbuffer.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/completion.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/dataqueue.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/workqueue.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/waitqueue.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h \
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h \
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h \
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h \
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/flash.h
D:\psx\su806\git\CH32V303_V0.1\Software\inc/inflash.h:
@ -99,9 +114,9 @@ D:\psx\su806\git\CH32V303_V0.1\User/ch32v30x_it.h:
D:\psx\su806\git\CH32V303_V0.1\Peripheral\inc/ch32v30x_misc.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/flash.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/communication_protocol.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware/inc/UART.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtthread.h:
@ -116,3 +131,33 @@ D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtservice.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rtm.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\finsh/finsh_api.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\include/rthw.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/rtdevice.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/ringbuffer.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/completion.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/dataqueue.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/workqueue.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/waitqueue.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/pipe.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/ipc/poll.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/serial.h:
D:\psx\su806\git\CH32V303_V0.1\rtthread\components\drivers\include/drivers/pin.h:
D:\psx\su806\git\CH32V303_V0.1\Software\inc/uart_dev.h:
D:\psx\su806\git\CH32V303_V0.1\drivers/RingQueue/ring_queue.h:
D:\psx\su806\git\CH32V303_V0.1\Hardware\inc/flash.h:

Binary file not shown.

Binary file not shown.

Binary file not shown.