修改包头,增加一个长度
This commit is contained in:
parent
f4e52a8813
commit
757163c1dd
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-148882674934750304" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1005342134977218339" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
|
@ -541,11 +541,11 @@ void J5_0_485_Init(uint32_t baud)
|
|||
**/
|
||||
void USART_CONNET_J0(void)
|
||||
{
|
||||
J5_PWR_Close();
|
||||
J6_PWR_Close();
|
||||
J7_PWR_Close();
|
||||
J8_PWR_Close();
|
||||
J9_PWR_Close();
|
||||
// J5_PWR_Close();
|
||||
// J6_PWR_Close();
|
||||
// J7_PWR_Close();
|
||||
// J8_PWR_Close();
|
||||
// J9_PWR_Close();
|
||||
rt_pin_write(TD_USART_A, PIN_LOW);
|
||||
rt_pin_write(TD_USART_B, PIN_LOW);
|
||||
rt_pin_write(TD_USART_C, PIN_LOW);
|
||||
|
@ -559,11 +559,11 @@ void USART_CONNET_J0(void)
|
|||
**/
|
||||
void USART_CONNET_J5(void)
|
||||
{
|
||||
J5_PWR_Open();
|
||||
J6_PWR_Close();
|
||||
J7_PWR_Close();
|
||||
J8_PWR_Close();
|
||||
J9_PWR_Close();
|
||||
// J5_PWR_Open();
|
||||
// J6_PWR_Close();
|
||||
// J7_PWR_Close();
|
||||
// J8_PWR_Close();
|
||||
// J9_PWR_Close();
|
||||
rt_pin_write(TD_USART_A, PIN_LOW);
|
||||
rt_pin_write(TD_USART_B, PIN_LOW);
|
||||
rt_pin_write(TD_USART_C, PIN_LOW);
|
||||
|
@ -577,11 +577,11 @@ void USART_CONNET_J5(void)
|
|||
**/
|
||||
void USART_CONNET_J6(void)
|
||||
{
|
||||
J5_PWR_Close();
|
||||
J6_PWR_Open();
|
||||
J7_PWR_Close();
|
||||
J8_PWR_Close();
|
||||
J9_PWR_Close();
|
||||
// J5_PWR_Close();
|
||||
// J6_PWR_Open();
|
||||
// J7_PWR_Close();
|
||||
// J8_PWR_Close();
|
||||
// J9_PWR_Close();
|
||||
rt_pin_write(TD_USART_A, PIN_HIGH);
|
||||
rt_pin_write(TD_USART_B, PIN_LOW);
|
||||
rt_pin_write(TD_USART_C, PIN_LOW);
|
||||
|
@ -595,11 +595,11 @@ void USART_CONNET_J6(void)
|
|||
**/
|
||||
void USART_CONNET_J7(void)
|
||||
{
|
||||
J5_PWR_Close();
|
||||
J6_PWR_Close();
|
||||
J7_PWR_Open();
|
||||
J8_PWR_Close();
|
||||
J9_PWR_Close();
|
||||
// J5_PWR_Close();
|
||||
// J6_PWR_Close();
|
||||
// J7_PWR_Open();
|
||||
// J8_PWR_Close();
|
||||
// J9_PWR_Close();
|
||||
rt_pin_write(TD_USART_A, PIN_HIGH);
|
||||
rt_pin_write(TD_USART_B, PIN_HIGH);
|
||||
rt_pin_write(TD_USART_C, PIN_LOW);
|
||||
|
@ -613,11 +613,11 @@ void USART_CONNET_J7(void)
|
|||
**/
|
||||
void USART_CONNET_J8(void)
|
||||
{
|
||||
J5_PWR_Close();
|
||||
J6_PWR_Close();
|
||||
J7_PWR_Close();
|
||||
J8_PWR_Open();
|
||||
J9_PWR_Close();
|
||||
// J5_PWR_Close();
|
||||
// J6_PWR_Close();
|
||||
// J7_PWR_Close();
|
||||
// J8_PWR_Open();
|
||||
// J9_PWR_Close();
|
||||
rt_pin_write(TD_USART_A, PIN_LOW);
|
||||
rt_pin_write(TD_USART_B, PIN_LOW);
|
||||
rt_pin_write(TD_USART_C, PIN_HIGH);
|
||||
|
@ -631,11 +631,11 @@ void USART_CONNET_J8(void)
|
|||
**/
|
||||
void USART_CONNET_J9(void)
|
||||
{
|
||||
J5_PWR_Close();
|
||||
J6_PWR_Close();
|
||||
J7_PWR_Close();
|
||||
J8_PWR_Close();
|
||||
J9_PWR_Open();
|
||||
// J5_PWR_Close();
|
||||
// J6_PWR_Close();
|
||||
// J7_PWR_Close();
|
||||
// J8_PWR_Close();
|
||||
// J9_PWR_Open();
|
||||
rt_pin_write(TD_USART_A, PIN_HIGH);
|
||||
rt_pin_write(TD_USART_B, PIN_LOW);
|
||||
rt_pin_write(TD_USART_C, PIN_HIGH);
|
||||
|
@ -811,18 +811,18 @@ void USART3_IRQHandler(void)
|
|||
}
|
||||
}
|
||||
|
||||
void UART4_IRQHandler(void)
|
||||
{
|
||||
if(USART_GetITStatus(UART4, USART_IT_RXNE) != RESET) //ÖжϲúÉú
|
||||
{
|
||||
UART4_Rbuffer[0] = USART_ReceiveData(UART4); //½ÓÊÕÊý¾Ý
|
||||
uint8_t c = 0;
|
||||
uart_device_info *dev = (uart_device_info *)g_LORA_UART4_handle;
|
||||
c = UART4_Rbuffer[0];
|
||||
if(!RingQueueFull(&dev->uart_ring_queue))
|
||||
InRingQueue(&dev->uart_ring_queue, c);
|
||||
}
|
||||
}
|
||||
//void UART4_IRQHandler(void)
|
||||
//{
|
||||
// if(USART_GetITStatus(UART4, USART_IT_RXNE) != RESET) //ÖжϲúÉú
|
||||
// {
|
||||
// UART4_Rbuffer[0] = USART_ReceiveData(UART4); //½ÓÊÕÊý¾Ý
|
||||
// uint8_t c = 0;
|
||||
// uart_device_info *dev = (uart_device_info *)g_LORA_UART4_handle;
|
||||
// c = UART4_Rbuffer[0];
|
||||
// if(!RingQueueFull(&dev->uart_ring_queue))
|
||||
// InRingQueue(&dev->uart_ring_queue, c);
|
||||
// }
|
||||
//}
|
||||
|
||||
void UART5_IRQHandler(void)
|
||||
{
|
||||
|
|
|
@ -191,7 +191,10 @@ typedef struct _SL_HEAD_pack{
|
|||
uint8_t start_Flag[2]; /* 起始标志 */
|
||||
uint8_t uart; /* 串口号,1对应uart1 */
|
||||
uint8_t Channel; /* 通道,分时复用时使用 */
|
||||
uint8_t lengH; /* 帧长度高八位 */
|
||||
uint8_t lengL; /* 帧长度低八位 */
|
||||
}SL_Head_pack;
|
||||
#define HEAD_PACK_LEN sizeof(SL_Head_pack)
|
||||
/* 智能模块与协处理器之间传输数据时的包尾 */
|
||||
typedef struct _SL_TAIL_pack{
|
||||
uint8_t end_Flag; /* 结束标志 */
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
#define readSensorAnalyzeStartFlag 2 //长度为2时解析起始标志
|
||||
#define readSensorAnalyzeFunctionCode 10 //长度为10时解析功能码
|
||||
|
||||
#define readIntelligentModuleAnalyzeHeader 4 //长度为4时解析包尾
|
||||
#define readIntelligentModuleAnalyzeStartFlag 6 //长度为6时解析起始标志
|
||||
#define readIntelligentMOduleAnalyzeFunctionCode 14 //长度为14时解析功能码
|
||||
#define readIntelligentModuleAnalyzeHeader 6 //长度为4时解析包尾
|
||||
//#define readIntelligentModuleAnalyzeHeader 4 //长度为4时解析包尾
|
||||
//#define readIntelligentModuleAnalyzeStartFlag 6 //长度为6时解析起始标志
|
||||
//#define readIntelligentMOduleAnalyzeFunctionCode 14 //长度为14时解析功能码
|
||||
|
||||
|
||||
SL_Mppt_Scan_Broadcast_pack g_Scan_Broadcast_pack = {
|
||||
|
@ -301,7 +302,7 @@ void SL_MsgProcFuncReadSensor_Remote_Upgrade(device_handle device, void *pMsg, u
|
|||
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;
|
||||
MqUartSend_pack.len = MsgLen - 6;
|
||||
|
||||
SL_Mppt_Recv_pack1 *rpack = (SL_Mppt_Recv_pack1 *)pMsg;
|
||||
switch (rpack->head.uart) {
|
||||
|
@ -685,6 +686,147 @@ static int uart_read_sensor_pack(device_handle uart_handle,uint8_t *buff, uint32
|
|||
return 0;
|
||||
}
|
||||
|
||||
///**
|
||||
// * @brief 读取智能模块串口数据
|
||||
// * @param uart_handle 串口句柄
|
||||
// * @param buff 缓冲区
|
||||
// * @param buff_size 缓冲区长度
|
||||
// * @retval
|
||||
// */
|
||||
//static int uart_read_intelligentModule_pack(device_handle uart_handle,uint8_t *buff, uint32_t buff_size)
|
||||
//{
|
||||
// SL_Mppt_Recv_pack1 *pack = (SL_Mppt_Recv_pack1 *)buff;
|
||||
//
|
||||
// uint32_t offset = 0;
|
||||
// uint32_t len = 0;
|
||||
// uint8_t flag_run = 0;
|
||||
//
|
||||
// char c = 0;
|
||||
//
|
||||
// buff_size--; //预留一个'\0'位置
|
||||
//
|
||||
// for (; offset < buff_size;){
|
||||
// if (ring_queue_length(uart_handle) == 0) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// c = uart_dev_in_char(uart_handle);
|
||||
//
|
||||
// buff[offset++] = c;
|
||||
//
|
||||
//// if (offset == sizeof(SL_Head_pack)) {
|
||||
////
|
||||
//// }
|
||||
//
|
||||
// /* 匹配包头 */
|
||||
// if ((offset == readIntelligentModuleAnalyzeHeader) || (flag_run > 0)) {
|
||||
// if (!Match_Startflag(pack->head.start_Flag)) {
|
||||
//// rt_kprintf("header error1 : %s \n", pack->head.start_Flag);
|
||||
// memcpy(buff, buff+1, offset-1);
|
||||
// offset--;
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (!((pack->head.uart > 0) && (pack->head.uart < 9))) {
|
||||
//// rt_kprintf("header error2 : %d \n", pack->head.uart);
|
||||
// memcpy(buff, buff+1, offset-1);
|
||||
// offset--;
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (!(((pack->head.uart == 3) && ((pack->head.Channel == 0) ||
|
||||
// (pack->head.Channel < 10 && pack->head.Channel > 4)))
|
||||
// || (pack->head.uart != 3))) {
|
||||
//// rt_kprintf("header error3 : %d \n", pack->head.Channel);
|
||||
// memcpy(buff, buff+1, offset-1);
|
||||
// offset--;
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
//// rt_kprintf("header success \n");
|
||||
// }
|
||||
//
|
||||
// /* 匹配起始标志位 */
|
||||
// if (offset == readIntelligentModuleAnalyzeStartFlag || (flag_run > 1)) {
|
||||
// if (!Match_Startflag(pack->rpack.start_Flag)) {
|
||||
// if (flag_run < 1) {
|
||||
// flag_run = 1;
|
||||
// }
|
||||
// memcpy(buff, buff+1, offset-1);
|
||||
// offset--;
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
//// rt_kprintf("start_Flag success \n");
|
||||
// }
|
||||
//
|
||||
// /* 匹配功能码 */
|
||||
// if ((offset == readIntelligentMOduleAnalyzeFunctionCode) || (flag_run > 2)) {
|
||||
// /* 读寄存器数据 */
|
||||
// if (pack->rpack.function_Code == SL_Function_Code_Read_Register) {
|
||||
// len = SL_MPPT_RORECV_PACK_SIZE1;
|
||||
// }
|
||||
//
|
||||
// /* 写寄存器数据 */
|
||||
// else if (pack->rpack.function_Code == SL_Function_Code_Write_Register) {
|
||||
//// len = SL_MPPT_RORECV_PACK_SIZE1;
|
||||
// }
|
||||
//
|
||||
// /* 广播请求 */
|
||||
// else if (pack->rpack.function_Code == SL_Function_Code_Broadcast_Scan) {
|
||||
// len = SL_MPPT_SCAN_BROADCAST_PACK_SIZE1;
|
||||
// }
|
||||
//
|
||||
// /* 注册回复 */
|
||||
// else if ((pack->rpack.function_Code == SL_Function_Code_Registration_request)) {
|
||||
// len = SL_MPPT_REGISTRATIONREPLY_PACK_SIZE1;
|
||||
// }
|
||||
//
|
||||
// /* 远程升级或配置文件更改 */
|
||||
// else if ((pack->rpack.function_Code == SL_Function_Code_Update_Profile)
|
||||
// || (pack->rpack.function_Code == SL_Function_Code_Remote_Upgrade)) {
|
||||
// len = SL_MPPT_SOTHER_PACK_SIZE1;
|
||||
// }
|
||||
//
|
||||
// else {
|
||||
// if (flag_run < 2) {
|
||||
// flag_run = 2;
|
||||
// }
|
||||
//
|
||||
//// rt_kprintf("function_Code error : %x \n", pack->rpack.function_Code);
|
||||
// memcpy(buff, buff+1, offset-1);
|
||||
// offset--;
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ((offset == 18) && (pack->rpack.function_Code == SL_Function_Code_Write_Register)) {
|
||||
// SL_Mppt_WOReply_pack1 *rpack = (SL_Mppt_WOReply_pack1 *)buff;
|
||||
// uint16_t Register_Number = (rpack->write_Register_Number_H << 8) | rpack->write_Register_Number_L;
|
||||
//// rt_kprintf("Register_Number : %d \n", Register_Number);
|
||||
// len = Register_Number * 2 + 22;
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (offset == len) {
|
||||
// uint16_t crc_16 = buff[offset - 3] | (buff[offset - 4] << 8);
|
||||
//
|
||||
// if ((CheckFunc(buff + 4, offset - 8) != crc_16) || (buff[offset - 2] != 0x16) || (buff[offset - 1] != 0x17)) {
|
||||
// if (flag_run < 3) {
|
||||
// flag_run = 3;
|
||||
// }
|
||||
//// rt_kprintf("crc: %x, end_Flag: %x, tail.end_Flag: %x \n", CheckFunc(buff + 4, offset - 8), buff[offset - 2], buff[offset - 1]);
|
||||
// memcpy(buff, buff+1, offset-1);
|
||||
// offset--;
|
||||
// } else {
|
||||
//// rt_kprintf("success return offset : %d \n", offset);
|
||||
// return offset;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
/**
|
||||
* @brief 读取智能模块串口数据
|
||||
* @param uart_handle 串口句柄
|
||||
|
@ -713,113 +855,18 @@ static int uart_read_intelligentModule_pack(device_handle uart_handle,uint8_t *b
|
|||
|
||||
buff[offset++] = c;
|
||||
|
||||
if (offset == sizeof(SL_Head_pack)) {
|
||||
|
||||
}
|
||||
|
||||
/* 匹配包头 */
|
||||
if ((offset == readIntelligentModuleAnalyzeHeader) || (flag_run > 0)) {
|
||||
if (!Match_Startflag(pack->head.start_Flag)) {
|
||||
// rt_kprintf("header error1 : %s \n", pack->head.start_Flag);
|
||||
memcpy(buff, buff+1, offset-1);
|
||||
offset--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!((pack->head.uart > 0) && (pack->head.uart < 9))) {
|
||||
// rt_kprintf("header error2 : %d \n", pack->head.uart);
|
||||
memcpy(buff, buff+1, offset-1);
|
||||
offset--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(((pack->head.uart == 3) && ((pack->head.Channel == 0) ||
|
||||
(pack->head.Channel < 10 && pack->head.Channel > 4)))
|
||||
|| (pack->head.uart != 3))) {
|
||||
// rt_kprintf("header error3 : %d \n", pack->head.Channel);
|
||||
memcpy(buff, buff+1, offset-1);
|
||||
offset--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// rt_kprintf("header success \n");
|
||||
}
|
||||
|
||||
/* 匹配起始标志位 */
|
||||
if (offset == readIntelligentModuleAnalyzeStartFlag || (flag_run > 1)) {
|
||||
if (!Match_Startflag(pack->rpack.start_Flag)) {
|
||||
if (flag_run < 1) {
|
||||
flag_run = 1;
|
||||
}
|
||||
memcpy(buff, buff+1, offset-1);
|
||||
offset--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// rt_kprintf("start_Flag success \n");
|
||||
}
|
||||
|
||||
/* 匹配功能码 */
|
||||
if ((offset == readIntelligentMOduleAnalyzeFunctionCode) || (flag_run > 2)) {
|
||||
/* 读寄存器数据 */
|
||||
if (pack->rpack.function_Code == SL_Function_Code_Read_Register) {
|
||||
len = SL_MPPT_RORECV_PACK_SIZE1;
|
||||
}
|
||||
|
||||
/* 写寄存器数据 */
|
||||
else if (pack->rpack.function_Code == SL_Function_Code_Write_Register) {
|
||||
// len = SL_MPPT_RORECV_PACK_SIZE1;
|
||||
}
|
||||
|
||||
/* 广播请求 */
|
||||
else if (pack->rpack.function_Code == SL_Function_Code_Broadcast_Scan) {
|
||||
len = SL_MPPT_SCAN_BROADCAST_PACK_SIZE1;
|
||||
}
|
||||
|
||||
/* 注册回复 */
|
||||
else if ((pack->rpack.function_Code == SL_Function_Code_Registration_request)) {
|
||||
len = SL_MPPT_REGISTRATIONREPLY_PACK_SIZE1;
|
||||
}
|
||||
|
||||
/* 远程升级或配置文件更改 */
|
||||
else if ((pack->rpack.function_Code == SL_Function_Code_Update_Profile)
|
||||
|| (pack->rpack.function_Code == SL_Function_Code_Remote_Upgrade)) {
|
||||
len = SL_MPPT_SOTHER_PACK_SIZE1;
|
||||
}
|
||||
|
||||
else {
|
||||
if (flag_run < 2) {
|
||||
flag_run = 2;
|
||||
}
|
||||
|
||||
// rt_kprintf("function_Code error : %x \n", pack->rpack.function_Code);
|
||||
memcpy(buff, buff+1, offset-1);
|
||||
offset--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((offset == 18) && (pack->rpack.function_Code == SL_Function_Code_Write_Register)) {
|
||||
SL_Mppt_WOReply_pack1 *rpack = (SL_Mppt_WOReply_pack1 *)buff;
|
||||
uint16_t Register_Number = (rpack->write_Register_Number_H << 8) | rpack->write_Register_Number_L;
|
||||
// rt_kprintf("Register_Number : %d \n", Register_Number);
|
||||
len = Register_Number * 2 + 22;
|
||||
continue;
|
||||
if ((offset == HEAD_PACK_LEN) || (flag_run > 0)) {
|
||||
len = (pack->head.lengH << 8 | pack->head.lengL) + HEAD_PACK_LEN + 1;
|
||||
}
|
||||
|
||||
if (offset == len) {
|
||||
uint16_t crc_16 = buff[offset - 3] | (buff[offset - 4] << 8);
|
||||
|
||||
if ((CheckFunc(buff + 4, offset - 8) != crc_16) || (buff[offset - 2] != 0x16) || (buff[offset - 1] != 0x17)) {
|
||||
if (flag_run < 3) {
|
||||
flag_run = 3;
|
||||
}
|
||||
// rt_kprintf("crc: %x, end_Flag: %x, tail.end_Flag: %x \n", CheckFunc(buff + 4, offset - 8), buff[offset - 2], buff[offset - 1]);
|
||||
if (buff[len - 1] == g_slConfigInfo.end_Flag) {
|
||||
return offset;
|
||||
} else {
|
||||
flag_run = 1;
|
||||
memcpy(buff, buff+1, offset-1);
|
||||
offset--;
|
||||
} else {
|
||||
// rt_kprintf("success return offset : %d \n", offset);
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -925,6 +972,7 @@ void send_uart_data(uint8_t *buff)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ void Send_thread_entry(void* parameter)
|
|||
while (1) {
|
||||
memset(buff, 0, sizeof(buff));
|
||||
rt_mq_recv(mqSend, buff, sizeof(buff), RT_WAITING_FOREVER);
|
||||
rt_kprintf("\n Send buff \n");
|
||||
// rt_kprintf("\n Send buff \n");
|
||||
send_uart_data(buff);
|
||||
|
||||
// uart_dev_write(g_Upward_UART5_handle, "hello world\n", sizeof("hello world\n"));
|
||||
|
|
|
@ -30,7 +30,7 @@ static uint8_t J2RS485_in_buff[IN_BUFF_SIZE];
|
|||
static uint8_t J3RS485_in_buff[IN_BUFF_SIZE];
|
||||
static uint8_t J4RS485_in_buff[IN_BUFF_SIZE];
|
||||
static uint8_t J50RS485_in_buff[IN_BUFF_SIZE];
|
||||
static uint8_t LORA_in_buff[IN_BUFF_SIZE];
|
||||
static uint8_t LORA_in_buff[1];
|
||||
static uint8_t Upward_in_buff[IN_BUFF_SIZE];
|
||||
//uint8_t J1RS485_in_buff[IN_BUFF_SIZE];
|
||||
//uint8_t J2RS485_in_buff[IN_BUFF_SIZE];
|
||||
|
@ -233,8 +233,8 @@ void uart_init(uart_device_info *uart_device, int baud)
|
|||
}
|
||||
} else if (uart_device->uart_index == UART5) {
|
||||
Upward_UART5_Init(baud);
|
||||
} else if (uart_device->uart_index == UART4) {
|
||||
LORA_UART4_Init(baud);
|
||||
// } else if (uart_device->uart_index == UART4) {
|
||||
// LORA_UART4_Init(baud);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
69
User/start.c
69
User/start.c
|
@ -22,10 +22,13 @@ void hareware_init()
|
|||
android_PowerCtrl_Init();
|
||||
android_PowerKey_Init();
|
||||
|
||||
// android_PowerKey_Rest();
|
||||
// rt_kprintf("\nandroid_PowerKey_Rest OK\n");
|
||||
android_PowerKey_Rest();
|
||||
rt_kprintf("\nandroid_PowerKey_Rest OK\n");
|
||||
|
||||
J4_PWR_Open();
|
||||
|
||||
// while (1) {
|
||||
//
|
||||
// };
|
||||
// SPI_Flash_TEST();
|
||||
}
|
||||
|
||||
|
@ -42,10 +45,10 @@ void software_init()
|
|||
Recv_thread_Init();
|
||||
Send_thread_Init();
|
||||
|
||||
// while (1) {
|
||||
//// uart_dev_write(g_J4RS485_UART8_handle, "hello world\n", sizeof("hello world\n"));
|
||||
// rt_thread_delay(1000);
|
||||
// }
|
||||
while (1) {
|
||||
// uart_dev_write(g_J4RS485_UART8_handle, "hello world\n", sizeof("hello world\n"));
|
||||
rt_thread_delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -56,8 +59,56 @@ void software_init()
|
|||
*/
|
||||
void app_star()
|
||||
{
|
||||
hareware_init();
|
||||
software_init();
|
||||
// hareware_init();
|
||||
// software_init();
|
||||
|
||||
android_PowerCtrl_Init();
|
||||
android_PowerKey_Init();
|
||||
android_PowerKey_Rest();
|
||||
rt_kprintf("\nandroid_PowerKey_Rest OK\n");
|
||||
|
||||
uart_all_dev_init();
|
||||
Send_mq_Init();
|
||||
Recv_thread_Init();
|
||||
Send_thread_Init();
|
||||
|
||||
J1_485_Init(9600);
|
||||
J1_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
J2_485_Init(9600);
|
||||
J2_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
J3_485_Init(9600);
|
||||
J3_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
J4_485_Init(9600);
|
||||
J4_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
|
||||
J5_0_485_Init(9600);
|
||||
J5_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
J6_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
J7_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
J8_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
J9_PWR_Open();
|
||||
rt_thread_mdelay(5000);
|
||||
|
||||
while (1) {
|
||||
// uart_dev_write(g_J4RS485_UART8_handle, "hello world\n", sizeof("hello world\n"));
|
||||
rt_thread_delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
15028
obj/CH32V303_V0.1.lst
15028
obj/CH32V303_V0.1.lst
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
obj/User/start.o
BIN
obj/User/start.o
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue