Skip to content

File lt_sleep.h

FileList > api > lt_sleep.h

Go to the source code of this file.

  • #include <libretiny.h>

Public Functions

Type Name
void lt_deep_sleep_config_gpio (uint32_t gpio_index_map, bool on_high)
Enable GPIO Wakeup from Deep Sleep.
void lt_deep_sleep_config_timer (uint32_t sleep_duration)
Set a sleep timer to wake up the device.
void lt_deep_sleep_enter ()
Start deep sleep.
void lt_deep_sleep_keep_floating_gpio (uint32_t gpio_index_map, bool enabled)
Configure GPIO pins to be kept floating.
void lt_deep_sleep_unset_gpio (uint32_t gpio_index_map)
Disable GPIO Wakeup on given pins.

Public Functions Documentation

function lt_deep_sleep_config_gpio

Enable GPIO Wakeup from Deep Sleep.

void lt_deep_sleep_config_gpio (
    uint32_t gpio_index_map,
    bool on_high
) 

Parameters:

  • gpio_index_map bitMap of the pins we should wake up on
  • on_high whether to wake up on High or Low state

function lt_deep_sleep_config_timer

Set a sleep timer to wake up the device.

void lt_deep_sleep_config_timer (
    uint32_t sleep_duration
) 

Parameters:

  • sleep_duration the time in milliseconds to sleep

function lt_deep_sleep_enter

void lt_deep_sleep_enter () 

function lt_deep_sleep_keep_floating_gpio

Configure GPIO pins to be kept floating.

void lt_deep_sleep_keep_floating_gpio (
    uint32_t gpio_index_map,
    bool enabled
) 

This prevents pins from being configured as pullup/pulldown, based on the configured wake-up mode (low/high), upon entering deep sleep. This is important, as some-low power devices may be unable to ever overcome the internal pull strength and change the level. One example of such device is a magnetic door sensor that must be able to wake on level change in both directions.

Parameters:

  • gpio_index_map bitMap of the pins to set/unset as floating
  • enabled whether to set pins to floating or roll back to default mode

function lt_deep_sleep_unset_gpio

Disable GPIO Wakeup on given pins.

void lt_deep_sleep_unset_gpio (
    uint32_t gpio_index_map
) 

Parameters:

  • gpio_index_map bitMap of the pins we should disable wake up on

The documentation for this class was generated from the following file cores/common/base/api/lt_sleep.h