#[doc = "Register `CSR` reader"]
pub struct R(crate::R<CSR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CSR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CSR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CSR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CSR` writer"]
pub struct W(crate::W<CSR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CSR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<CSR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CSR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Low-power reset flag"]
pub type LPWRRSTF_A = BORRSTF_A;
#[doc = "Field `LPWRRSTF` reader - Low-power reset flag"]
pub type LPWRRSTF_R = BORRSTF_R;
#[doc = "Field `LPWRRSTF` writer - Low-power reset flag"]
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 = BORRSTF_A;
#[doc = "Field `WWDGRSTF` reader - Window watchdog reset flag"]
pub type WWDGRSTF_R = BORRSTF_R;
#[doc = "Field `WWDGRSTF` writer - Window watchdog reset flag"]
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(WWDGRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(WWDGRSTF_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 WDGRSTF_A = BORRSTF_A;
#[doc = "Field `WDGRSTF` reader - Independent watchdog reset flag"]
pub type WDGRSTF_R = BORRSTF_R;
#[doc = "Field `WDGRSTF` writer - Independent watchdog reset flag"]
pub struct WDGRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> WDGRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: WDGRSTF_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(WDGRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(WDGRSTF_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 = BORRSTF_A;
#[doc = "Field `SFTRSTF` reader - Software reset flag"]
pub type SFTRSTF_R = BORRSTF_R;
#[doc = "Field `SFTRSTF` writer - Software reset flag"]
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(SFTRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(SFTRSTF_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 = BORRSTF_A;
#[doc = "Field `PORRSTF` reader - POR/PDR reset flag"]
pub type PORRSTF_R = BORRSTF_R;
#[doc = "Field `PORRSTF` writer - POR/PDR reset flag"]
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(PORRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(PORRSTF_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 PADRSTF_A = BORRSTF_A;
#[doc = "Field `PADRSTF` reader - PIN reset flag"]
pub type PADRSTF_R = BORRSTF_R;
#[doc = "Field `PADRSTF` writer - PIN reset flag"]
pub struct PADRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> PADRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PADRSTF_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(PADRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(PADRSTF_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 = "BOR reset flag\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BORRSTF_A {
#[doc = "0: No reset has occured"]
NORESET = 0,
#[doc = "1: A reset has occured"]
RESET = 1,
}
impl From<BORRSTF_A> for bool {
#[inline(always)]
fn from(variant: BORRSTF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `BORRSTF` reader - BOR reset flag"]
pub struct BORRSTF_R(crate::FieldReader<bool, BORRSTF_A>);
impl BORRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
BORRSTF_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> BORRSTF_A {
match self.bits {
false => BORRSTF_A::NORESET,
true => BORRSTF_A::RESET,
}
}
#[doc = "Checks if the value of the field is `NORESET`"]
#[inline(always)]
pub fn is_no_reset(&self) -> bool {
**self == BORRSTF_A::NORESET
}
#[doc = "Checks if the value of the field is `RESET`"]
#[inline(always)]
pub fn is_reset(&self) -> bool {
**self == BORRSTF_A::RESET
}
}
impl core::ops::Deref for BORRSTF_R {
type Target = crate::FieldReader<bool, BORRSTF_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BORRSTF` writer - BOR reset flag"]
pub struct BORRSTF_W<'a> {
w: &'a mut W,
}
impl<'a> BORRSTF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: BORRSTF_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(BORRSTF_A::NORESET)
}
#[doc = "A reset has occured"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(BORRSTF_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 = "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 = "Field `RMVF` reader - Remove reset flag"]
pub struct RMVF_R(crate::FieldReader<bool, RMVF_A>);
impl RMVF_R {
pub(crate) fn new(bits: bool) -> Self {
RMVF_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<RMVF_A> {
match self.bits {
true => Some(RMVF_A::CLEAR),
_ => None,
}
}
#[doc = "Checks if the value of the field is `CLEAR`"]
#[inline(always)]
pub fn is_clear(&self) -> bool {
**self == RMVF_A::CLEAR
}
}
impl core::ops::Deref for RMVF_R {
type Target = crate::FieldReader<bool, RMVF_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RMVF` writer - Remove reset flag"]
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 = "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 = "Field `LSIRDY` reader - Internal low-speed oscillator ready"]
pub struct LSIRDY_R(crate::FieldReader<bool, LSIRDY_A>);
impl LSIRDY_R {
pub(crate) fn new(bits: bool) -> Self {
LSIRDY_R(crate::FieldReader::new(bits))
}
#[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
}
}
impl core::ops::Deref for LSIRDY_R {
type Target = crate::FieldReader<bool, LSIRDY_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[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 = "Field `LSION` reader - Internal low-speed oscillator enable"]
pub struct LSION_R(crate::FieldReader<bool, LSION_A>);
impl LSION_R {
pub(crate) fn new(bits: bool) -> Self {
LSION_R(crate::FieldReader::new(bits))
}
#[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
}
}
impl core::ops::Deref for LSION_R {
type Target = crate::FieldReader<bool, LSION_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSION` writer - Internal low-speed oscillator enable"]
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
}
}
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 wdgrstf(&self) -> WDGRSTF_R {
WDGRSTF_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 padrstf(&self) -> PADRSTF_R {
PADRSTF_R::new(((self.bits >> 26) & 0x01) != 0)
}
#[doc = "Bit 25 - BOR reset flag"]
#[inline(always)]
pub fn borrstf(&self) -> BORRSTF_R {
BORRSTF_R::new(((self.bits >> 25) & 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 1 - Internal low-speed oscillator ready"]
#[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)
}
}
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 wdgrstf(&mut self) -> WDGRSTF_W {
WDGRSTF_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 padrstf(&mut self) -> PADRSTF_W {
PADRSTF_W { w: self }
}
#[doc = "Bit 25 - BOR reset flag"]
#[inline(always)]
pub fn borrstf(&mut self) -> BORRSTF_W {
BORRSTF_W { w: self }
}
#[doc = "Bit 24 - Remove reset flag"]
#[inline(always)]
pub fn rmvf(&mut self) -> RMVF_W {
RMVF_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 = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "clock control & status register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [csr](index.html) module"]
pub struct CSR_SPEC;
impl crate::RegisterSpec for CSR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [csr::R](R) reader structure"]
impl crate::Readable for CSR_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [csr::W](W) writer structure"]
impl crate::Writable for CSR_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CSR to value 0x0e00_0000"]
impl crate::Resettable for CSR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0x0e00_0000
}
}