MiraOS deep sleep functions. More...
#include "sys/process.h"
Go to the source code of this file.
Macros | |
#define | mira_deep_sleep(sleep_time) |
Go to deep sleep for a certain amount of time. More... | |
#define | mira_sleepy_node_poll_firmware(firmware_image_id) |
Polls for new firmware, and install if available. More... | |
Functions | |
void | mira_prepare_sleep (uint16_t sleep_time) |
Prepare for sleep. More... | |
void | mira_restore_from_sleep (void) |
Restore from sleep. More... | |
void | mira_wake_up_process (void) |
Wake up the thread that went to deep sleep. More... | |
void | mira_sleepy_node_poll_for_fw (uint16_t firmware_image_id) |
Polls neighbors for new firmware. More... | |
uint8_t | mira_sleepy_node_poll_done (void) |
Checks if firmware polling is done. More... | |
Variables | |
process_event_t | mira_wake_up_event |
Event that gets sent to wake up the sleeping thread. | |
MiraOS deep sleep functions.
#define mira_deep_sleep | ( | sleep_time | ) |
Go to deep sleep for a certain amount of time.
To use any deep sleep functions, the section .nrdata shall be linked to the lower 16kB of RAM, all other variable section shall be linked to upper 16kB of RAM.
sleep_time | the time to sleep in seconds |
#define mira_sleepy_node_poll_firmware | ( | firmware_image_id | ) |
Polls for new firmware, and install if available.
This function will join the network and download available firmware and install it. The device will reboot after installation. If no new firmware is available then the network will not be joined.
void mira_prepare_sleep | ( | uint16_t | sleep_time | ) |
Prepare for sleep.
This function is not supposed to be called by the user, it's only called as part of the mira_deep_sleep macro
sleep_time | the time to sleep in seconds |
void mira_restore_from_sleep | ( | void | ) |
Restore from sleep.
This function is not supposed to be called by the user, it's only called as part of the mira_deep_sleep macro
uint8_t mira_sleepy_node_poll_done | ( | void | ) |
Checks if firmware polling is done.
This function shall only be called as part of the mira_sleepy_node_poll_firmware macro
void mira_sleepy_node_poll_for_fw | ( | uint16_t | firmware_image_id | ) |
Polls neighbors for new firmware.
This function shall only be called as part of the mira_sleepy_node_poll_firmware macro
firmware_image_id | the firmware update session id to poll for |
void mira_wake_up_process | ( | void | ) |
Wake up the thread that went to deep sleep.
This function can be called from an ISR to wake up the sleeping thread. If this is not called the CPU will still wake up, but the thread will not wake up again until the sleep timer runs out.