#[doc = "Register `CR` reader"]
pub struct R(crate::R<CR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CR` writer"]
pub struct W(crate::W<CR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CR_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<CR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `PG` reader - Programming"]
pub type PG_R = crate::BitReader<bool>;
#[doc = "Field `PG` writer - Programming"]
pub type PG_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `PER` reader - Page erase"]
pub type PER_R = crate::BitReader<bool>;
#[doc = "Field `PER` writer - Page erase"]
pub type PER_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `MER` reader - Mass erase"]
pub type MER_R = crate::BitReader<bool>;
#[doc = "Field `MER` writer - Mass erase"]
pub type MER_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `SER` reader - Sector erase"]
pub type SER_R = crate::BitReader<bool>;
#[doc = "Field `SER` writer - Sector erase"]
pub type SER_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `OPTSTRT` reader - Option byte program start"]
pub type OPTSTRT_R = crate::BitReader<bool>;
#[doc = "Field `OPTSTRT` writer - Option byte program start"]
pub type OPTSTRT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `PGTSTRT` reader - Flash main memory program start"]
pub type PGTSTRT_R = crate::BitReader<bool>;
#[doc = "Field `PGTSTRT` writer - Flash main memory program start"]
pub type PGTSTRT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `EOPIE` reader - End of operation interrupt enable"]
pub type EOPIE_R = crate::BitReader<bool>;
#[doc = "Field `EOPIE` writer - End of operation interrupt enable"]
pub type EOPIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `ERRIE` reader - Error interrupt enable"]
pub type ERRIE_R = crate::BitReader<bool>;
#[doc = "Field `ERRIE` writer - Error interrupt enable"]
pub type ERRIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `OBL_LAUNCH` reader - Force the option byte loading"]
pub type OBL_LAUNCH_R = crate::BitReader<bool>;
#[doc = "Field `OBL_LAUNCH` writer - Force the option byte loading"]
pub type OBL_LAUNCH_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `OPTLOCK` reader - Options Lock"]
pub type OPTLOCK_R = crate::BitReader<bool>;
#[doc = "Field `OPTLOCK` writer - Options Lock"]
pub type OPTLOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
#[doc = "Field `LOCK` reader - FLASH_CR Lock"]
pub type LOCK_R = crate::BitReader<bool>;
#[doc = "Field `LOCK` writer - FLASH_CR Lock"]
pub type LOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
impl R {
#[doc = "Bit 0 - Programming"]
#[inline(always)]
pub fn pg(&self) -> PG_R {
PG_R::new((self.bits & 1) != 0)
}
#[doc = "Bit 1 - Page erase"]
#[inline(always)]
pub fn per(&self) -> PER_R {
PER_R::new(((self.bits >> 1) & 1) != 0)
}
#[doc = "Bit 2 - Mass erase"]
#[inline(always)]
pub fn mer(&self) -> MER_R {
MER_R::new(((self.bits >> 2) & 1) != 0)
}
#[doc = "Bit 11 - Sector erase"]
#[inline(always)]
pub fn ser(&self) -> SER_R {
SER_R::new(((self.bits >> 11) & 1) != 0)
}
#[doc = "Bit 17 - Option byte program start"]
#[inline(always)]
pub fn optstrt(&self) -> OPTSTRT_R {
OPTSTRT_R::new(((self.bits >> 17) & 1) != 0)
}
#[doc = "Bit 19 - Flash main memory program start"]
#[inline(always)]
pub fn pgtstrt(&self) -> PGTSTRT_R {
PGTSTRT_R::new(((self.bits >> 19) & 1) != 0)
}
#[doc = "Bit 24 - End of operation interrupt enable"]
#[inline(always)]
pub fn eopie(&self) -> EOPIE_R {
EOPIE_R::new(((self.bits >> 24) & 1) != 0)
}
#[doc = "Bit 25 - Error interrupt enable"]
#[inline(always)]
pub fn errie(&self) -> ERRIE_R {
ERRIE_R::new(((self.bits >> 25) & 1) != 0)
}
#[doc = "Bit 27 - Force the option byte loading"]
#[inline(always)]
pub fn obl_launch(&self) -> OBL_LAUNCH_R {
OBL_LAUNCH_R::new(((self.bits >> 27) & 1) != 0)
}
#[doc = "Bit 30 - Options Lock"]
#[inline(always)]
pub fn optlock(&self) -> OPTLOCK_R {
OPTLOCK_R::new(((self.bits >> 30) & 1) != 0)
}
#[doc = "Bit 31 - FLASH_CR Lock"]
#[inline(always)]
pub fn lock(&self) -> LOCK_R {
LOCK_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl W {
#[doc = "Bit 0 - Programming"]
#[inline(always)]
pub fn pg(&mut self) -> PG_W<0> {
PG_W::new(self)
}
#[doc = "Bit 1 - Page erase"]
#[inline(always)]
pub fn per(&mut self) -> PER_W<1> {
PER_W::new(self)
}
#[doc = "Bit 2 - Mass erase"]
#[inline(always)]
pub fn mer(&mut self) -> MER_W<2> {
MER_W::new(self)
}
#[doc = "Bit 11 - Sector erase"]
#[inline(always)]
pub fn ser(&mut self) -> SER_W<11> {
SER_W::new(self)
}
#[doc = "Bit 17 - Option byte program start"]
#[inline(always)]
pub fn optstrt(&mut self) -> OPTSTRT_W<17> {
OPTSTRT_W::new(self)
}
#[doc = "Bit 19 - Flash main memory program start"]
#[inline(always)]
pub fn pgtstrt(&mut self) -> PGTSTRT_W<19> {
PGTSTRT_W::new(self)
}
#[doc = "Bit 24 - End of operation interrupt enable"]
#[inline(always)]
pub fn eopie(&mut self) -> EOPIE_W<24> {
EOPIE_W::new(self)
}
#[doc = "Bit 25 - Error interrupt enable"]
#[inline(always)]
pub fn errie(&mut self) -> ERRIE_W<25> {
ERRIE_W::new(self)
}
#[doc = "Bit 27 - Force the option byte loading"]
#[inline(always)]
pub fn obl_launch(&mut self) -> OBL_LAUNCH_W<27> {
OBL_LAUNCH_W::new(self)
}
#[doc = "Bit 30 - Options Lock"]
#[inline(always)]
pub fn optlock(&mut self) -> OPTLOCK_W<30> {
OPTLOCK_W::new(self)
}
#[doc = "Bit 31 - FLASH_CR Lock"]
#[inline(always)]
pub fn lock(&mut self) -> LOCK_W<31> {
LOCK_W::new(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 = "Flash control 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 [cr](index.html) module"]
pub struct CR_SPEC;
impl crate::RegisterSpec for CR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [cr::R](R) reader structure"]
impl crate::Readable for CR_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cr::W](W) writer structure"]
impl crate::Writable for CR_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CR to value 0xc000_0000"]
impl crate::Resettable for CR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0xc000_0000
}
}