use crate::rcc::{APB1R1};
use stm32l4::stm32l4x2::{pwr, PWR};
pub struct Pwr {
pub cr1: CR1,
pub cr2: CR2,
pub cr3: CR3,
pub cr4: CR4,
}
pub trait PwrExt {
fn constrain(self, _: &mut APB1R1) -> Pwr;
}
impl PwrExt for PWR {
fn constrain(self, apb1r1: &mut APB1R1) -> Pwr {
apb1r1.enr().modify(|_, w| w.pwren().set_bit());
Pwr {
cr1: CR1 { _0: () },
cr2: CR2 { _0: () },
cr3: CR3 { _0: () },
cr4: CR4 { _0: () },
}
}
}
pub struct CR1 {
_0: (),
}
impl CR1 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR1 {
unsafe { &(*PWR::ptr()).cr1 }
}
}
pub struct CR2 {
_0: (),
}
impl CR2 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR2 {
unsafe { &(*PWR::ptr()).cr2 }
}
}
pub struct CR3 {
_0: (),
}
impl CR3 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR3 {
unsafe { &(*PWR::ptr()).cr3 }
}
}
pub struct CR4 {
_0: (),
}
impl CR4 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR4 {
unsafe { &(*PWR::ptr()).cr4 }
}
}