nRF5 SDK v17.1.0
Macros | Enumerations | Functions

Module to declare HAL Sleep API. More...

Macros

#define DAYS_TO_MS(d)   ((d) * 3600L * 24L * 1000L )
 Converts days to milliseconds.
 
#define HOURS_TO_MS(h)   ((h) * 3600L * 1000L )
 Converts hours to milliseconds.
 
#define MINS_TO_MS(m)   ((m) * 60L * 1000L )
 Converts minutes to milliseconds.
 
#define SEC_TO_MS(s)   ((s) * 1000L )
 Converts seconds to milliseconds.
 

Enumerations

enum  hal_wakeup_reason_t {
  UNKNOWN_INTERRUPT,
  RTC_CC_INTERRUPT
}
 Information, provided by the HAL, in order to explain the reason, which caused the system to wake up. More...
 

Functions

hal_wakeup_reason_t hal_sleep (uint32_t sleep_time_ms)
 Puts hardware into the sleep mode for some milliseconds. More...
 
void hal_sleep_init (void)
 Initialization of the sleep module. More...
 

Detailed Description

Module to declare HAL Sleep API.

The Sleep module implements the only hal_sleep() routine to put the hardware to the sleep mode for some milliseconds. The user can use convenient macros DAYS_TO_MS(), HOURS_TO_MS(), MINS_TO_MS(), and SEC_TO_MS() to convert different time periods into milliseconds. Please note that this module requires a call to hal_sleep_init() which is in turn called by sys_init() before using any module routines. This module is only used to implement the System Sleep interface. The hal_sleep() routine is not assumed to be used by the user explicitly.

Enumeration Type Documentation

Information, provided by the HAL, in order to explain the reason, which caused the system to wake up.

Enumerator
UNKNOWN_INTERRUPT 

HAL can't define a wake up reason

RTC_CC_INTERRUPT 

RTC interrupt was the awakening reason

Function Documentation

hal_wakeup_reason_t hal_sleep ( uint32_t  sleep_time_ms)

Puts hardware into the sleep mode for some milliseconds.

Parameters
[in]sleep_time_msTime to sleep in ms
Return values
wakeup_reasonSpecifies reason of awakening
void hal_sleep_init ( void  )

Initialization of the sleep module.


Documentation feedback | Developer Zone | Subscribe | Updated