diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..d920b2b --- /dev/null +++ b/docs/api.md @@ -0,0 +1,129 @@ +# 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 \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000..237392c --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,17 @@ +# 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 "" +``` + +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