#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::CFGR {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = r" Value of the field"]
pub struct SWR {
bits: u8,
}
impl SWR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct SWSR {
bits: u8,
}
impl SWSR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct STOPWUCKR {
bits: bool,
}
impl STOPWUCKR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r" Value of the field"]
pub struct STOPKERWUCKR {
bits: bool,
}
impl STOPKERWUCKR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r" Value of the field"]
pub struct RTCPRER {
bits: u8,
}
impl RTCPRER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct HRTIMSELR {
bits: bool,
}
impl HRTIMSELR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r" Value of the field"]
pub struct TIMPRER {
bits: bool,
}
impl TIMPRER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r" Value of the field"]
pub struct MCO1PRER {
bits: u8,
}
impl MCO1PRER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct MCO1SELR {
bits: u8,
}
impl MCO1SELR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct MCO2PRER {
bits: u8,
}
impl MCO2PRER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct MCO2SELR {
bits: u8,
}
impl MCO2SELR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Proxy"]
pub struct _SWW<'a> {
w: &'a mut W,
}
impl<'a> _SWW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _SWSW<'a> {
w: &'a mut W,
}
impl<'a> _SWSW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 3;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _STOPWUCKW<'a> {
w: &'a mut W,
}
impl<'a> _STOPWUCKW<'a> {
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 6;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _STOPKERWUCKW<'a> {
w: &'a mut W,
}
impl<'a> _STOPKERWUCKW<'a> {
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 7;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _RTCPREW<'a> {
w: &'a mut W,
}
impl<'a> _RTCPREW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 63;
const OFFSET: u8 = 8;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _HRTIMSELW<'a> {
w: &'a mut W,
}
impl<'a> _HRTIMSELW<'a> {
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 14;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _TIMPREW<'a> {
w: &'a mut W,
}
impl<'a> _TIMPREW<'a> {
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 15;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _MCO1PREW<'a> {
w: &'a mut W,
}
impl<'a> _MCO1PREW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 15;
const OFFSET: u8 = 18;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _MCO1SELW<'a> {
w: &'a mut W,
}
impl<'a> _MCO1SELW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 22;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _MCO2PREW<'a> {
w: &'a mut W,
}
impl<'a> _MCO2PREW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 15;
const OFFSET: u8 = 25;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _MCO2SELW<'a> {
w: &'a mut W,
}
impl<'a> _MCO2SELW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 29;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:2 - System clock switch"]
#[inline]
pub fn sw(&self) -> SWR {
let bits = {
const MASK: u8 = 7;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u8
};
SWR { bits }
}
#[doc = "Bits 3:5 - System clock switch status"]
#[inline]
pub fn sws(&self) -> SWSR {
let bits = {
const MASK: u8 = 7;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u32) as u8
};
SWSR { bits }
}
#[doc = "Bit 6 - System clock selection after a wake up from system Stop"]
#[inline]
pub fn stopwuck(&self) -> STOPWUCKR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 6;
((self.bits >> OFFSET) & MASK as u32) != 0
};
STOPWUCKR { bits }
}
#[doc = "Bit 7 - Kernel clock selection after a wake up from system Stop"]
#[inline]
pub fn stopkerwuck(&self) -> STOPKERWUCKR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 7;
((self.bits >> OFFSET) & MASK as u32) != 0
};
STOPKERWUCKR { bits }
}
#[doc = "Bits 8:13 - HSE division factor for RTC clock"]
#[inline]
pub fn rtcpre(&self) -> RTCPRER {
let bits = {
const MASK: u8 = 63;
const OFFSET: u8 = 8;
((self.bits >> OFFSET) & MASK as u32) as u8
};
RTCPRER { bits }
}
#[doc = "Bit 14 - High Resolution Timer clock prescaler selection"]
#[inline]
pub fn hrtimsel(&self) -> HRTIMSELR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 14;
((self.bits >> OFFSET) & MASK as u32) != 0
};
HRTIMSELR { bits }
}
#[doc = "Bit 15 - Timers clocks prescaler selection"]
#[inline]
pub fn timpre(&self) -> TIMPRER {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 15;
((self.bits >> OFFSET) & MASK as u32) != 0
};
TIMPRER { bits }
}
#[doc = "Bits 18:21 - MCO1 prescaler"]
#[inline]
pub fn mco1pre(&self) -> MCO1PRER {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 18;
((self.bits >> OFFSET) & MASK as u32) as u8
};
MCO1PRER { bits }
}
#[doc = "Bits 22:24 - Micro-controller clock output 1"]
#[inline]
pub fn mco1sel(&self) -> MCO1SELR {
let bits = {
const MASK: u8 = 7;
const OFFSET: u8 = 22;
((self.bits >> OFFSET) & MASK as u32) as u8
};
MCO1SELR { bits }
}
#[doc = "Bits 25:28 - MCO2 prescaler"]
#[inline]
pub fn mco2pre(&self) -> MCO2PRER {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 25;
((self.bits >> OFFSET) & MASK as u32) as u8
};
MCO2PRER { bits }
}
#[doc = "Bits 29:31 - Micro-controller clock output 2"]
#[inline]
pub fn mco2sel(&self) -> MCO2SELR {
let bits = {
const MASK: u8 = 7;
const OFFSET: u8 = 29;
((self.bits >> OFFSET) & MASK as u32) as u8
};
MCO2SELR { bits }
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:2 - System clock switch"]
#[inline]
pub fn sw(&mut self) -> _SWW {
_SWW { w: self }
}
#[doc = "Bits 3:5 - System clock switch status"]
#[inline]
pub fn sws(&mut self) -> _SWSW {
_SWSW { w: self }
}
#[doc = "Bit 6 - System clock selection after a wake up from system Stop"]
#[inline]
pub fn stopwuck(&mut self) -> _STOPWUCKW {
_STOPWUCKW { w: self }
}
#[doc = "Bit 7 - Kernel clock selection after a wake up from system Stop"]
#[inline]
pub fn stopkerwuck(&mut self) -> _STOPKERWUCKW {
_STOPKERWUCKW { w: self }
}
#[doc = "Bits 8:13 - HSE division factor for RTC clock"]
#[inline]
pub fn rtcpre(&mut self) -> _RTCPREW {
_RTCPREW { w: self }
}
#[doc = "Bit 14 - High Resolution Timer clock prescaler selection"]
#[inline]
pub fn hrtimsel(&mut self) -> _HRTIMSELW {
_HRTIMSELW { w: self }
}
#[doc = "Bit 15 - Timers clocks prescaler selection"]
#[inline]
pub fn timpre(&mut self) -> _TIMPREW {
_TIMPREW { w: self }
}
#[doc = "Bits 18:21 - MCO1 prescaler"]
#[inline]
pub fn mco1pre(&mut self) -> _MCO1PREW {
_MCO1PREW { w: self }
}
#[doc = "Bits 22:24 - Micro-controller clock output 1"]
#[inline]
pub fn mco1sel(&mut self) -> _MCO1SELW {
_MCO1SELW { w: self }
}
#[doc = "Bits 25:28 - MCO2 prescaler"]
#[inline]
pub fn mco2pre(&mut self) -> _MCO2PREW {
_MCO2PREW { w: self }
}
#[doc = "Bits 29:31 - Micro-controller clock output 2"]
#[inline]
pub fn mco2sel(&mut self) -> _MCO2SELW {
_MCO2SELW { w: self }
}
}