#[doc = "Reader of register CSR"]
pub type R = crate::R<u32, super::CSR>;
#[doc = "Writer for register CSR"]
pub type W = crate::W<u32, super::CSR>;
#[doc = "Register CSR `reset()`'s with value 0x0c00_0000"]
impl crate::ResetValue for super::CSR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0x0c00_0000
}
}
#[doc = "Low-power reset flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LPWRRSTF_A {
#[doc = "0: No reset has occured"]
NORESET,
#[doc = "1: A reset has occured"]
RESET,
}
impl From<LPWRRSTF_A> for bool {
#[inline(always)]
fn from(variant: LPWRRSTF_A) -> Self {
match variant {
LPWRRSTF_A::NORESET => false,
LPWRRSTF_A::RESET => true,
}
}
}
#[doc = "Reader of field `LPWRRSTF`"]
pub type LPWRRSTF_R = crate::R<bool, LPWRRSTF_A>;
impl LPWRRSTF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LPWRRSTF_A {
match self.bits {
false => LPWRRSTF_A::NORESET,
true => LPWRRSTF_A::RESET,
}
}
#[doc = "Checks if the value of the field is `NORESET`"]
#[inline(always)]
pub fn is_no_reset(&self) -> bool {
*self == LPWRRSTF_A::NORESET
}
#[doc = "Checks if the value of the field is `RESET`"]
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == LPWRRSTF_A::RESET
}
}
#[doc = "Write proxy for field `LPWRRSTF`"]
pub struct LPWRRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> LPWRRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LPWRRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
self.w
}
}
#[doc = "Window watchdog reset flag"]
pub type WWDGRSTF_A = LPWRRSTF_A;
#[doc = "Reader of field `WWDGRSTF`"]
pub type WWDGRSTF_R = crate::R<bool, LPWRRSTF_A>;
#[doc = "Write proxy for field `WWDGRSTF`"]
pub struct WWDGRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> WWDGRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: WWDGRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
self.w
}
}
#[doc = "Independent watchdog reset flag"]
pub type IWDGRSTF_A = LPWRRSTF_A;
#[doc = "Reader of field `IWDGRSTF`"]
pub type IWDGRSTF_R = crate::R<bool, LPWRRSTF_A>;
#[doc = "Write proxy for field `IWDGRSTF`"]
pub struct IWDGRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> IWDGRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: IWDGRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
self.w
}
}
#[doc = "Software reset flag"]
pub type SFTRSTF_A = LPWRRSTF_A;
#[doc = "Reader of field `SFTRSTF`"]
pub type SFTRSTF_R = crate::R<bool, LPWRRSTF_A>;
#[doc = "Write proxy for field `SFTRSTF`"]
pub struct SFTRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> SFTRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SFTRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
self.w
}
}
#[doc = "POR/PDR reset flag"]
pub type PORRSTF_A = LPWRRSTF_A;
#[doc = "Reader of field `PORRSTF`"]
pub type PORRSTF_R = crate::R<bool, LPWRRSTF_A>;
#[doc = "Write proxy for field `PORRSTF`"]
pub struct PORRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> PORRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PORRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 27)) | (((value as u32) & 0x01) << 27);
self.w
}
}
#[doc = "PIN reset flag"]
pub type PINRSTF_A = LPWRRSTF_A;
#[doc = "Reader of field `PINRSTF`"]
pub type PINRSTF_R = crate::R<bool, LPWRRSTF_A>;
#[doc = "Write proxy for field `PINRSTF`"]
pub struct PINRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> PINRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PINRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 26)) | (((value as u32) & 0x01) << 26);
self.w
}
}
#[doc = "OBLRSTF"]
pub type OBLRSTF_A = LPWRRSTF_A;
#[doc = "Reader of field `OBLRSTF`"]
pub type OBLRSTF_R = crate::R<bool, LPWRRSTF_A>;
#[doc = "Write proxy for field `OBLRSTF`"]
pub struct OBLRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> OBLRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: OBLRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25);
self.w
}
}
#[doc = "Firewall reset flag"]
pub type FWRSTF_A = LPWRRSTF_A;
#[doc = "Reader of field `FWRSTF`"]
pub type FWRSTF_R = crate::R<bool, LPWRRSTF_A>;
#[doc = "Write proxy for field `FWRSTF`"]
pub struct FWRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> FWRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: FWRSTF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No reset has occured"]
#[inline(always)]
pub fn no_reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(LPWRRSTF_A::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 = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24);
self.w
}
}
#[doc = "RTC software reset bit\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTCRST_A {
#[doc = "1: Resets the RTC peripheral"]
RESET,
}
impl From<RTCRST_A> for bool {
#[inline(always)]
fn from(variant: RTCRST_A) -> Self {
match variant {
RTCRST_A::RESET => true,
}
}
}
#[doc = "Reader of field `RTCRST`"]
pub type RTCRST_R = crate::R<bool, RTCRST_A>;
impl RTCRST_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<bool, RTCRST_A> {
use crate::Variant::*;
match self.bits {
true => Val(RTCRST_A::RESET),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `RESET`"]
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == RTCRST_A::RESET
}
}
#[doc = "Write proxy for field `RTCRST`"]
pub struct RTCRST_W<'a> {
w: &'a mut W,
}
impl<'a> RTCRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RTCRST_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Resets the RTC peripheral"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(RTCRST_A::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 = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19);
self.w
}
}
#[doc = "RTC clock enable bit\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTCEN_A {
#[doc = "0: RTC clock disabled"]
DISABLED,
#[doc = "1: RTC clock enabled"]
ENABLED,
}
impl From<RTCEN_A> for bool {
#[inline(always)]
fn from(variant: RTCEN_A) -> Self {
match variant {
RTCEN_A::DISABLED => false,
RTCEN_A::ENABLED => true,
}
}
}
#[doc = "Reader of field `RTCEN`"]
pub type RTCEN_R = crate::R<bool, RTCEN_A>;
impl RTCEN_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RTCEN_A {
match self.bits {
false => RTCEN_A::DISABLED,
true => RTCEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RTCEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RTCEN_A::ENABLED
}
}
#[doc = "Write proxy for field `RTCEN`"]
pub struct RTCEN_W<'a> {
w: &'a mut W,
}
impl<'a> RTCEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RTCEN_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "RTC clock disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(RTCEN_A::DISABLED)
}
#[doc = "RTC clock enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(RTCEN_A::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 = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18);
self.w
}
}
#[doc = "RTC and LCD clock source selection bits\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTCSEL_A {
#[doc = "0: No clock"]
NOCLOCK,
#[doc = "1: LSE oscillator clock used as RTC clock"]
LSE,
#[doc = "2: LSI oscillator clock used as RTC clock"]
LSI,
#[doc = "3: HSE oscillator clock divided by a programmable prescaler (selection through the RTCPRE\\[1:0\\] bits in the RCC clock control register (RCC_CR)) used as the RTC clock"]
HSE,
}
impl From<RTCSEL_A> for u8 {
#[inline(always)]
fn from(variant: RTCSEL_A) -> Self {
match variant {
RTCSEL_A::NOCLOCK => 0,
RTCSEL_A::LSE => 1,
RTCSEL_A::LSI => 2,
RTCSEL_A::HSE => 3,
}
}
}
#[doc = "Reader of field `RTCSEL`"]
pub type RTCSEL_R = crate::R<u8, RTCSEL_A>;
impl RTCSEL_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RTCSEL_A {
match self.bits {
0 => RTCSEL_A::NOCLOCK,
1 => RTCSEL_A::LSE,
2 => RTCSEL_A::LSI,
3 => RTCSEL_A::HSE,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NOCLOCK`"]
#[inline(always)]
pub fn is_no_clock(&self) -> bool {
*self == RTCSEL_A::NOCLOCK
}
#[doc = "Checks if the value of the field is `LSE`"]
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == RTCSEL_A::LSE
}
#[doc = "Checks if the value of the field is `LSI`"]
#[inline(always)]
pub fn is_lsi(&self) -> bool {
*self == RTCSEL_A::LSI
}
#[doc = "Checks if the value of the field is `HSE`"]
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == RTCSEL_A::HSE
}
}
#[doc = "Write proxy for field `RTCSEL`"]
pub struct RTCSEL_W<'a> {
w: &'a mut W,
}
impl<'a> RTCSEL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RTCSEL_A) -> &'a mut W {
{
self.bits(variant.into())
}
}
#[doc = "No clock"]
#[inline(always)]
pub fn no_clock(self) -> &'a mut W {
self.variant(RTCSEL_A::NOCLOCK)
}
#[doc = "LSE oscillator clock used as RTC clock"]
#[inline(always)]
pub fn lse(self) -> &'a mut W {
self.variant(RTCSEL_A::LSE)
}
#[doc = "LSI oscillator clock used as RTC clock"]
#[inline(always)]
pub fn lsi(self) -> &'a mut W {
self.variant(RTCSEL_A::LSI)
}
#[doc = "HSE oscillator clock divided by a programmable prescaler (selection through the RTCPRE\\[1:0\\] bits in the RCC clock control register (RCC_CR)) used as the RTC clock"]
#[inline(always)]
pub fn hse(self) -> &'a mut W {
self.variant(RTCSEL_A::HSE)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
self.w
}
}
#[doc = "CSS on LSE failure detection flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CSSLSED_A {
#[doc = "0: No failure detected on LSE (32 kHz oscillator)"]
NOFAILURE,
#[doc = "1: Failure detected on LSE (32 kHz oscillator)"]
FAILURE,
}
impl From<CSSLSED_A> for bool {
#[inline(always)]
fn from(variant: CSSLSED_A) -> Self {
match variant {
CSSLSED_A::NOFAILURE => false,
CSSLSED_A::FAILURE => true,
}
}
}
#[doc = "Reader of field `CSSLSED`"]
pub type CSSLSED_R = crate::R<bool, CSSLSED_A>;
impl CSSLSED_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CSSLSED_A {
match self.bits {
false => CSSLSED_A::NOFAILURE,
true => CSSLSED_A::FAILURE,
}
}
#[doc = "Checks if the value of the field is `NOFAILURE`"]
#[inline(always)]
pub fn is_no_failure(&self) -> bool {
*self == CSSLSED_A::NOFAILURE
}
#[doc = "Checks if the value of the field is `FAILURE`"]
#[inline(always)]
pub fn is_failure(&self) -> bool {
*self == CSSLSED_A::FAILURE
}
}
#[doc = "Write proxy for field `CSSLSED`"]
pub struct CSSLSED_W<'a> {
w: &'a mut W,
}
impl<'a> CSSLSED_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CSSLSED_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No failure detected on LSE (32 kHz oscillator)"]
#[inline(always)]
pub fn no_failure(self) -> &'a mut W {
self.variant(CSSLSED_A::NOFAILURE)
}
#[doc = "Failure detected on LSE (32 kHz oscillator)"]
#[inline(always)]
pub fn failure(self) -> &'a mut W {
self.variant(CSSLSED_A::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 = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
self.w
}
}
#[doc = "CSSLSEON\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CSSLSEON_A {
#[doc = "0: Oscillator OFF"]
OFF,
#[doc = "1: Oscillator ON"]
ON,
}
impl From<CSSLSEON_A> for bool {
#[inline(always)]
fn from(variant: CSSLSEON_A) -> Self {
match variant {
CSSLSEON_A::OFF => false,
CSSLSEON_A::ON => true,
}
}
}
#[doc = "Reader of field `CSSLSEON`"]
pub type CSSLSEON_R = crate::R<bool, CSSLSEON_A>;
impl CSSLSEON_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CSSLSEON_A {
match self.bits {
false => CSSLSEON_A::OFF,
true => CSSLSEON_A::ON,
}
}
#[doc = "Checks if the value of the field is `OFF`"]
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == CSSLSEON_A::OFF
}
#[doc = "Checks if the value of the field is `ON`"]
#[inline(always)]
pub fn is_on(&self) -> bool {
*self == CSSLSEON_A::ON
}
}
#[doc = "Write proxy for field `CSSLSEON`"]
pub struct CSSLSEON_W<'a> {
w: &'a mut W,
}
impl<'a> CSSLSEON_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CSSLSEON_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Oscillator OFF"]
#[inline(always)]
pub fn off(self) -> &'a mut W {
self.variant(CSSLSEON_A::OFF)
}
#[doc = "Oscillator ON"]
#[inline(always)]
pub fn on(self) -> &'a mut W {
self.variant(CSSLSEON_A::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 = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
self.w
}
}
#[doc = "LSEDRV\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEDRV_A {
#[doc = "0: Lowest drive"]
LOW,
#[doc = "1: Medium low drive"]
MEDIUMLOW,
#[doc = "2: Medium high drive"]
MEDIUMHIGH,
#[doc = "3: Highest drive"]
HIGH,
}
impl From<LSEDRV_A> for u8 {
#[inline(always)]
fn from(variant: LSEDRV_A) -> Self {
match variant {
LSEDRV_A::LOW => 0,
LSEDRV_A::MEDIUMLOW => 1,
LSEDRV_A::MEDIUMHIGH => 2,
LSEDRV_A::HIGH => 3,
}
}
}
#[doc = "Reader of field `LSEDRV`"]
pub type LSEDRV_R = crate::R<u8, LSEDRV_A>;
impl LSEDRV_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LSEDRV_A {
match self.bits {
0 => LSEDRV_A::LOW,
1 => LSEDRV_A::MEDIUMLOW,
2 => LSEDRV_A::MEDIUMHIGH,
3 => LSEDRV_A::HIGH,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `LOW`"]
#[inline(always)]
pub fn is_low(&self) -> bool {
*self == LSEDRV_A::LOW
}
#[doc = "Checks if the value of the field is `MEDIUMLOW`"]
#[inline(always)]
pub fn is_medium_low(&self) -> bool {
*self == LSEDRV_A::MEDIUMLOW
}
#[doc = "Checks if the value of the field is `MEDIUMHIGH`"]
#[inline(always)]
pub fn is_medium_high(&self) -> bool {
*self == LSEDRV_A::MEDIUMHIGH
}
#[doc = "Checks if the value of the field is `HIGH`"]
#[inline(always)]
pub fn is_high(&self) -> bool {
*self == LSEDRV_A::HIGH
}
}
#[doc = "Write proxy for field `LSEDRV`"]
pub struct LSEDRV_W<'a> {
w: &'a mut W,
}
impl<'a> LSEDRV_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSEDRV_A) -> &'a mut W {
{
self.bits(variant.into())
}
}
#[doc = "Lowest drive"]
#[inline(always)]
pub fn low(self) -> &'a mut W {
self.variant(LSEDRV_A::LOW)
}
#[doc = "Medium low drive"]
#[inline(always)]
pub fn medium_low(self) -> &'a mut W {
self.variant(LSEDRV_A::MEDIUMLOW)
}
#[doc = "Medium high drive"]
#[inline(always)]
pub fn medium_high(self) -> &'a mut W {
self.variant(LSEDRV_A::MEDIUMHIGH)
}
#[doc = "Highest drive"]
#[inline(always)]
pub fn high(self) -> &'a mut W {
self.variant(LSEDRV_A::HIGH)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 11)) | (((value as u32) & 0x03) << 11);
self.w
}
}
#[doc = "External low-speed oscillator bypass bit\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSEBYP_A {
#[doc = "0: LSE oscillator not bypassed"]
NOTBYPASSED,
#[doc = "1: LSE oscillator bypassed"]
BYPASSED,
}
impl From<LSEBYP_A> for bool {
#[inline(always)]
fn from(variant: LSEBYP_A) -> Self {
match variant {
LSEBYP_A::NOTBYPASSED => false,
LSEBYP_A::BYPASSED => true,
}
}
}
#[doc = "Reader of field `LSEBYP`"]
pub type LSEBYP_R = crate::R<bool, LSEBYP_A>;
impl LSEBYP_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LSEBYP_A {
match self.bits {
false => LSEBYP_A::NOTBYPASSED,
true => LSEBYP_A::BYPASSED,
}
}
#[doc = "Checks if the value of the field is `NOTBYPASSED`"]
#[inline(always)]
pub fn is_not_bypassed(&self) -> bool {
*self == LSEBYP_A::NOTBYPASSED
}
#[doc = "Checks if the value of the field is `BYPASSED`"]
#[inline(always)]
pub fn is_bypassed(&self) -> bool {
*self == LSEBYP_A::BYPASSED
}
}
#[doc = "Write proxy for field `LSEBYP`"]
pub struct LSEBYP_W<'a> {
w: &'a mut W,
}
impl<'a> LSEBYP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSEBYP_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "LSE oscillator not bypassed"]
#[inline(always)]
pub fn not_bypassed(self) -> &'a mut W {
self.variant(LSEBYP_A::NOTBYPASSED)
}
#[doc = "LSE oscillator bypassed"]
#[inline(always)]
pub fn bypassed(self) -> &'a mut W {
self.variant(LSEBYP_A::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 = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
self.w
}
}
#[doc = "External low-speed oscillator ready bit\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSERDY_A {
#[doc = "0: Oscillator not ready"]
NOTREADY,
#[doc = "1: Oscillator ready"]
READY,
}
impl From<LSERDY_A> for bool {
#[inline(always)]
fn from(variant: LSERDY_A) -> Self {
match variant {
LSERDY_A::NOTREADY => false,
LSERDY_A::READY => true,
}
}
}
#[doc = "Reader of field `LSERDY`"]
pub type LSERDY_R = crate::R<bool, LSERDY_A>;
impl LSERDY_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LSERDY_A {
match self.bits {
false => LSERDY_A::NOTREADY,
true => LSERDY_A::READY,
}
}
#[doc = "Checks if the value of the field is `NOTREADY`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == LSERDY_A::NOTREADY
}
#[doc = "Checks if the value of the field is `READY`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == LSERDY_A::READY
}
}
#[doc = "External low-speed oscillator enable bit"]
pub type LSEON_A = CSSLSEON_A;
#[doc = "Reader of field `LSEON`"]
pub type LSEON_R = crate::R<bool, CSSLSEON_A>;
#[doc = "Write proxy for field `LSEON`"]
pub struct LSEON_W<'a> {
w: &'a mut W,
}
impl<'a> LSEON_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSEON_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Oscillator OFF"]
#[inline(always)]
pub fn off(self) -> &'a mut W {
self.variant(CSSLSEON_A::OFF)
}
#[doc = "Oscillator ON"]
#[inline(always)]
pub fn on(self) -> &'a mut W {
self.variant(CSSLSEON_A::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 = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
self.w
}
}
#[doc = "Internal low-speed oscillator ready bit"]
pub type LSIRDY_A = LSERDY_A;
#[doc = "Reader of field `LSIRDY`"]
pub type LSIRDY_R = crate::R<bool, LSERDY_A>;
#[doc = "Internal low-speed oscillator enable"]
pub type LSION_A = CSSLSEON_A;
#[doc = "Reader of field `LSION`"]
pub type LSION_R = crate::R<bool, CSSLSEON_A>;
#[doc = "Write proxy for field `LSION`"]
pub struct LSION_W<'a> {
w: &'a mut W,
}
impl<'a> LSION_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LSION_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Oscillator OFF"]
#[inline(always)]
pub fn off(self) -> &'a mut W {
self.variant(CSSLSEON_A::OFF)
}
#[doc = "Oscillator ON"]
#[inline(always)]
pub fn on(self) -> &'a mut W {
self.variant(CSSLSEON_A::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 = (self.w.bits & !0x01) | ((value as u32) & 0x01);
self.w
}
}
#[doc = "Remove reset flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RMVF_A {
#[doc = "1: Clears the reset flag"]
CLEAR,
}
impl From<RMVF_A> for bool {
#[inline(always)]
fn from(variant: RMVF_A) -> Self {
match variant {
RMVF_A::CLEAR => true,
}
}
}
#[doc = "Reader of field `RMVF`"]
pub type RMVF_R = crate::R<bool, RMVF_A>;
impl RMVF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<bool, RMVF_A> {
use crate::Variant::*;
match self.bits {
true => Val(RMVF_A::CLEAR),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `CLEAR`"]
#[inline(always)]
pub fn is_clear(&self) -> bool {
*self == RMVF_A::CLEAR
}
}
#[doc = "Write proxy for field `RMVF`"]
pub struct RMVF_W<'a> {
w: &'a mut W,
}
impl<'a> RMVF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RMVF_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clears the reset flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(RMVF_A::CLEAR)
}
#[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 = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23);
self.w
}
}
impl R {
#[doc = "Bit 31 - Low-power reset flag"]
#[inline(always)]
pub fn lpwrrstf(&self) -> LPWRRSTF_R {
LPWRRSTF_R::new(((self.bits >> 31) & 0x01) != 0)
}
#[doc = "Bit 30 - Window watchdog reset flag"]
#[inline(always)]
pub fn wwdgrstf(&self) -> WWDGRSTF_R {
WWDGRSTF_R::new(((self.bits >> 30) & 0x01) != 0)
}
#[doc = "Bit 29 - Independent watchdog reset flag"]
#[inline(always)]
pub fn iwdgrstf(&self) -> IWDGRSTF_R {
IWDGRSTF_R::new(((self.bits >> 29) & 0x01) != 0)
}
#[doc = "Bit 28 - Software reset flag"]
#[inline(always)]
pub fn sftrstf(&self) -> SFTRSTF_R {
SFTRSTF_R::new(((self.bits >> 28) & 0x01) != 0)
}
#[doc = "Bit 27 - POR/PDR reset flag"]
#[inline(always)]
pub fn porrstf(&self) -> PORRSTF_R {
PORRSTF_R::new(((self.bits >> 27) & 0x01) != 0)
}
#[doc = "Bit 26 - PIN reset flag"]
#[inline(always)]
pub fn pinrstf(&self) -> PINRSTF_R {
PINRSTF_R::new(((self.bits >> 26) & 0x01) != 0)
}
#[doc = "Bit 25 - OBLRSTF"]
#[inline(always)]
pub fn oblrstf(&self) -> OBLRSTF_R {
OBLRSTF_R::new(((self.bits >> 25) & 0x01) != 0)
}
#[doc = "Bit 24 - Firewall reset flag"]
#[inline(always)]
pub fn fwrstf(&self) -> FWRSTF_R {
FWRSTF_R::new(((self.bits >> 24) & 0x01) != 0)
}
#[doc = "Bit 19 - RTC software reset bit"]
#[inline(always)]
pub fn rtcrst(&self) -> RTCRST_R {
RTCRST_R::new(((self.bits >> 19) & 0x01) != 0)
}
#[doc = "Bit 18 - RTC clock enable bit"]
#[inline(always)]
pub fn rtcen(&self) -> RTCEN_R {
RTCEN_R::new(((self.bits >> 18) & 0x01) != 0)
}
#[doc = "Bits 16:17 - RTC and LCD clock source selection bits"]
#[inline(always)]
pub fn rtcsel(&self) -> RTCSEL_R {
RTCSEL_R::new(((self.bits >> 16) & 0x03) as u8)
}
#[doc = "Bit 14 - CSS on LSE failure detection flag"]
#[inline(always)]
pub fn csslsed(&self) -> CSSLSED_R {
CSSLSED_R::new(((self.bits >> 14) & 0x01) != 0)
}
#[doc = "Bit 13 - CSSLSEON"]
#[inline(always)]
pub fn csslseon(&self) -> CSSLSEON_R {
CSSLSEON_R::new(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bits 11:12 - LSEDRV"]
#[inline(always)]
pub fn lsedrv(&self) -> LSEDRV_R {
LSEDRV_R::new(((self.bits >> 11) & 0x03) as u8)
}
#[doc = "Bit 10 - External low-speed oscillator bypass bit"]
#[inline(always)]
pub fn lsebyp(&self) -> LSEBYP_R {
LSEBYP_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 9 - External low-speed oscillator ready bit"]
#[inline(always)]
pub fn lserdy(&self) -> LSERDY_R {
LSERDY_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 8 - External low-speed oscillator enable bit"]
#[inline(always)]
pub fn lseon(&self) -> LSEON_R {
LSEON_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 1 - Internal low-speed oscillator ready bit"]
#[inline(always)]
pub fn lsirdy(&self) -> LSIRDY_R {
LSIRDY_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - Internal low-speed oscillator enable"]
#[inline(always)]
pub fn lsion(&self) -> LSION_R {
LSION_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 23 - Remove reset flag"]
#[inline(always)]
pub fn rmvf(&self) -> RMVF_R {
RMVF_R::new(((self.bits >> 23) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 31 - Low-power reset flag"]
#[inline(always)]
pub fn lpwrrstf(&mut self) -> LPWRRSTF_W {
LPWRRSTF_W { w: self }
}
#[doc = "Bit 30 - Window watchdog reset flag"]
#[inline(always)]
pub fn wwdgrstf(&mut self) -> WWDGRSTF_W {
WWDGRSTF_W { w: self }
}
#[doc = "Bit 29 - Independent watchdog reset flag"]
#[inline(always)]
pub fn iwdgrstf(&mut self) -> IWDGRSTF_W {
IWDGRSTF_W { w: self }
}
#[doc = "Bit 28 - Software reset flag"]
#[inline(always)]
pub fn sftrstf(&mut self) -> SFTRSTF_W {
SFTRSTF_W { w: self }
}
#[doc = "Bit 27 - POR/PDR reset flag"]
#[inline(always)]
pub fn porrstf(&mut self) -> PORRSTF_W {
PORRSTF_W { w: self }
}
#[doc = "Bit 26 - PIN reset flag"]
#[inline(always)]
pub fn pinrstf(&mut self) -> PINRSTF_W {
PINRSTF_W { w: self }
}
#[doc = "Bit 25 - OBLRSTF"]
#[inline(always)]
pub fn oblrstf(&mut self) -> OBLRSTF_W {
OBLRSTF_W { w: self }
}
#[doc = "Bit 24 - Firewall reset flag"]
#[inline(always)]
pub fn fwrstf(&mut self) -> FWRSTF_W {
FWRSTF_W { w: self }
}
#[doc = "Bit 19 - RTC software reset bit"]
#[inline(always)]
pub fn rtcrst(&mut self) -> RTCRST_W {
RTCRST_W { w: self }
}
#[doc = "Bit 18 - RTC clock enable bit"]
#[inline(always)]
pub fn rtcen(&mut self) -> RTCEN_W {
RTCEN_W { w: self }
}
#[doc = "Bits 16:17 - RTC and LCD clock source selection bits"]
#[inline(always)]
pub fn rtcsel(&mut self) -> RTCSEL_W {
RTCSEL_W { w: self }
}
#[doc = "Bit 14 - CSS on LSE failure detection flag"]
#[inline(always)]
pub fn csslsed(&mut self) -> CSSLSED_W {
CSSLSED_W { w: self }
}
#[doc = "Bit 13 - CSSLSEON"]
#[inline(always)]
pub fn csslseon(&mut self) -> CSSLSEON_W {
CSSLSEON_W { w: self }
}
#[doc = "Bits 11:12 - LSEDRV"]
#[inline(always)]
pub fn lsedrv(&mut self) -> LSEDRV_W {
LSEDRV_W { w: self }
}
#[doc = "Bit 10 - External low-speed oscillator bypass bit"]
#[inline(always)]
pub fn lsebyp(&mut self) -> LSEBYP_W {
LSEBYP_W { w: self }
}
#[doc = "Bit 8 - External low-speed oscillator enable bit"]
#[inline(always)]
pub fn lseon(&mut self) -> LSEON_W {
LSEON_W { w: self }
}
#[doc = "Bit 0 - Internal low-speed oscillator enable"]
#[inline(always)]
pub fn lsion(&mut self) -> LSION_W {
LSION_W { w: self }
}
#[doc = "Bit 23 - Remove reset flag"]
#[inline(always)]
pub fn rmvf(&mut self) -> RMVF_W {
RMVF_W { w: self }
}
}