Skip to content

Power down guide #34

@kammce

Description

@kammce

Explain how powering down devices and peripherals works in libhal. Specifically, power down APIs should be:

void class::power_down();

But this may be too limiting as there maybe other options for powering down the devices such as deep sleep, complete shutdown, low power mode, etc.

An important specification is that all APIs that are not powering down the device, MUST perform the work of bringing the device into a power state where the API can work successfully. This prevents the viral pattern of:

if (driver.is_powered_down()) {
  driver.power_on();
}
driver.use_api();

The issue with this pattern is that it spreads EVERYWHERE and will have to be placed before every driver api usage, when possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions