|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
Application of the LRWAN Middleware. More...
#include "platform.h"#include "sys_app.h"#include "lora_app.h"#include "stm32_seq.h"#include "stm32_timer.h"#include "utilities_def.h"#include "app_version.h"#include "lorawan_version.h"#include "subghz_phy_version.h"#include "lora_info.h"#include "LmHandler.h"#include "adc_if.h"#include "CayenneLpp.h"#include "sys_sensors.h"#include "flash_if.h"#include "secure-element.h"#include "mylora_process.h"#include "mysensors_base.h"Go to the source code of this file.
Macros | |
| #define | LED_PERIOD_TIME 500 |
| #define | JOIN_TIME 2000 |
| #define | LORAWAN_NVM_BASE_ADDRESS ((void *)0x0803F000UL) |
| LoRaWAN NVM Flash address. | |
Enumerations | |
| enum | TxEventType_t { TX_ON_TIMER , TX_ON_EVENT } |
| LoRa State Machine states. More... | |
Functions | |
| static void | SendTxData (void) |
| LoRa End Node send request. | |
| static void | OnTxTimerEvent (void *context) |
| TX timer callback function. | |
| static void | OnJoinRequest (LmHandlerJoinParams_t *joinParams) |
| join event callback function | |
| static void | OnTxData (LmHandlerTxParams_t *params) |
| callback when LoRaWAN application has sent a frame | |
| static void | OnRxData (LmHandlerAppData_t *appData, LmHandlerRxParams_t *params) |
| callback when LoRaWAN application has received a frame | |
| static void | OnBeaconStatusChange (LmHandlerBeaconParams_t *params) |
| callback when LoRaWAN Beacon status is updated | |
| static void | OnSysTimeUpdate (void) |
| callback when system time has been updated | |
| static void | OnClassChange (DeviceClass_t deviceClass) |
| callback when LoRaWAN application Class is changed | |
| static void | StoreContext (void) |
| LoRa store context in Non Volatile Memory. | |
| static void | StopJoin (void) |
| stop current LoRa execution to switch into non default Activation mode | |
| static void | OnStopJoinTimerEvent (void *context) |
| Join switch timer callback function. | |
| static void | OnNvmDataChange (LmHandlerNvmContextStates_t state) |
| Notifies the upper layer that the NVM context has changed. | |
| static void | OnStoreContextRequest (void *nvm, uint32_t nvm_size) |
| Store the NVM Data context to the Flash. | |
| static void | OnRestoreContextRequest (void *nvm, uint32_t nvm_size) |
| Restore the NVM Data context from the Flash. | |
| static void | OnMacProcessNotify (void) |
| static void | OnTxPeriodicityChanged (uint32_t periodicity) |
| Change the periodicity of the uplink frames. | |
| static void | OnTxFrameCtrlChanged (LmHandlerMsgTypes_t isTxConfirmed) |
| Change the confirmation control of the uplink frames. | |
| static void | OnPingSlotPeriodicityChanged (uint8_t pingSlotPeriodicity) |
| Change the periodicity of the ping slot frames. | |
| static void | OnSystemReset (void) |
| Will be called to reset the system. | |
| void | systemParams_SetLoRaWanParams () |
| |
| void | LoRaWAN_Init (void) |
| Init Lora Application. | |
Variables | |
| static ActivationType_t | ActivationType = ACTIVATION_TYPE_OTAA |
| LoRaWAN default activation type. | |
| static bool | ForceRejoin = false |
| LoRaWAN force rejoin even if the NVM context is restored. | |
| static LmHandlerCallbacks_t | LmHandlerCallbacks |
| LoRaWAN handler Callbacks. | |
| static LmHandlerParams_t | LmHandlerParams |
| LoRaWAN handler parameters. | |
| static TxEventType_t | EventType = TX_ON_EVENT |
| Type of Event to generate application Tx. | |
| static UTIL_TIMER_Object_t | TxTimer |
| Timer to handle the application Tx. | |
| static UTIL_TIMER_Time_t | TxPeriodicity = 10000 |
| Tx Timer period. | |
| static UTIL_TIMER_Object_t | StopJoinTimer |
| Join Timer period. | |
Application of the LRWAN Middleware.
Copyright (c) 2026 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.
Definition in file lora_app.c.
| #define JOIN_TIME 2000 |
Join switch period value of the timer in ms
Definition at line 82 of file lora_app.c.
Referenced by LoRaWAN_Init().
| #define LED_PERIOD_TIME 500 |
LEDs period value of the timer in ms
Definition at line 77 of file lora_app.c.
| #define LORAWAN_NVM_BASE_ADDRESS ((void *)0x0803F000UL) |
LoRaWAN NVM Flash address.
Definition at line 91 of file lora_app.c.
Referenced by OnRestoreContextRequest(), and OnStoreContextRequest().
| enum TxEventType_t |
LoRa State Machine states.
| Enumerator | |
|---|---|
| TX_ON_TIMER | Appdata Transmission issue based on timer every TxDutyCycleTime. |
| TX_ON_EVENT | Appdata Transmission external event plugged on OnSendEvent( ). |
Definition at line 54 of file lora_app.c.
| void LoRaWAN_Init | ( | void | ) |
Init Lora Application.
< [31:24] main version
< main byte shift
< [23:16] sub1 version
< sub1 byte shift
< [15:8] sub2 version
< sub2 byte shift
< [7:0] release candidate
< release candidate byte shift
Definition at line 310 of file lora_app.c.
References ActivationType, APP_LOG, APP_VERSION, CFG_SEQ_Task_LmHandlerProcess, CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent, CFG_SEQ_Task_LoRaStopJoinEvent, CFG_SEQ_Task_LoRaStoreContextEvent, EventType, ForceRejoin, JOIN_TIME, LmHandlerCallbacks, LmHandlerParams, LoraInfo_Init(), OnStopJoinTimerEvent(), OnTxTimerEvent(), SendTxData(), StopJoin(), StopJoinTimer, StoreContext(), systemParams_getAppDevEUI(), systemParams_getAppEUI(), systemParams_getAppKey(), TS_OFF, TX_ON_TIMER, TxPeriodicity, TxTimer, and VLEVEL_M.
Referenced by main(), and MX_LoRaWAN_Init().
|
static |
callback when LoRaWAN Beacon status is updated
| params | status of Last Beacon |
Definition at line 453 of file lora_app.c.
|
static |
callback when LoRaWAN application Class is changed
| deviceClass | new class |
Definition at line 466 of file lora_app.c.
|
static |
join event callback function
| joinParams | status of join |
Definition at line 442 of file lora_app.c.
References OnLoRaWanConnected().
|
static |
Will be called each time a Radio IRQ is handled by the MAC layer
Definition at line 472 of file lora_app.c.
References CFG_SEQ_Prio_0, and CFG_SEQ_Task_LmHandlerProcess.
|
static |
Notifies the upper layer that the NVM context has changed.
| state | Indicates if we are storing (true) or restoring (false) the NVM context |
Definition at line 613 of file lora_app.c.
|
static |
Change the periodicity of the ping slot frames.
| pingSlotPeriodicity | ping slot frames period in ms |
Definition at line 517 of file lora_app.c.
References LmHandlerParams.
|
static |
Restore the NVM Data context from the Flash.
| nvm | ptr on nvm structure |
| nvm_size | number of data bytes which were restored |
Definition at line 643 of file lora_app.c.
References FLASH_IF_Read(), and LORAWAN_NVM_BASE_ADDRESS.
|
static |
callback when LoRaWAN application has received a frame
| appData | data received in the last Rx |
| params | status of last Rx |
Definition at line 401 of file lora_app.c.
References OnLoRaWANRxData().
|
static |
Join switch timer callback function.
| context | ptr of Join switch context |
Definition at line 577 of file lora_app.c.
References ActivationType, CFG_SEQ_Prio_0, CFG_SEQ_Task_LoRaStopJoinEvent, and LORAWAN_DEFAULT_ACTIVATION_TYPE.
Referenced by LoRaWAN_Init().
|
static |
Store the NVM Data context to the Flash.
| nvm | ptr on nvm structure |
| nvm_size | number of data bytes which were stored |
Definition at line 631 of file lora_app.c.
References FLASH_IF_Write(), and LORAWAN_NVM_BASE_ADDRESS.
|
static |
Will be called to reset the system.
Definition at line 528 of file lora_app.c.
|
static |
callback when system time has been updated
Definition at line 459 of file lora_app.c.
References OnTimeSynchronized().
|
static |
callback when LoRaWAN application has sent a frame
tx event callback function
| params | status of last Tx |
Definition at line 434 of file lora_app.c.
References OnLoRaWANTxData().
|
static |
Change the confirmation control of the uplink frames.
| isTxConfirmed | Indicates if the uplink requires an acknowledgement |
Definition at line 506 of file lora_app.c.
References LmHandlerParams.
|
static |
Change the periodicity of the uplink frames.
| periodicity | uplink frames period in ms |
Definition at line 484 of file lora_app.c.
References APP_TX_DUTYCYCLE, TxPeriodicity, and TxTimer.
|
static |
TX timer callback function.
| context | ptr of timer context |
Definition at line 416 of file lora_app.c.
References CFG_SEQ_Prio_0, CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent, and TxTimer.
Referenced by LoRaWAN_Init().
|
static |
LoRa End Node send request.
Definition at line 409 of file lora_app.c.
Referenced by LoRaWAN_Init().
|
static |
stop current LoRa execution to switch into non default Activation mode
Definition at line 542 of file lora_app.c.
References ActivationType, APP_LOG, LmHandlerParams, LORAWAN_DEFAULT_ACTIVATION_TYPE, StopJoinTimer, TS_OFF, TxTimer, and VLEVEL_M.
Referenced by LoRaWAN_Init().
|
static |
LoRa store context in Non Volatile Memory.
Definition at line 591 of file lora_app.c.
References APP_LOG, TS_OFF, and VLEVEL_M.
Referenced by LoRaWAN_Init().
| void systemParams_SetLoRaWanParams | ( | ) |
Definition at line 300 of file lora_app.c.
References _systemParams, and LmHandlerParams.
Referenced by main().
|
static |
LoRaWAN default activation type.
Definition at line 228 of file lora_app.c.
Referenced by LoRaWAN_Init(), OnStopJoinTimerEvent(), and StopJoin().
|
static |
Type of Event to generate application Tx.
Definition at line 278 of file lora_app.c.
Referenced by LoRaWAN_Init().
|
static |
LoRaWAN force rejoin even if the NVM context is restored.
Definition at line 233 of file lora_app.c.
Referenced by LoRaWAN_Init().
|
static |
LoRaWAN handler Callbacks.
Definition at line 238 of file lora_app.c.
Referenced by LoRaWAN_Init().
|
static |
LoRaWAN handler parameters.
Definition at line 263 of file lora_app.c.
Referenced by LoRaWAN_Init(), OnPingSlotPeriodicityChanged(), OnTxFrameCtrlChanged(), StopJoin(), and systemParams_SetLoRaWanParams().
|
static |
Join Timer period.
Definition at line 293 of file lora_app.c.
Referenced by LoRaWAN_Init(), and StopJoin().
|
static |
Tx Timer period.
Definition at line 288 of file lora_app.c.
Referenced by LoRaWAN_Init(), and OnTxPeriodicityChanged().
|
static |
Timer to handle the application Tx.
Definition at line 283 of file lora_app.c.
Referenced by LoRaWAN_Init(), OnTxPeriodicityChanged(), OnTxTimerEvent(), and StopJoin().