1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/lorawan: move enabling of sleep modes to C code

This commit is contained in:
Benjamin Valentin 2022-04-02 21:01:42 +02:00
parent 11acdd0526
commit ed9f740edd
2 changed files with 11 additions and 4 deletions

View File

@ -53,10 +53,6 @@ else ifeq (abp,$(ACTIVATION_MODE))
CFLAGS += -DUSE_ABP
endif
# Enable deep sleep power mode (e.g. STOP mode on STM32) which
# in general provides RAM retention after wake-up.
CFLAGS += -DPM_BLOCKER_INITIAL=0x00000001
# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:

View File

@ -27,6 +27,7 @@
#include "thread.h"
#include "fmt.h"
#include "periph/pm.h"
#if IS_USED(MODULE_PERIPH_RTC)
#include "periph/rtc.h"
#else
@ -148,6 +149,16 @@ int main(void)
puts("LoRaWAN Class A low-power application");
puts("=====================================");
/*
* Enable deep sleep power mode (e.g. STOP mode on STM32) which
* in general provides RAM retention after wake-up.
*/
#if IS_USED(MODULE_PM_LAYERED)
for (unsigned i = 1; i < PM_NUM_MODES; ++i) {
pm_unblock(i);
}
#endif
/* Initialize the radio driver */
#if IS_USED(MODULE_SX127X)
sx127x_setup(&sx127x, &sx127x_params[0], 0);