From 5e3480f8ffe976aefb7bd1fe7ca2434ee0146a82 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Sun, 30 Jan 2022 16:30:46 +0000 Subject: WIP: stm32_pwr: LPMS helpers --- pwr/stm32_pwr.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pwr/stm32_pwr.h b/pwr/stm32_pwr.h index d85b027..bb46ffd 100644 --- a/pwr/stm32_pwr.h +++ b/pwr/stm32_pwr.h @@ -35,6 +35,13 @@ template class STM32_PWR_t : public mmio_ptr { public: using mmio_ptr::ptr; + + // WARNING - 3 bits on g0/g4/l4/l5/wb, 2 bits on f0/f1/f3/f4/f7/l0/l1 + // (and only _1_ bit on h7!) + void set_lpms(uint32_t level) const { + ptr()->CR1 &= ~(0x7); + ptr()->CR1 |= (level); + } }; // TODO - methods for pullup/pulldowns? -- cgit v1.2.3