#[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 = "Internal low speed oscillator enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSION_A {
#[doc = "0: LSI oscillator Off"]
OFF = 0,
#[doc = "1: LSI oscillator On"]
ON = 1,
}
impl From<LSION_A> for bool {
#[inline(always)]
fn from(variant: LSION_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `LSION`"]
pub type LSION_R = crate::R<bool, LSION_A>;
impl LSION_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LSION_A {
match self.bits {
false => LSION_A::OFF,
true => LSION_A::ON,
}
}
#[doc = "Checks if the value of the field is `OFF`"]
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == LSION_A::OFF
}
#[doc = "Checks if the value of the field is `ON`"]
#[inline(always)]
pub fn is_on(&self) -> bool {
*self == LSION_A::ON
}
}
#[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 = "LSI oscillator Off"]
#[inline(always)]
pub fn off(self) -> &'a mut W {
self.variant(LSION_A::OFF)
}
#[doc = "LSI oscillator On"]
#[inline(always)]
pub fn on(self) -> &'a mut W {
self.variant(LSION_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 = "Internal low speed oscillator ready\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSIRDY_A {
#[doc = "0: LSI oscillator not ready"]
NOTREADY = 0,
#[doc = "1: LSI oscillator ready"]
READY = 1,
}
impl From<LSIRDY_A> for bool {
#[inline(always)]
fn from(variant: LSIRDY_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `LSIRDY`"]
pub type LSIRDY_R = crate::R<bool, LSIRDY_A>;
impl LSIRDY_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LSIRDY_A {
match self.bits {
false => LSIRDY_A::NOTREADY,
true => LSIRDY_A::READY,
}
}
#[doc = "Checks if the value of the field is `NOTREADY`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == LSIRDY_A::NOTREADY
}
#[doc = "Checks if the value of the field is `READY`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == LSIRDY_A::READY
}
}
#[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 = 1,
}
impl From<RMVF_A> for bool {
#[inline(always)]
fn from(variant: RMVF_A) -> Self {
variant as u8 != 0
}
}
#[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 << 24)) | (((value as u32) & 0x01) << 24);
self.w
}
}
#[doc = "Option byte loader reset flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OBLRSTF_A {
#[doc = "0: No reset has occured"]
NORESET = 0,
#[doc = "1: A reset has occured"]
RESET = 1,
}
impl From<OBLRSTF_A> for bool {
#[inline(always)]
fn from(variant: OBLRSTF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `OBLRSTF`"]
pub type OBLRSTF_R = crate::R<bool, OBLRSTF_A>;
impl OBLRSTF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> OBLRSTF_A {
match self.bits {
false => OBLRSTF_A::NORESET,
true => OBLRSTF_A::RESET,
}
}
#[doc = "Checks if the value of the field is `NORESET`"]
#[inline(always)]
pub fn is_no_reset(&self) -> bool {
*self == OBLRSTF_A::NORESET
}
#[doc = "Checks if the value of the field is `RESET`"]
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == OBLRSTF_A::RESET
}
}
#[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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 = "PIN reset flag"]
pub type PINRSTF_A = OBLRSTF_A;
#[doc = "Reader of field `PINRSTF`"]
pub type PINRSTF_R = crate::R<bool, OBLRSTF_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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 = "POR/PDR reset flag"]
pub type PORRSTF_A = OBLRSTF_A;
#[doc = "Reader of field `PORRSTF`"]
pub type PORRSTF_R = crate::R<bool, OBLRSTF_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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 = "Software reset flag"]
pub type SFTRSTF_A = OBLRSTF_A;
#[doc = "Reader of field `SFTRSTF`"]
pub type SFTRSTF_R = crate::R<bool, OBLRSTF_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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 = "Independent watchdog reset flag"]
pub type IWDGRSTF_A = OBLRSTF_A;
#[doc = "Reader of field `IWDGRSTF`"]
pub type IWDGRSTF_R = crate::R<bool, OBLRSTF_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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 = "Window watchdog reset flag"]
pub type WWDGRSTF_A = OBLRSTF_A;
#[doc = "Reader of field `WWDGRSTF`"]
pub type WWDGRSTF_R = crate::R<bool, OBLRSTF_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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 = "Low-power reset flag"]
pub type LPWRRSTF_A = OBLRSTF_A;
#[doc = "Reader of field `LPWRRSTF`"]
pub type LPWRRSTF_R = crate::R<bool, OBLRSTF_A>;
#[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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 = "Reset flag of the 1.8 V domain"]
pub type V18PWRRSTF_A = OBLRSTF_A;
#[doc = "Reader of field `V18PWRRSTF`"]
pub type V18PWRRSTF_R = crate::R<bool, OBLRSTF_A>;
#[doc = "Write proxy for field `V18PWRRSTF`"]
pub struct V18PWRRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> V18PWRRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: V18PWRRSTF_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(OBLRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(OBLRSTF_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 << 23)) | (((value as u32) & 0x01) << 23);
self.w
}
}
impl R {
#[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 1 - Internal low speed oscillator ready"]
#[inline(always)]
pub fn lsirdy(&self) -> LSIRDY_R {
LSIRDY_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 24 - Remove reset flag"]
#[inline(always)]
pub fn rmvf(&self) -> RMVF_R {
RMVF_R::new(((self.bits >> 24) & 0x01) != 0)
}
#[doc = "Bit 25 - Option byte loader reset flag"]
#[inline(always)]
pub fn oblrstf(&self) -> OBLRSTF_R {
OBLRSTF_R::new(((self.bits >> 25) & 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 27 - POR/PDR reset flag"]
#[inline(always)]
pub fn porrstf(&self) -> PORRSTF_R {
PORRSTF_R::new(((self.bits >> 27) & 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 29 - Independent watchdog reset flag"]
#[inline(always)]
pub fn iwdgrstf(&self) -> IWDGRSTF_R {
IWDGRSTF_R::new(((self.bits >> 29) & 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 31 - Low-power reset flag"]
#[inline(always)]
pub fn lpwrrstf(&self) -> LPWRRSTF_R {
LPWRRSTF_R::new(((self.bits >> 31) & 0x01) != 0)
}
#[doc = "Bit 23 - Reset flag of the 1.8 V domain"]
#[inline(always)]
pub fn v18pwrrstf(&self) -> V18PWRRSTF_R {
V18PWRRSTF_R::new(((self.bits >> 23) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Internal low speed oscillator enable"]
#[inline(always)]
pub fn lsion(&mut self) -> LSION_W {
LSION_W { w: self }
}
#[doc = "Bit 24 - Remove reset flag"]
#[inline(always)]
pub fn rmvf(&mut self) -> RMVF_W {
RMVF_W { w: self }
}
#[doc = "Bit 25 - Option byte loader reset flag"]
#[inline(always)]
pub fn oblrstf(&mut self) -> OBLRSTF_W {
OBLRSTF_W { w: self }
}
#[doc = "Bit 26 - PIN reset flag"]
#[inline(always)]
pub fn pinrstf(&mut self) -> PINRSTF_W {
PINRSTF_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 28 - Software reset flag"]
#[inline(always)]
pub fn sftrstf(&mut self) -> SFTRSTF_W {
SFTRSTF_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 30 - Window watchdog reset flag"]
#[inline(always)]
pub fn wwdgrstf(&mut self) -> WWDGRSTF_W {
WWDGRSTF_W { w: self }
}
#[doc = "Bit 31 - Low-power reset flag"]
#[inline(always)]
pub fn lpwrrstf(&mut self) -> LPWRRSTF_W {
LPWRRSTF_W { w: self }
}
#[doc = "Bit 23 - Reset flag of the 1.8 V domain"]
#[inline(always)]
pub fn v18pwrrstf(&mut self) -> V18PWRRSTF_W {
V18PWRRSTF_W { w: self }
}
}