From aeb714964d1f0c4edc29449cdd4eb10d0a3e805e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 21 Sep 2021 14:51:33 +0200 Subject: [PATCH 1/2] Added docs --- docs/api.md | 135 +++++++++++++++++++++++++++++++++++++++++++++++++ docs/readme.md | 11 ++++ 2 files changed, 146 insertions(+) create mode 100644 docs/api.md create mode 100644 docs/readme.md diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..7adad27 --- /dev/null +++ b/docs/api.md @@ -0,0 +1,135 @@ +# Ardunio Low Power + +## Methods + +### `LowPower.idle()` + +#### Description + +Puts the MCU in IDLE mode. This mode allows power optimization with the fastest wake-up time. The CPU is stopped. To further reduce power consumption, the user can manually disable the clocking of modules and clock sources. + + +#### Syntax + +``` +LowPower.idle(); +LowPower.idle(milliseconds); +``` + +#### Parameters + +milliseconds: the number of milliseconds to put the board in idle mode. If void the idle mode is used till a wakeup event. + +### `LowPower.sleep()` + +#### Description + +Puts the MCU in sleep mode. The sleep mode allows power optimization with a slower wakeup time. Only the chosen peripherals are on. + + +#### Syntax + +``` +LowPower.sleep(); +LowPower.sleep(milliseconds); +``` + +#### Parameters + +milliseconds: the number of milliseconds to put the board in sleep mode. If void the sleep mode is used till a wakeup event. + +### `LowPower.deepSleep()` + +#### Description + +Puts the MCU in deep sleep mode. The deep sleep mode allows power optimization with the slowest wake-up time. All but the RTC peripherals are stopped. The CPU can be wakeup only using RTC or wakeup on interrupt capable pins. + + +#### Syntax + +``` +LowPower.deepSleep(); +LowPower.deepSleep(milliseconds); +``` + +#### Parameters + +milliseconds: the number of milliseconds to put the board in deep sleep mode. If void the deep sleep mode is used till a wakeup event. + +### `LowPower.attachInterruptWakeup()` + +#### Description + +Indicates the function to call and the conditions for a wakeup event. + + +#### Syntax + +``` +LowPower.attachInterruptWakeup(pin, callback, mode); +``` + +#### Parameters + +pin: the pin used as external wakeup + +callback: the function to call on wakeup + +mode: the transitions to sense on the indicated pin. Can be one between: + +- FALLING +- RISING +- CHANGE + +### `LowPower.CompanionLowPowerCallback()` + +#### Description + +Indicates the function that the on-boad co-processor (Tian only) has to call just before going to sleep. + + +#### Syntax + +LowPower.CompanionLowPowerCallback(callback); + +#### Parameters + +callback: the function to call before going to sleep + +### `LowPower.companionSleep()` + +#### Description + +Puts the on-board co-processor (Tian only) in sleep mode + + +#### Syntax + +LowPower.companionSleep(); + +#### Parameters + +None + +### `LowPower.companionWakeup()` + +#### Description + +Forces the on board co-processor (Tian only) wakeup from sleep mode. + + +#### Syntax + +``` +LowPower.companionWakeup(); +``` + +#### Parameters + +None + +## Examples + +- [ExternalWakeup](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/ExternalWakeup/ExternalWakeup.ino) : Demonstrates how to wake your board from an external source like a button. +- [TianStandby](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/TianStandby/TianStandby.ino) : Demonstrates how to put a Tian in standby +- [TimedWakeup](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/TimedWakeup/TimedWakeup.ino) : Demonstrates how to put in sleep your board for a certain amount of time \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000..a868ac8 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,11 @@ +# Arduino Low Power Library + +This library allows you to use the low power features of the SAMD21 MCU, which is used for all [MKR family boards](https://store.arduino.cc/collections/mkr-family) and the [Nano 33 IoT board](https://store.arduino.cc/products/arduino-nano-33-iot). + +In these pages, the term companion chip is used. This term refers to a board co-processor like the MIPS processor on the [Arduino Tian](https://docs.arduino.cc/retired/boards/arduino-tian). + +To use this library: + +``` +#include "" +``` \ No newline at end of file From fc955aeadaeb7ea766f501072d070fbf5fe21818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 21 Sep 2021 14:52:24 +0200 Subject: [PATCH 2/2] moved examples --- docs/api.md | 8 +------- docs/readme.md | 8 +++++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/api.md b/docs/api.md index 7adad27..d920b2b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -126,10 +126,4 @@ LowPower.companionWakeup(); #### Parameters -None - -## Examples - -- [ExternalWakeup](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/ExternalWakeup/ExternalWakeup.ino) : Demonstrates how to wake your board from an external source like a button. -- [TianStandby](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/TianStandby/TianStandby.ino) : Demonstrates how to put a Tian in standby -- [TimedWakeup](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/TimedWakeup/TimedWakeup.ino) : Demonstrates how to put in sleep your board for a certain amount of time \ No newline at end of file +None \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md index a868ac8..237392c 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -8,4 +8,10 @@ To use this library: ``` #include "" -``` \ No newline at end of file +``` + +Examples: + +- [ExternalWakeup](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/ExternalWakeup/ExternalWakeup.ino) : Demonstrates how to wake your board from an external source like a button. +- [TianStandby](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/TianStandby/TianStandby.ino) : Demonstrates how to put a Tian in standby +- [TimedWakeup](https://github.com/arduino-libraries/ArduinoLowPower/blob/master/examples/TimedWakeup/TimedWakeup.ino) : Demonstrates how to put in sleep your board for a certain amount of time \ No newline at end of file