add heartbeatEvent and RFAC process

This commit is contained in:
Yunhorn 2023-10-15 21:00:03 +08:00
parent 96793a53df
commit 764eed4584
1 changed files with 29 additions and 3 deletions

View File

@ -54,9 +54,9 @@ volatile uint8_t sts_ac_code[YUNHORN_STS_AC_CODE_SIZE]={0x0};
volatile uint8_t heart_beat_timer=0, sts_lorawan_joined=0; volatile uint8_t heart_beat_timer=0, sts_lorawan_joined=0;
volatile sts_cfg_nvm_t sts_cfg_nvm={sts_mtmcode1,sts_mtmcode2, sts_version, sts_hardware_ver, volatile sts_cfg_nvm_t sts_cfg_nvm={sts_mtmcode1,sts_mtmcode2, sts_version, sts_hardware_ver,
0x00,'M', 0x05,'M', 0x04,0x00,0x00,0x20, 0x00,'M', 0x05,'M', 0x04,0x00,0x00,0x20,
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, {0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
0x01,0x03,0x00,0x02, 0x01,0x03,0x00,0x02,
{0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0} {0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF}
}; };
volatile uint32_t SamplingPeriodicity = 1000; //unit ms volatile uint32_t SamplingPeriodicity = 1000; //unit ms
volatile uint32_t HeartBeatPeriodicity = 120000; //unit ms volatile uint32_t HeartBeatPeriodicity = 120000; //unit ms
@ -254,6 +254,31 @@ static void OnRxTimerLedEvent(void *context);
*/ */
static void OnJoinTimerLedEvent(void *context); static void OnJoinTimerLedEvent(void *context);
/**
* @brief Yunhorn STS Heart Beat Periodicity Chagne function
* @param duration of periodicty in ms (1/1000 sec)
*/
static void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity);
/**
* @brief Yunhorn STS Heart Beat callback function
* @param context ptr of STS Sampling Check context
*/
static void OnYunhornSTSHeartBeatTimerEvent(void *context);
/**
* @brief Yunhorn STS Uploading Message periodically
* @param context ptr of context
*/
//static void OnYunhornSTSUploadingMessageEvent(void *context);
/**
* @brief Yunhorn RFAC Handle process
* @param void
*/
static void STS_YUNHORN_RFAC_HANDLE_PROCESS(void);
/* USER CODE END PFP */ /* USER CODE END PFP */
/* Private variables ---------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/
@ -462,7 +487,8 @@ void LoRaWAN_Init(void)
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
STS_REBOOT_CONFIG_Init(); STS_REBOOT_CONFIG_Init();
UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, HeartBeatPeriodicity, UTIL_TIMER_ONESHOT, OnYunhornSTSHeartBeatTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
/* USER CODE END LoRaWAN_Init_Last */ /* USER CODE END LoRaWAN_Init_Last */
} }