Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power down guide #34

Open
kammce opened this issue Jun 24, 2024 · 0 comments
Open

Power down guide #34

kammce opened this issue Jun 24, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@kammce
Copy link
Member

kammce commented Jun 24, 2024

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.

@kammce kammce added the documentation Improvements or additions to documentation label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant