PMUClass Class

PMUClass Class

Description
A class used for reducing power consumption.

Syntax
class PMUClass

Members

Public Constructors 
PMUClass::PMUClassConstructs a PMUClass object.
Public Methods 
PMUClass::beginInitialize the PMUClass and select sleep mode as Deep Sleep mode or Tickless mode.
PMUClass::AONTimerDurationSet the duration of always-on (AON) Timer.
PMUClass::AONTimerCmdDisable the AON Timer.
PMUClass::RTCWakeSetupSet up RTC Timer for power save usage.
PMUClass::enableEnable power save Deep Sleep mode.
PMUClass::AONWakeReasonGet the source that awakens AON.
PMUClass::WakePinCheckCheck for AON GPIO wake pin index that are used as wake up source.
PMUClass::AONWakeClearClear all the AON wakeup source.
PMUClass::DsleepWakeStatusGetGet deep sleep mode status.
PMUClass::TL_sysactive_timeSet the system active time for tickless mode.
PMUClass::TL_wakelockSet tickless mode wakelock.
PMUClass::DS_AON_TIMER_WAKEUPAON timer set as the wake-up source for Deep Sleep Mode.
PMUClass::DS_RTC_WAKEUPRTC timer is set as the wake-up source for Deep Sleep Mode.
PMUClass::TL_UART_WAKEUPLOGUART is set as the wake-up source for Tickless Mode.
PMUClass::TL_RTC_WAKEUPRTC timer is set as the wake-up source for Tickless Mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA12AON GPIO pin 12 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA13AON GPIO pin 13 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA14AON GPIO pin 14 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA15AON GPIO pin 15 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA16AON GPIO pin 16 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA17AON GPIO pin 17 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA18AON GPIO pin 18 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA19AON GPIO pin 19 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA20AON GPIO pin 20 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA21AON GPIO pin 21 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA25AON GPIO pin 25 is set as the wake-up source for Deep Sleep mode.
PMUClass::AON_WAKEPIN_WAKEUP_GPIOA26AON GPIO pin 26 is set as the wake-up source for Deep Sleep mode.

PMUClass::PMUClass

Description
Constructs a PMUClass object.

Syntax
PMUClass(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::begin

Description
Initialize the PMUClass and select sleep mode as Deep Sleep mode or Tickless mode.

Syntax
void begin (uint32_t sleep_mode);

Parameters
sleep_mode: “11” indicates Deep Sleep Mode, “22” indicates Tickless Mode.

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AONTimerDuration

Description
Set the duration of Always ON (AON) Timer.

Syntax
void AONTimerDuration(uint32_t duration_ms);

Parameters
duration_ms: Set Always ON timer duration (in ms), acceptable range between 0 – 32,760,000ms.

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AONTimerCmd

Description
Disable the AON timer.

Syntax
void AONTimerCmd(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::RTCWakeSetup

Description
Set up a RTC timer for power usage.

Syntax
void RTCWakeSetup(uint32_t duration_d, uint32_t duration_h, uint32_t duration_m, uint32_t duration_s);

Parameters
duration_d: set the duration in days. Minimum valid value from 0. Valid value must be 0 or greater than 0.
duration_h: set the duration in hours. Minimum valid value from 0. Valid value must be 0 or greater than 0.
duration_m: set the duration in minutes. Minimum valid value from 0. Valid value must be 0 or greater than 0.
duration_s: set the duration in seconds. Minimum valid value from 0. Valid value must be 0 or greater than 0.

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::enable

Description
Enable power save deep sleep mode.

Syntax
void enable(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AONWakeReason

Description
Get the source that awakens AON. There are a total of 3 sources, using AON GPIO, RTC timer and AON timer.

Syntax
uint32_t AONWakeReason(void);

Parameters
NA

Returns
This function returns the wake-up source represented as an integer value.
– “1111”: wake by AON timer
– “2222”: wake by RTC timer
– “3333”: wake by AON GPIO pin
– “0”: NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::WakePinCheck

Description
Check for AON GPIO pins that are used as wake up source.

Syntax
int WakePinCheck(void);

Parameters
NA

Returns
This function returns the GPIO wake pin number used on Ameba boards.
– “1“: BIT(0): wakepin0
– “2“: BIT(1): wakepin1
– “4“: BIT(2): wakepin2
– “8“: BIT(3): wakepin3
– “0”: NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AONWakeClear

Description
Clear all AON Wakeup source.

Syntax
void AONWakeClear(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::DsleepWakeStatusGet

Description
Get Deep Sleep mode status, check if Deep Sleep mode is set.

Syntax
bool DsleepWakeStatusGet(void);

Parameters
NA

Returns
This function returns “true” when Deep Sleep mode is entered. Otherwise, return “false”.

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::TL_sysactive_time

Description
Set the system active time for tickless mode.

Syntax
void TL_sysactive_time(uint32_t duration_ms);

Parameters
duration_ms: Set the duration of system active time (in ms).

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::TL_wakelock

Description
Set tickless mode wakelock.

Syntax
void TL_wakelock(uint32_t select_lock);

Parameters
select_lock:
– “1”: acquire to avoid KM4 from entering the Deep Sleep mode.
– “0”: release and allow KM4 to enter the Deep Sleep mode.

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::DS_AON_TIMER_WAKEUP

Description
AON timer is set as the wake-up source for Deep Sleep Mode. “Set Deepsleep wakeup AON timer.” will be printed on Serial Monitor when this function is called.

Syntax
void DS_AON_TIMER_WAKEUP(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::DS_RTC_WAKEUP

Description
RTC timer is set as the wake-up source for Deep Sleep Mode. “Set Deepsleep wakeup RTC.” will be printed on Serial Monitor when this function is called.

Syntax
void DS_RTC_WAKEUP(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::TL_UART_WAKEUP

Description
LOGUART is set as the wake-up source for Tickless Mode. “Set Tickless wakeup LOGUART.” will be printed on Serial Monitor when this function is called.

Syntax
void TL_UART_WAKEUP(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::TL_RTC_WAKEUP

Description
RTC timer is set as the wake-up source for Tickless Mode. “Set Tickless wakeup RTC.” will be printed on Serial Monitor when this function is called.

Syntax
void TL_RTC_WAKEUP(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA12

Description
AON GPIO pin 12 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA12.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA12(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA13

Description
AON GPIO pin 13 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA13.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA13(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA14

Description
AON GPIO pin 14 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA14.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA14(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA15

Description
AON GPIO pin 15 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA15.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA15(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA16

Description
AON GPIO pin 16 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA16.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA16(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA17

Description
AON GPIO pin 17 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA17.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA17(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA18

Description
AON GPIO pin 18 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA18.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA18(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA19

Description
AON GPIO pin 19 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA19.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA19(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA20

Description
AON GPIO pin 20 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA20.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA20(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA21

Description
AON GPIO pin 21 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA21.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA21(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA25

Description
AON GPIO pin 25 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA25.” will be printed on Serial Monitor when this function is called.

Syntax
void AON_WAKEPIN_WAKEUP_GPIOA25(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

PMUClass::AON_WAKEPIN_WAKEUP_GPIOA26

Description
AON GPIO pin 26 is set as the wake-up source for Deep Sleep mode. “Set Deepsleep wakeup AON pin GPIOA26.” will be printed on Serial Monitor when this function is called.

Syntax
void PMUClass::AON_WAKEPIN_WAKEUP_GPIOA26(void);

Parameters
NA

Returns
NA

Example Code
Example: DeepSleep_DHT_Eink_Example
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/PowerSave/examples/DeepSleep_DHT_Eink_Example/DeepSleep_DHT_Eink_Example.ino)

Notes and Warnings
“PMUClass.h” must be included to use the class function.

请先确认已安装QQ通讯软体