123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- #include "main.h"
- #include "sram.h"
- #include "nandflash.h"
- #include "usart.h"
- #include "malloc.h"
- #include "demo_nand_fatfs.h"
- #include "cjson.h"
- #include "delay.h"
- #include "string.h"
- #include "led.h"
- #include "log.h"
- #include "task.h"
- #include "myfile.h"
- //设置任务优先级
- #define START_TASK_PRIO 10 //开始任务的优先级设置为最低
- //设置任务堆栈大小
- #define START_STK_SIZE 128
- //任务堆栈
- OS_STK START_TASK_STK[START_STK_SIZE];
- //任务函数
- void start_task(void *pdata);
-
- //LED任务
- //设置任务优先级
- #define LED_TASK_PRIO 9
- //设置任务堆栈大小
- #define LED_STK_SIZE 64
- //任务堆栈
- OS_STK LED_TASK_STK[LED_STK_SIZE];
- //任务函数
- void led_task(void *pdata);
-
- //网络状态灯任务
- #define NET_STATUS_LED_TASK_PRIO 8
- //设置任务堆栈大小
- #define NET_STATUS_LED_STK_SIZE 64
- //任务堆栈
- OS_STK NET_STATUS_LED_TASK_STK[NET_STATUS_LED_STK_SIZE];
- //任务函数
- void net_status_led_task(void *pdata);
- OS_STK DATA_TASK_STK[DATA_STK_SIZE];
- void NVIC_Configuration(void);
- int main(void)
- {
- delay_init();
- NVIC_Configuration();
- NAND_Init();
- USART_232_config();
- LED_GPIO_Config();
- NET_STATUS_LED_Config();
- /*
- char *lora_test_json=malloc(15*1024);
- lora_test_json="{\"deviceId\":\"D4AD20641630\",\"nodeList\":[\"00122B9D\",\"00122BAF\"],\"codeRate\":4700,\"pollTime\":2000,\"inboundTime\":6000,\"bandwidth\":250,\"dataRate\":7,\"power\":22,\"preambleLen\":0,\"messageTopic\":\"/device/D4AD20641630\",\"port\":1883,\"host\":\"36.134.23.11\",\"commandTopic\":\"/device/D4AD20641630/command\",\"read_00122BAF\":[{\"registerByteNum\":0,\"identifier\":\"electric_fr\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"pActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"rActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"activePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_fra\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_frb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_frc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"Ua\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"Ub\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"Uc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"Ia\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"Ib\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"Ic\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"reactivePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"powerFactor\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"innerTemp\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"lastMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"lastTwoMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"totalPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"lastPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":0,\"deviceId\":\"209220000004\"},{\"registerByteNum\":0,\"identifier\":\"electric_fr\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"pActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"rActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"activePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_fra\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_frb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_frc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"Ua\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"Ub\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"Uc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"Ia\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"Ib\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"Ic\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"reactivePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"powerFactor\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"innerTemp\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"lastMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"lastTwoMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"totalPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000003\"},{\"registerByteNum\":0,\"identifier\":\"lastPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":0,\"deviceId\":\"209220000003\"}],\"read_00122B9D\":[{\"registerByteNum\":0,\"identifier\":\"electric_fr\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"pActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"rActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"activePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_fra\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_frb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_frc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"Ua\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"Ub\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"Uc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"Ia\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"Ib\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"Ic\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"reactivePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"powerFactor\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"innerTemp\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"lastMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"lastTwoMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"totalPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"lastPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":0,\"deviceId\":\"209320056717\"},{\"registerByteNum\":0,\"identifier\":\"electric_fr\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"pActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"rActiveEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"activePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_fra\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_frb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_frc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"Ua\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"Ub\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"Uc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"Ia\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"Ib\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"Ic\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"reactivePower\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_pqc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"powerFactor\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfa\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfb\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"electric_pfc\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":3,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"innerTemp\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":1,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"lastMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"lastTwoMonthEnergy\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":2,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"totalPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":4,\"deviceId\":\"209220000002\"},{\"registerByteNum\":0,\"identifier\":\"lastPostMaximum\",\"rFunctionCode\":0,\"registerAddress\":0,\"bigLittleFormat\":1,\"precise\":0,\"deviceId\":\"209220000002\"}]}\r\n\0";
- write_file("lora_json.txt",lora_test_json,strlen(lora_test_json));
- free(lora_test_json);
- */
- //ucos初始化
- OSInit();
- OSTaskCreate(start_task,(void*)0,(OS_STK*)&START_TASK_STK[START_STK_SIZE-1],START_TASK_PRIO);
- OSStart();
-
- /* Infinite loop */
- while (1)
- {
-
- }
-
- }
- void start_task(void *pdata)
- {
- OS_CPU_SR cpu_sr;
- pdata = pdata ;
- OSStatInit(); //初始化统计任务
- OS_ENTER_CRITICAL(); //关中断
- #if LWIP_DHCP
- lwip_comm_dhcp_creat(); //创建DHCP任务
- OSTimeDlyHMSM(0,0,2,500);
- #endif
- OSTaskCreate(led_task,(void*)0,(OS_STK*)&LED_TASK_STK[LED_STK_SIZE-1],LED_TASK_PRIO);//创建LED任务
- OSTaskCreate(net_status_led_task,(void*)0,(OS_STK*)&NET_STATUS_LED_TASK_STK[NET_STATUS_LED_STK_SIZE-1],NET_STATUS_LED_TASK_PRIO);//创建LED任务
-
- OSTaskCreate(data_task,(void*)0,(OS_STK*)&DATA_TASK_STK[DATA_STK_SIZE-1],DATA_TASK_PRIO);
-
- OSTaskSuspend(OS_PRIO_SELF); //挂起start_task任务
- OS_EXIT_CRITICAL(); //开中断
-
- }
- //测试任务
- void led_task(void *pdata)
- {
- OS_CPU_SR cpu_sr;
- pdata = pdata ;
- while(1)
- {
- LED(ON);
- OSTimeDlyHMSM(0,0,0,500);
- LED(OFF);
- OSTimeDlyHMSM(0,0,0,500);
- }
- }
- void net_status_led_task(void *pdata)
- {
- OS_CPU_SR cpu_sr;
- pdata = pdata ;
- while(1)
- {
- NET_STATUS_LED(ON);
- OSTimeDlyHMSM(0,0,0,500);
- NET_STATUS_LED(OFF);
- OSTimeDlyHMSM(0,0,0,500);
- }
-
- }
- void bsp_Idle(void)
- {
- /* --- 喂狗 */
- /* --- 让CPU进入休眠,由Systick定时中断唤醒或者其他中断唤醒 */
- }
- /**
- * @brief 配置嵌套向量中断控制器NVIC分组
- * @param 无
- * @retval 无
- */
- void NVIC_Configuration(void)
- {
- NVIC_InitTypeDef NVIC_InitStructure;
-
- /* 嵌套向量中断控制器组选择 */
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
-
- }
|