summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2022-01-30 17:30:46 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2022-04-16 21:37:28 +0200
commit5e3480f8ffe976aefb7bd1fe7ca2434ee0146a82 (patch)
tree0c3c34b87abf3101b319f0808aa708ab18a52e22
parent28ef4344180ddaded1142577dc5214b0f9d18f0a (diff)
WIP: stm32_pwr: LPMS helpers
-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?