#[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 struct PG_R(crate::FieldReader<bool, bool>);
impl PG_R {
pub(crate) fn new(bits: bool) -> Self {
PG_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PG_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PG` writer - Programming"]
pub struct PG_W<'a> {
w: &'a mut W,
}
impl<'a> PG_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
}
}
#[doc = "Field `PER` reader - Page erase"]
pub struct PER_R(crate::FieldReader<bool, bool>);
impl PER_R {
pub(crate) fn new(bits: bool) -> Self {
PER_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PER_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PER` writer - Page erase"]
pub struct PER_W<'a> {
w: &'a mut W,
}
impl<'a> PER_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 << 1)) | ((value as u32 & 0x01) << 1);
self.w
}
}
#[doc = "Field `MER` reader - This bit triggers the mass erase (all user pages) when set"]
pub struct MER_R(crate::FieldReader<bool, bool>);
impl MER_R {
pub(crate) fn new(bits: bool) -> Self {
MER_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MER_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MER` writer - This bit triggers the mass erase (all user pages) when set"]
pub struct MER_W<'a> {
w: &'a mut W,
}
impl<'a> MER_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 << 2)) | ((value as u32 & 0x01) << 2);
self.w
}
}
#[doc = "Field `PNB` reader - Page number selection"]
pub struct PNB_R(crate::FieldReader<u8, u8>);
impl PNB_R {
pub(crate) fn new(bits: u8) -> Self {
PNB_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PNB_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PNB` writer - Page number selection"]
pub struct PNB_W<'a> {
w: &'a mut W,
}
impl<'a> PNB_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 & !(0xff << 3)) | ((value as u32 & 0xff) << 3);
self.w
}
}
#[doc = "Field `STRT` reader - Start"]
pub struct STRT_R(crate::FieldReader<bool, bool>);
impl STRT_R {
pub(crate) fn new(bits: bool) -> Self {
STRT_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for STRT_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `STRT` writer - Start"]
pub struct STRT_W<'a> {
w: &'a mut W,
}
impl<'a> STRT_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 << 16)) | ((value as u32 & 0x01) << 16);
self.w
}
}
#[doc = "Field `OPTSTRT` reader - Options modification start"]
pub struct OPTSTRT_R(crate::FieldReader<bool, bool>);
impl OPTSTRT_R {
pub(crate) fn new(bits: bool) -> Self {
OPTSTRT_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OPTSTRT_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OPTSTRT` writer - Options modification start"]
pub struct OPTSTRT_W<'a> {
w: &'a mut W,
}
impl<'a> OPTSTRT_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 << 17)) | ((value as u32 & 0x01) << 17);
self.w
}
}
#[doc = "Field `FSTPG` reader - Fast programming"]
pub struct FSTPG_R(crate::FieldReader<bool, bool>);
impl FSTPG_R {
pub(crate) fn new(bits: bool) -> Self {
FSTPG_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for FSTPG_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `FSTPG` writer - Fast programming"]
pub struct FSTPG_W<'a> {
w: &'a mut W,
}
impl<'a> FSTPG_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 << 18)) | ((value as u32 & 0x01) << 18);
self.w
}
}
#[doc = "Field `EOPIE` reader - End of operation interrupt enable"]
pub struct EOPIE_R(crate::FieldReader<bool, bool>);
impl EOPIE_R {
pub(crate) fn new(bits: bool) -> Self {
EOPIE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for EOPIE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `EOPIE` writer - End of operation interrupt enable"]
pub struct EOPIE_W<'a> {
w: &'a mut W,
}
impl<'a> EOPIE_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 << 24)) | ((value as u32 & 0x01) << 24);
self.w
}
}
#[doc = "Field `ERRIE` reader - Error interrupt enable"]
pub struct ERRIE_R(crate::FieldReader<bool, bool>);
impl ERRIE_R {
pub(crate) fn new(bits: bool) -> Self {
ERRIE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for ERRIE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ERRIE` writer - Error interrupt enable"]
pub struct ERRIE_W<'a> {
w: &'a mut W,
}
impl<'a> ERRIE_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 << 25)) | ((value as u32 & 0x01) << 25);
self.w
}
}
#[doc = "Field `RDERRIE` reader - PCROP read error interrupt enable"]
pub struct RDERRIE_R(crate::FieldReader<bool, bool>);
impl RDERRIE_R {
pub(crate) fn new(bits: bool) -> Self {
RDERRIE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for RDERRIE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RDERRIE` writer - PCROP read error interrupt enable"]
pub struct RDERRIE_W<'a> {
w: &'a mut W,
}
impl<'a> RDERRIE_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 << 26)) | ((value as u32 & 0x01) << 26);
self.w
}
}
#[doc = "Field `OBL_LAUNCH` reader - Force the option byte loading"]
pub struct OBL_LAUNCH_R(crate::FieldReader<bool, bool>);
impl OBL_LAUNCH_R {
pub(crate) fn new(bits: bool) -> Self {
OBL_LAUNCH_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OBL_LAUNCH_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OBL_LAUNCH` writer - Force the option byte loading"]
pub struct OBL_LAUNCH_W<'a> {
w: &'a mut W,
}
impl<'a> OBL_LAUNCH_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 << 27)) | ((value as u32 & 0x01) << 27);
self.w
}
}
#[doc = "Field `OPTLOCK` reader - Options Lock"]
pub struct OPTLOCK_R(crate::FieldReader<bool, bool>);
impl OPTLOCK_R {
pub(crate) fn new(bits: bool) -> Self {
OPTLOCK_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OPTLOCK_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OPTLOCK` writer - Options Lock"]
pub struct OPTLOCK_W<'a> {
w: &'a mut W,
}
impl<'a> OPTLOCK_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 << 30)) | ((value as u32 & 0x01) << 30);
self.w
}
}
#[doc = "Field `LOCK` reader - FLASH_CR Lock"]
pub struct LOCK_R(crate::FieldReader<bool, bool>);
impl LOCK_R {
pub(crate) fn new(bits: bool) -> Self {
LOCK_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LOCK_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LOCK` writer - FLASH_CR Lock"]
pub struct LOCK_W<'a> {
w: &'a mut W,
}
impl<'a> LOCK_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 << 31)) | ((value as u32 & 0x01) << 31);
self.w
}
}
impl R {
#[doc = "Bit 0 - Programming"]
#[inline(always)]
pub fn pg(&self) -> PG_R {
PG_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Page erase"]
#[inline(always)]
pub fn per(&self) -> PER_R {
PER_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - This bit triggers the mass erase (all user pages) when set"]
#[inline(always)]
pub fn mer(&self) -> MER_R {
MER_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bits 3:10 - Page number selection"]
#[inline(always)]
pub fn pnb(&self) -> PNB_R {
PNB_R::new(((self.bits >> 3) & 0xff) as u8)
}
#[doc = "Bit 16 - Start"]
#[inline(always)]
pub fn strt(&self) -> STRT_R {
STRT_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 17 - Options modification start"]
#[inline(always)]
pub fn optstrt(&self) -> OPTSTRT_R {
OPTSTRT_R::new(((self.bits >> 17) & 0x01) != 0)
}
#[doc = "Bit 18 - Fast programming"]
#[inline(always)]
pub fn fstpg(&self) -> FSTPG_R {
FSTPG_R::new(((self.bits >> 18) & 0x01) != 0)
}
#[doc = "Bit 24 - End of operation interrupt enable"]
#[inline(always)]
pub fn eopie(&self) -> EOPIE_R {
EOPIE_R::new(((self.bits >> 24) & 0x01) != 0)
}
#[doc = "Bit 25 - Error interrupt enable"]
#[inline(always)]
pub fn errie(&self) -> ERRIE_R {
ERRIE_R::new(((self.bits >> 25) & 0x01) != 0)
}
#[doc = "Bit 26 - PCROP read error interrupt enable"]
#[inline(always)]
pub fn rderrie(&self) -> RDERRIE_R {
RDERRIE_R::new(((self.bits >> 26) & 0x01) != 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) & 0x01) != 0)
}
#[doc = "Bit 30 - Options Lock"]
#[inline(always)]
pub fn optlock(&self) -> OPTLOCK_R {
OPTLOCK_R::new(((self.bits >> 30) & 0x01) != 0)
}
#[doc = "Bit 31 - FLASH_CR Lock"]
#[inline(always)]
pub fn lock(&self) -> LOCK_R {
LOCK_R::new(((self.bits >> 31) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Programming"]
#[inline(always)]
pub fn pg(&mut self) -> PG_W {
PG_W { w: self }
}
#[doc = "Bit 1 - Page erase"]
#[inline(always)]
pub fn per(&mut self) -> PER_W {
PER_W { w: self }
}
#[doc = "Bit 2 - This bit triggers the mass erase (all user pages) when set"]
#[inline(always)]
pub fn mer(&mut self) -> MER_W {
MER_W { w: self }
}
#[doc = "Bits 3:10 - Page number selection"]
#[inline(always)]
pub fn pnb(&mut self) -> PNB_W {
PNB_W { w: self }
}
#[doc = "Bit 16 - Start"]
#[inline(always)]
pub fn strt(&mut self) -> STRT_W {
STRT_W { w: self }
}
#[doc = "Bit 17 - Options modification start"]
#[inline(always)]
pub fn optstrt(&mut self) -> OPTSTRT_W {
OPTSTRT_W { w: self }
}
#[doc = "Bit 18 - Fast programming"]
#[inline(always)]
pub fn fstpg(&mut self) -> FSTPG_W {
FSTPG_W { w: self }
}
#[doc = "Bit 24 - End of operation interrupt enable"]
#[inline(always)]
pub fn eopie(&mut self) -> EOPIE_W {
EOPIE_W { w: self }
}
#[doc = "Bit 25 - Error interrupt enable"]
#[inline(always)]
pub fn errie(&mut self) -> ERRIE_W {
ERRIE_W { w: self }
}
#[doc = "Bit 26 - PCROP read error interrupt enable"]
#[inline(always)]
pub fn rderrie(&mut self) -> RDERRIE_W {
RDERRIE_W { w: self }
}
#[doc = "Bit 27 - Force the option byte loading"]
#[inline(always)]
pub fn obl_launch(&mut self) -> OBL_LAUNCH_W {
OBL_LAUNCH_W { w: self }
}
#[doc = "Bit 30 - Options Lock"]
#[inline(always)]
pub fn optlock(&mut self) -> OPTLOCK_W {
OPTLOCK_W { w: self }
}
#[doc = "Bit 31 - FLASH_CR Lock"]
#[inline(always)]
pub fn lock(&mut self) -> LOCK_W {
LOCK_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 = "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
}
}