summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pwr/stm32_pwr.h7
1 files changed, 7 insertions, 0 deletions
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 <typename T>
class STM32_PWR_t : public mmio_ptr<T> {
public:
using mmio_ptr<T>::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?