#[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 = "Field `LPWRSTF` reader - Low-power reset flag"]
pub struct LPWRSTF_R(crate::FieldReader<bool, bool>);
impl LPWRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
LPWRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LPWRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `WWDGRSTF` reader - Window watchdog reset flag"]
pub struct WWDGRSTF_R(crate::FieldReader<bool, bool>);
impl WWDGRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
WWDGRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for WWDGRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `IWDGRSTF` reader - Independent window watchdog reset flag"]
pub struct IWDGRSTF_R(crate::FieldReader<bool, bool>);
impl IWDGRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
IWDGRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for IWDGRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SFTRSTF` reader - Software reset flag"]
pub struct SFTRSTF_R(crate::FieldReader<bool, bool>);
impl SFTRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
SFTRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SFTRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BORRSTF` reader - BOR flag"]
pub struct BORRSTF_R(crate::FieldReader<bool, bool>);
impl BORRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
BORRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BORRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PINRSTF` reader - Pin reset flag"]
pub struct PINRSTF_R(crate::FieldReader<bool, bool>);
impl PINRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
PINRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PINRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OBLRSTF` reader - Option byte loader reset flag"]
pub struct OBLRSTF_R(crate::FieldReader<bool, bool>);
impl OBLRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
OBLRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OBLRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `FIREWALLRSTF` reader - Firewall reset flag"]
pub struct FIREWALLRSTF_R(crate::FieldReader<bool, bool>);
impl FIREWALLRSTF_R {
pub(crate) fn new(bits: bool) -> Self {
FIREWALLRSTF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for FIREWALLRSTF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RMVF` reader - Remove reset flag"]
pub struct RMVF_R(crate::FieldReader<bool, bool>);
impl RMVF_R {
pub(crate) fn new(bits: bool) -> Self {
RMVF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for RMVF_R {
type Target = crate::FieldReader<bool, bool>;
#[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"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
}
}
#[doc = "Field `MSISRANGE` reader - SI range after Standby mode"]
pub struct MSISRANGE_R(crate::FieldReader<u8, u8>);
impl MSISRANGE_R {
pub(crate) fn new(bits: u8) -> Self {
MSISRANGE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MSISRANGE_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MSISRANGE` writer - SI range after Standby mode"]
pub struct MSISRANGE_W<'a> {
w: &'a mut W,
}
impl<'a> MSISRANGE_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x0f << 8)) | ((value as u32 & 0x0f) << 8);
self.w
}
}
#[doc = "Field `LSIRDY` reader - LSI oscillator ready"]
pub struct LSIRDY_R(crate::FieldReader<bool, bool>);
impl LSIRDY_R {
pub(crate) fn new(bits: bool) -> Self {
LSIRDY_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSIRDY_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSION` reader - LSI oscillator enable"]
pub struct LSION_R(crate::FieldReader<bool, bool>);
impl LSION_R {
pub(crate) fn new(bits: bool) -> Self {
LSION_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSION_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSION` writer - LSI oscillator enable"]
pub struct LSION_W<'a> {
w: &'a mut W,
}
impl<'a> LSION_W<'a> {
#[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 lpwrstf(&self) -> LPWRSTF_R {
LPWRSTF_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 window 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 - BOR flag"]
#[inline(always)]
pub fn borrstf(&self) -> BORRSTF_R {
BORRSTF_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 - Option byte loader reset flag"]
#[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 firewallrstf(&self) -> FIREWALLRSTF_R {
FIREWALLRSTF_R::new(((self.bits >> 24) & 0x01) != 0)
}
#[doc = "Bit 23 - Remove reset flag"]
#[inline(always)]
pub fn rmvf(&self) -> RMVF_R {
RMVF_R::new(((self.bits >> 23) & 0x01) != 0)
}
#[doc = "Bits 8:11 - SI range after Standby mode"]
#[inline(always)]
pub fn msisrange(&self) -> MSISRANGE_R {
MSISRANGE_R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[doc = "Bit 1 - LSI oscillator ready"]
#[inline(always)]
pub fn lsirdy(&self) -> LSIRDY_R {
LSIRDY_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - LSI oscillator enable"]
#[inline(always)]
pub fn lsion(&self) -> LSION_R {
LSION_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 23 - Remove reset flag"]
#[inline(always)]
pub fn rmvf(&mut self) -> RMVF_W {
RMVF_W { w: self }
}
#[doc = "Bits 8:11 - SI range after Standby mode"]
#[inline(always)]
pub fn msisrange(&mut self) -> MSISRANGE_W {
MSISRANGE_W { w: self }
}
#[doc = "Bit 0 - LSI 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 = "CSR\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 0x0c00_0600"]
impl crate::Resettable for CSR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0x0c00_0600
}
}