Skip to content

Commit

Permalink
Added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
karlsoderby committed Sep 21, 2021
1 parent 85b2a8b commit aeb7149
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 0 deletions.
135 changes: 135 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -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 "<ArduinoLowPower.h>"
```

0 comments on commit aeb7149

Please sign in to comment.