lpc8xx-hal icon indicating copy to clipboard operation
lpc8xx-hal copied to clipboard

Improve API for switching to low-power modes

Open hannobraun opened this issue 7 years ago • 3 comments

The current Pmu API only support switching to sleep mode. All other low-power modes should be supported as well.

I think there's also some potential for embedded-hal here. I'd like to expore the possibility of creating a trait, PowerMode, and implementing this trait for each supported power mode.

That trait could live in embedded-hal. The sleep module could be updated to depend on PowerMode instead of depending on Pmu directly.

hannobraun avatar Nov 27 '17 07:11 hannobraun

~There's a problem with LowPowerClock: It starts with clock::state::Disabled, but that may be wrong, as we can't know what happened before the HAL was initialized.~

~I'm not sure if that leads to any actual problems, but it's at the very least misleading. Maybe it would be best to add a third clock state, Unknown, and start with that.~

Edit: This comment has been resolved in the meantime.

hannobraun avatar Feb 19 '18 04:02 hannobraun

I've added support for additional low-power modes in #106.

hannobraun avatar Jun 12 '18 04:06 hannobraun

Before trying to design anything that can be submitted to embedded-hal, at least #108, #109, and #110 should be resolved.

hannobraun avatar Jun 15 '18 06:06 hannobraun