Skip to content

Commit

Permalink
STM32WL: fix MBED_CONF_STM32WL_LORA_DRIVER_SLEEP_MODE option
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromecoutant committed Aug 18, 2022
1 parent b482f2d commit 1bf8667
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-3-Clause
#include "ThisThread.h"
#include "Timer.h"
#include "STM32WL_LoRaRadio.h"
#include "mbed_wait_api.h"

#ifndef DEBUG_STDIO
#define DEBUG_STDIO 0
Expand Down Expand Up @@ -728,18 +729,18 @@ void STM32WL_LoRaRadio::wakeup()
void STM32WL_LoRaRadio::sleep(void)
{
DEBUG_PRINTF("STM32WL_LoRaRadio::sleep\n");
#if MBED_CONF_STM32WL_LORA_DRIVER_SLEEP_MODE == 1
// cold start, power consumption 160 nA
sleep_state = 0x00;
#endif

/* switch the antenna OFF by SW */
set_antenna_switch(RBI_SWITCH_OFF);
Radio_SMPS_Set(SMPS_DRIVE_SETTING_DEFAULT);


#if MBED_CONF_STM32WL_LORA_DRIVER_SLEEP_MODE == 1
// cold start, power consumption 160 nA
uint8_t sleep_state = 0x00;
#else
// warm start set , power consumption 600 nA
uint8_t sleep_state = 0x04;
#endif
write_opmode_command(RADIO_SET_SLEEP, &sleep_state, 1);

_operating_mode = MODE_SLEEP;
Expand Down

0 comments on commit 1bf8667

Please sign in to comment.