Skip to content

Commit e379eaa

Browse files
committed
STM32WL: fix MBED_CONF_STM32WL_LORA_DRIVER_SLEEP_MODE option
1 parent b482f2d commit e379eaa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-3-Clause
3838
#include "ThisThread.h"
3939
#include "Timer.h"
4040
#include "STM32WL_LoRaRadio.h"
41+
#include "mbed_wait_api.h"
4142

4243
#ifndef DEBUG_STDIO
4344
#define DEBUG_STDIO 0
@@ -728,19 +729,19 @@ void STM32WL_LoRaRadio::wakeup()
728729
void STM32WL_LoRaRadio::sleep(void)
729730
{
730731
DEBUG_PRINTF("STM32WL_LoRaRadio::sleep\n");
731-
#if MBED_CONF_STM32WL_LORA_DRIVER_SLEEP_MODE == 1
732-
// cold start, power consumption 160 nA
733-
sleep_state = 0x00;
734-
#endif
735732

736733
/* switch the antenna OFF by SW */
737734
set_antenna_switch(RBI_SWITCH_OFF);
738735
Radio_SMPS_Set(SMPS_DRIVE_SETTING_DEFAULT);
739736

740-
737+
#if MBED_CONF_STM32WL_LORA_DRIVER_SLEEP_MODE == 1
738+
// cold start, power consumption 160 nA
739+
uint8_t sleep_state = 0x00;
740+
#else
741741
// warm start set , power consumption 600 nA
742742
uint8_t sleep_state = 0x04;
743743
write_opmode_command(RADIO_SET_SLEEP, &sleep_state, 1);
744+
#endif
744745

745746
_operating_mode = MODE_SLEEP;
746747
rtos::ThisThread::sleep_for(2ms);

0 commit comments

Comments
 (0)