Skip to content

Latest commit

 

History

History
105 lines (70 loc) · 5.2 KB

File metadata and controls

105 lines (70 loc) · 5.2 KB

Summary

Members Descriptions
class LowPower Provides functions for managing power and implementing sleep modes on an Arduino device.

class LowPower

Provides functions for managing power and implementing sleep modes on an Arduino device.

This class allows the user to put the device into different low-power states and configure wake-up sources such as external pins or timers.

Summary

Members Descriptions
LowPower Constructor for LowPower class. Initializes the low power and sleep configurations.
sleep Puts the device into a standard sleep mode. This sleep mode consumes less power than the active mode but more than the deep sleep mode. The device will resume execution from the point where it entered the sleep mode.
deepSleep Puts the device into a deep sleep mode. The device consumes the least power in this mode but will reset when it wakes up effectively running the setup() function again.
enableWakeupFromPin Enables wake-up of the device from a specified pin (A0, A1, A2, A3, A4, A5, D4, D7 )
setWakeUpAlarm Enables wake-up of the device based on the Real-Time Clock (RTC). The device will wake up at the specified time.
setWakeUpAlarm Enables wake-up of the device based on the Real-Time Clock (RTC). The device will wake up at the specified time.

Members

LowPower

LowPower()

Constructor for LowPower class. Initializes the low power and sleep configurations.


sleep

void sleep()

Puts the device into a standard sleep mode. This sleep mode consumes less power than the active mode but more than the deep sleep mode. The device will resume execution from the point where it entered the sleep mode.


deepSleep

void deepSleep()

Puts the device into a deep sleep mode. The device consumes the least power in this mode but will reset when it wakes up effectively running the setup() function again.


enableWakeupFromPin

bool enableWakeupFromPin(uint8_t pin, PinStatus direction)

Enables wake-up of the device from a specified pin (A0, A1, A2, A3, A4, A5, D4, D7 )

Parameters

  • pin The pin number used for waking up the device.

  • direction The direction of the interrupt that will wake up the device. (RISING, FALLING, CHANGE)


setWakeUpAlarm

bool setWakeUpAlarm(RTCTime alarmTime, void(*)() callbackFunction, RTClock * rtc)

Enables wake-up of the device based on the Real-Time Clock (RTC). The device will wake up at the specified time.

Parameters

  • alarmTime The time at which the device will wake up.

  • callbackFunction The function to be called when the device wakes up. Specifying it only makes sense when used with sleep() and not deepSleep() as the device will reset when it wakes up from deep sleep.

  • rtc The Real-Time Clock (RTC) to be used for setting the wake-up alarm. If not specified, the default RTC will be used.

Returns

True if the wake-up alarm was set successfully, false otherwise.


setWakeUpAlarm

bool setWakeUpAlarm(uint8_t hours, uint8_t minutes, uint8_t seconds, void(*)() callbackFunction, RTClock * rtc)

Enables wake-up of the device based on the Real-Time Clock (RTC). The device will wake up at the specified time.

Parameters

  • hours The hour at which the device will wake up.

  • minutes The minute at which the device will wake up.

  • seconds The second at which the device will wake up.

  • callbackFunction The function to be called when the device wakes up. Specifying it only makes sense when used with sleep() and not deepSleep() as the device will reset when it wakes up from deep sleep.

  • rtc The Real-Time Clock (RTC) to be used for setting the wake-up alarm. If not specified, the default RTC will be used.

Returns

True if the wake-up alarm was set successfully, false otherwise.