#[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::BDCR {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
self.register.set(f(&R { bits }, &mut W { bits }).bits);
}
#[doc = r"Reads the contents of the register"]
#[inline(always)]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::reset_value(),
})
.bits,
);
}
#[doc = r"Reset value of the register"]
#[inline(always)]
pub const fn reset_value() -> u32 {
0
}
#[doc = r"Writes the reset value to the register"]
#[inline(always)]
pub fn reset(&self) {
self.register.set(Self::reset_value())
}
}
#[doc = "Possible values of the field `LSEON`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEONR {
#[doc = "LSE oscillator Off"]
OFF,
#[doc = "LSE oscillator On"]
ON,
}
impl LSEONR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
LSEONR::OFF => false,
LSEONR::ON => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> LSEONR {
match value {
false => LSEONR::OFF,
true => LSEONR::ON,
}
}
#[doc = "Checks if the value of the field is `OFF`"]
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == LSEONR::OFF
}
#[doc = "Checks if the value of the field is `ON`"]
#[inline(always)]
pub fn is_on(&self) -> bool {
*self == LSEONR::ON
}
}
#[doc = "Values that can be written to the field `LSEON`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEONW {
#[doc = "LSE oscillator Off"]
OFF,
#[doc = "LSE oscillator On"]
ON,
}
impl LSEONW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
LSEONW::OFF => false,
LSEONW::ON => true,
}
}
}
#[doc = r"Proxy"]
pub struct _LSEONW<'a> {
w: &'a mut W,
}
impl<'a> _LSEONW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSEONW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "LSE oscillator Off"]
#[inline(always)]
pub fn off(self) -> &'a mut W {
self.variant(LSEONW::OFF)
}
#[doc = "LSE oscillator On"]
#[inline(always)]
pub fn on(self) -> &'a mut W {
self.variant(LSEONW::ON)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 0);
self.w.bits |= ((value as u32) & 0x01) << 0;
self.w
}
}
#[doc = "Possible values of the field `LSERDY`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSERDYR {
#[doc = "LSE oscillator not ready"]
NOTREADY,
#[doc = "LSE oscillator ready"]
READY,
}
impl LSERDYR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
LSERDYR::NOTREADY => false,
LSERDYR::READY => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> LSERDYR {
match value {
false => LSERDYR::NOTREADY,
true => LSERDYR::READY,
}
}
#[doc = "Checks if the value of the field is `NOTREADY`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == LSERDYR::NOTREADY
}
#[doc = "Checks if the value of the field is `READY`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == LSERDYR::READY
}
}
#[doc = "Values that can be written to the field `LSERDY`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSERDYW {
#[doc = "LSE oscillator not ready"]
NOTREADY,
#[doc = "LSE oscillator ready"]
READY,
}
impl LSERDYW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
LSERDYW::NOTREADY => false,
LSERDYW::READY => true,
}
}
}
#[doc = r"Proxy"]
pub struct _LSERDYW<'a> {
w: &'a mut W,
}
impl<'a> _LSERDYW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSERDYW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "LSE oscillator not ready"]
#[inline(always)]
pub fn not_ready(self) -> &'a mut W {
self.variant(LSERDYW::NOTREADY)
}
#[doc = "LSE oscillator ready"]
#[inline(always)]
pub fn ready(self) -> &'a mut W {
self.variant(LSERDYW::READY)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 1);
self.w.bits |= ((value as u32) & 0x01) << 1;
self.w
}
}
#[doc = "Possible values of the field `LSEBYP`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEBYPR {
#[doc = "LSE crystal oscillator not bypassed"]
NOTBYPASSED,
#[doc = "LSE crystal oscillator bypassed with external clock"]
BYPASSED,
}
impl LSEBYPR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
LSEBYPR::NOTBYPASSED => false,
LSEBYPR::BYPASSED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> LSEBYPR {
match value {
false => LSEBYPR::NOTBYPASSED,
true => LSEBYPR::BYPASSED,
}
}
#[doc = "Checks if the value of the field is `NOTBYPASSED`"]
#[inline(always)]
pub fn is_not_bypassed(&self) -> bool {
*self == LSEBYPR::NOTBYPASSED
}
#[doc = "Checks if the value of the field is `BYPASSED`"]
#[inline(always)]
pub fn is_bypassed(&self) -> bool {
*self == LSEBYPR::BYPASSED
}
}
#[doc = "Values that can be written to the field `LSEBYP`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEBYPW {
#[doc = "LSE crystal oscillator not bypassed"]
NOTBYPASSED,
#[doc = "LSE crystal oscillator bypassed with external clock"]
BYPASSED,
}
impl LSEBYPW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
LSEBYPW::NOTBYPASSED => false,
LSEBYPW::BYPASSED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _LSEBYPW<'a> {
w: &'a mut W,
}
impl<'a> _LSEBYPW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSEBYPW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "LSE crystal oscillator not bypassed"]
#[inline(always)]
pub fn not_bypassed(self) -> &'a mut W {
self.variant(LSEBYPW::NOTBYPASSED)
}
#[doc = "LSE crystal oscillator bypassed with external clock"]
#[inline(always)]
pub fn bypassed(self) -> &'a mut W {
self.variant(LSEBYPW::BYPASSED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 2);
self.w.bits |= ((value as u32) & 0x01) << 2;
self.w
}
}
#[doc = "Possible values of the field `LSEDRV`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEDRVR {
#[doc = "Lowest LSE oscillator driving capability"]
LOWEST,
#[doc = "Medium low LSE oscillator driving capability"]
MEDIUMLOW,
#[doc = "Medium high LSE oscillator driving capability"]
MEDIUMHIGH,
#[doc = "Highest LSE oscillator driving capability"]
HIGHEST,
}
impl LSEDRVR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
match *self {
LSEDRVR::LOWEST => 0,
LSEDRVR::MEDIUMLOW => 0x01,
LSEDRVR::MEDIUMHIGH => 0x02,
LSEDRVR::HIGHEST => 0x03,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: u8) -> LSEDRVR {
match value {
0 => LSEDRVR::LOWEST,
1 => LSEDRVR::MEDIUMLOW,
2 => LSEDRVR::MEDIUMHIGH,
3 => LSEDRVR::HIGHEST,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `LOWEST`"]
#[inline(always)]
pub fn is_lowest(&self) -> bool {
*self == LSEDRVR::LOWEST
}
#[doc = "Checks if the value of the field is `MEDIUMLOW`"]
#[inline(always)]
pub fn is_medium_low(&self) -> bool {
*self == LSEDRVR::MEDIUMLOW
}
#[doc = "Checks if the value of the field is `MEDIUMHIGH`"]
#[inline(always)]
pub fn is_medium_high(&self) -> bool {
*self == LSEDRVR::MEDIUMHIGH
}
#[doc = "Checks if the value of the field is `HIGHEST`"]
#[inline(always)]
pub fn is_highest(&self) -> bool {
*self == LSEDRVR::HIGHEST
}
}
#[doc = "Values that can be written to the field `LSEDRV`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEDRVW {
#[doc = "Lowest LSE oscillator driving capability"]
LOWEST,
#[doc = "Medium low LSE oscillator driving capability"]
MEDIUMLOW,
#[doc = "Medium high LSE oscillator driving capability"]
MEDIUMHIGH,
#[doc = "Highest LSE oscillator driving capability"]
HIGHEST,
}
impl LSEDRVW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
LSEDRVW::LOWEST => 0,
LSEDRVW::MEDIUMLOW => 1,
LSEDRVW::MEDIUMHIGH => 2,
LSEDRVW::HIGHEST => 3,
}
}
}
#[doc = r"Proxy"]
pub struct _LSEDRVW<'a> {
w: &'a mut W,
}
impl<'a> _LSEDRVW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSEDRVW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "Lowest LSE oscillator driving capability"]
#[inline(always)]
pub fn lowest(self) -> &'a mut W {
self.variant(LSEDRVW::LOWEST)
}
#[doc = "Medium low LSE oscillator driving capability"]
#[inline(always)]
pub fn medium_low(self) -> &'a mut W {
self.variant(LSEDRVW::MEDIUMLOW)
}
#[doc = "Medium high LSE oscillator driving capability"]
#[inline(always)]
pub fn medium_high(self) -> &'a mut W {
self.variant(LSEDRVW::MEDIUMHIGH)
}
#[doc = "Highest LSE oscillator driving capability"]
#[inline(always)]
pub fn highest(self) -> &'a mut W {
self.variant(LSEDRVW::HIGHEST)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x03 << 3);
self.w.bits |= ((value as u32) & 0x03) << 3;
self.w
}
}
#[doc = "Possible values of the field `LSECSSON`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSECSSONR {
#[doc = "Clock security system on 32 kHz oscillator off"]
SECURITYOFF,
#[doc = "Clock security system on 32 kHz oscillator on"]
SECURITYON,
}
impl LSECSSONR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
LSECSSONR::SECURITYOFF => false,
LSECSSONR::SECURITYON => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> LSECSSONR {
match value {
false => LSECSSONR::SECURITYOFF,
true => LSECSSONR::SECURITYON,
}
}
#[doc = "Checks if the value of the field is `SECURITYOFF`"]
#[inline(always)]
pub fn is_security_off(&self) -> bool {
*self == LSECSSONR::SECURITYOFF
}
#[doc = "Checks if the value of the field is `SECURITYON`"]
#[inline(always)]
pub fn is_security_on(&self) -> bool {
*self == LSECSSONR::SECURITYON
}
}
#[doc = "Values that can be written to the field `LSECSSON`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSECSSONW {
#[doc = "Clock security system on 32 kHz oscillator off"]
SECURITYOFF,
#[doc = "Clock security system on 32 kHz oscillator on"]
SECURITYON,
}
impl LSECSSONW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
LSECSSONW::SECURITYOFF => false,
LSECSSONW::SECURITYON => true,
}
}
}
#[doc = r"Proxy"]
pub struct _LSECSSONW<'a> {
w: &'a mut W,
}
impl<'a> _LSECSSONW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSECSSONW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Clock security system on 32 kHz oscillator off"]
#[inline(always)]
pub fn security_off(self) -> &'a mut W {
self.variant(LSECSSONW::SECURITYOFF)
}
#[doc = "Clock security system on 32 kHz oscillator on"]
#[inline(always)]
pub fn security_on(self) -> &'a mut W {
self.variant(LSECSSONW::SECURITYON)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 5);
self.w.bits |= ((value as u32) & 0x01) << 5;
self.w
}
}
#[doc = "Possible values of the field `LSECSSD`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSECSSDR {
#[doc = "No failure detected on 32 kHz oscillator"]
NOFAILURE,
#[doc = "Failure detected on 32 kHz oscillator"]
FAILURE,
}
impl LSECSSDR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
LSECSSDR::NOFAILURE => false,
LSECSSDR::FAILURE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> LSECSSDR {
match value {
false => LSECSSDR::NOFAILURE,
true => LSECSSDR::FAILURE,
}
}
#[doc = "Checks if the value of the field is `NOFAILURE`"]
#[inline(always)]
pub fn is_no_failure(&self) -> bool {
*self == LSECSSDR::NOFAILURE
}
#[doc = "Checks if the value of the field is `FAILURE`"]
#[inline(always)]
pub fn is_failure(&self) -> bool {
*self == LSECSSDR::FAILURE
}
}
#[doc = "Values that can be written to the field `LSECSSD`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSECSSDW {
#[doc = "No failure detected on 32 kHz oscillator"]
NOFAILURE,
#[doc = "Failure detected on 32 kHz oscillator"]
FAILURE,
}
impl LSECSSDW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
LSECSSDW::NOFAILURE => false,
LSECSSDW::FAILURE => true,
}
}
}
#[doc = r"Proxy"]
pub struct _LSECSSDW<'a> {
w: &'a mut W,
}
impl<'a> _LSECSSDW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSECSSDW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No failure detected on 32 kHz oscillator"]
#[inline(always)]
pub fn no_failure(self) -> &'a mut W {
self.variant(LSECSSDW::NOFAILURE)
}
#[doc = "Failure detected on 32 kHz oscillator"]
#[inline(always)]
pub fn failure(self) -> &'a mut W {
self.variant(LSECSSDW::FAILURE)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 6);
self.w.bits |= ((value as u32) & 0x01) << 6;
self.w
}
}
#[doc = "Possible values of the field `RTCSEL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTCSELR {
#[doc = "No clock"]
NOCLOCK,
#[doc = "LSE oscillator clock used as RTC clock"]
LSE,
#[doc = "LSI oscillator clock used as RTC clock"]
LSI,
#[doc = "HSE oscillator clock divided by a prescaler used as RTC clock"]
HSE,
}
impl RTCSELR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
match *self {
RTCSELR::NOCLOCK => 0,
RTCSELR::LSE => 0x01,
RTCSELR::LSI => 0x02,
RTCSELR::HSE => 0x03,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: u8) -> RTCSELR {
match value {
0 => RTCSELR::NOCLOCK,
1 => RTCSELR::LSE,
2 => RTCSELR::LSI,
3 => RTCSELR::HSE,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NOCLOCK`"]
#[inline(always)]
pub fn is_no_clock(&self) -> bool {
*self == RTCSELR::NOCLOCK
}
#[doc = "Checks if the value of the field is `LSE`"]
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == RTCSELR::LSE
}
#[doc = "Checks if the value of the field is `LSI`"]
#[inline(always)]
pub fn is_lsi(&self) -> bool {
*self == RTCSELR::LSI
}
#[doc = "Checks if the value of the field is `HSE`"]
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == RTCSELR::HSE
}
}
#[doc = "Values that can be written to the field `RTCSEL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTCSELW {
#[doc = "No clock"]
NOCLOCK,
#[doc = "LSE oscillator clock used as RTC clock"]
LSE,
#[doc = "LSI oscillator clock used as RTC clock"]
LSI,
#[doc = "HSE oscillator clock divided by a prescaler used as RTC clock"]
HSE,
}
impl RTCSELW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
RTCSELW::NOCLOCK => 0,
RTCSELW::LSE => 1,
RTCSELW::LSI => 2,
RTCSELW::HSE => 3,
}
}
}
#[doc = r"Proxy"]
pub struct _RTCSELW<'a> {
w: &'a mut W,
}
impl<'a> _RTCSELW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RTCSELW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "No clock"]
#[inline(always)]
pub fn no_clock(self) -> &'a mut W {
self.variant(RTCSELW::NOCLOCK)
}
#[doc = "LSE oscillator clock used as RTC clock"]
#[inline(always)]
pub fn lse(self) -> &'a mut W {
self.variant(RTCSELW::LSE)
}
#[doc = "LSI oscillator clock used as RTC clock"]
#[inline(always)]
pub fn lsi(self) -> &'a mut W {
self.variant(RTCSELW::LSI)
}
#[doc = "HSE oscillator clock divided by a prescaler used as RTC clock"]
#[inline(always)]
pub fn hse(self) -> &'a mut W {
self.variant(RTCSELW::HSE)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x03 << 8);
self.w.bits |= ((value as u32) & 0x03) << 8;
self.w
}
}
#[doc = "Possible values of the field `RTCEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTCENR {
#[doc = "RTC clock disabled"]
DISABLED,
#[doc = "RTC clock enabled"]
ENABLED,
}
impl RTCENR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
RTCENR::DISABLED => false,
RTCENR::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> RTCENR {
match value {
false => RTCENR::DISABLED,
true => RTCENR::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RTCENR::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RTCENR::ENABLED
}
}
#[doc = "Values that can be written to the field `RTCEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTCENW {
#[doc = "RTC clock disabled"]
DISABLED,
#[doc = "RTC clock enabled"]
ENABLED,
}
impl RTCENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
RTCENW::DISABLED => false,
RTCENW::ENABLED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _RTCENW<'a> {
w: &'a mut W,
}
impl<'a> _RTCENW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RTCENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "RTC clock disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(RTCENW::DISABLED)
}
#[doc = "RTC clock enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(RTCENW::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 15);
self.w.bits |= ((value as u32) & 0x01) << 15;
self.w
}
}
#[doc = "Possible values of the field `BDRST`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BDRSTR {
#[doc = "Resets the entire VSW domain"]
RESET,
#[doc = r"Reserved"]
_Reserved(bool),
}
impl BDRSTR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
BDRSTR::RESET => true,
BDRSTR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> BDRSTR {
match value {
true => BDRSTR::RESET,
i => BDRSTR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `RESET`"]
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == BDRSTR::RESET
}
}
#[doc = "Values that can be written to the field `BDRST`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BDRSTW {
#[doc = "Resets the entire VSW domain"]
RESET,
}
impl BDRSTW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
BDRSTW::RESET => true,
}
}
}
#[doc = r"Proxy"]
pub struct _BDRSTW<'a> {
w: &'a mut W,
}
impl<'a> _BDRSTW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: BDRSTW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Resets the entire VSW domain"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(BDRSTW::RESET)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 16);
self.w.bits |= ((value as u32) & 0x01) << 16;
self.w
}
}
impl R {
#[doc = r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 0 - LSE oscillator enabled"]
#[inline(always)]
pub fn lseon(&self) -> LSEONR {
LSEONR::_from(((self.bits >> 0) & 0x01) != 0)
}
#[doc = "Bit 1 - LSE oscillator ready"]
#[inline(always)]
pub fn lserdy(&self) -> LSERDYR {
LSERDYR::_from(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - LSE oscillator bypass"]
#[inline(always)]
pub fn lsebyp(&self) -> LSEBYPR {
LSEBYPR::_from(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bits 3:4 - LSE oscillator driving capability"]
#[inline(always)]
pub fn lsedrv(&self) -> LSEDRVR {
LSEDRVR::_from(((self.bits >> 3) & 0x03) as u8)
}
#[doc = "Bit 5 - LSE clock security system enable"]
#[inline(always)]
pub fn lsecsson(&self) -> LSECSSONR {
LSECSSONR::_from(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - LSE clock security system failure detection"]
#[inline(always)]
pub fn lsecssd(&self) -> LSECSSDR {
LSECSSDR::_from(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bits 8:9 - RTC clock source selection"]
#[inline(always)]
pub fn rtcsel(&self) -> RTCSELR {
RTCSELR::_from(((self.bits >> 8) & 0x03) as u8)
}
#[doc = "Bit 15 - RTC clock enable"]
#[inline(always)]
pub fn rtcen(&self) -> RTCENR {
RTCENR::_from(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bit 16 - VSwitch domain software reset"]
#[inline(always)]
pub fn bdrst(&self) -> BDRSTR {
BDRSTR::_from(((self.bits >> 16) & 0x01) != 0)
}
}
impl W {
#[doc = r"Writes raw bits to the register"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - LSE oscillator enabled"]
#[inline(always)]
pub fn lseon(&mut self) -> _LSEONW {
_LSEONW { w: self }
}
#[doc = "Bit 1 - LSE oscillator ready"]
#[inline(always)]
pub fn lserdy(&mut self) -> _LSERDYW {
_LSERDYW { w: self }
}
#[doc = "Bit 2 - LSE oscillator bypass"]
#[inline(always)]
pub fn lsebyp(&mut self) -> _LSEBYPW {
_LSEBYPW { w: self }
}
#[doc = "Bits 3:4 - LSE oscillator driving capability"]
#[inline(always)]
pub fn lsedrv(&mut self) -> _LSEDRVW {
_LSEDRVW { w: self }
}
#[doc = "Bit 5 - LSE clock security system enable"]
#[inline(always)]
pub fn lsecsson(&mut self) -> _LSECSSONW {
_LSECSSONW { w: self }
}
#[doc = "Bit 6 - LSE clock security system failure detection"]
#[inline(always)]
pub fn lsecssd(&mut self) -> _LSECSSDW {
_LSECSSDW { w: self }
}
#[doc = "Bits 8:9 - RTC clock source selection"]
#[inline(always)]
pub fn rtcsel(&mut self) -> _RTCSELW {
_RTCSELW { w: self }
}
#[doc = "Bit 15 - RTC clock enable"]
#[inline(always)]
pub fn rtcen(&mut self) -> _RTCENW {
_RTCENW { w: self }
}
#[doc = "Bit 16 - VSwitch domain software reset"]
#[inline(always)]
pub fn bdrst(&mut self) -> _BDRSTW {
_BDRSTW { w: self }
}
}