pub type R = crate::R<PECRrs>;
pub type W = crate::W<PECRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PELOCK {
Unlocked = 0,
Locked = 1,
}
impl From<PELOCK> for bool {
#[inline(always)]
fn from(variant: PELOCK) -> Self {
variant as u8 != 0
}
}
pub type PELOCK_R = crate::BitReader<PELOCK>;
impl PELOCK_R {
#[inline(always)]
pub const fn variant(&self) -> PELOCK {
match self.bits {
false => PELOCK::Unlocked,
true => PELOCK::Locked,
}
}
#[inline(always)]
pub fn is_unlocked(&self) -> bool {
*self == PELOCK::Unlocked
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == PELOCK::Locked
}
}
pub type PELOCK_W<'a, REG> = crate::BitWriter<'a, REG, PELOCK>;
impl<'a, REG> PELOCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn unlocked(self) -> &'a mut crate::W<REG> {
self.variant(PELOCK::Unlocked)
}
#[inline(always)]
pub fn locked(self) -> &'a mut crate::W<REG> {
self.variant(PELOCK::Locked)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PRGLOCK {
Unlocked = 0,
Locked = 1,
}
impl From<PRGLOCK> for bool {
#[inline(always)]
fn from(variant: PRGLOCK) -> Self {
variant as u8 != 0
}
}
pub type PRGLOCK_R = crate::BitReader<PRGLOCK>;
impl PRGLOCK_R {
#[inline(always)]
pub const fn variant(&self) -> PRGLOCK {
match self.bits {
false => PRGLOCK::Unlocked,
true => PRGLOCK::Locked,
}
}
#[inline(always)]
pub fn is_unlocked(&self) -> bool {
*self == PRGLOCK::Unlocked
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == PRGLOCK::Locked
}
}
pub type PRGLOCK_W<'a, REG> = crate::BitWriter<'a, REG, PRGLOCK>;
impl<'a, REG> PRGLOCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn unlocked(self) -> &'a mut crate::W<REG> {
self.variant(PRGLOCK::Unlocked)
}
#[inline(always)]
pub fn locked(self) -> &'a mut crate::W<REG> {
self.variant(PRGLOCK::Locked)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OPTLOCK {
Unlocked = 0,
Locked = 1,
}
impl From<OPTLOCK> for bool {
#[inline(always)]
fn from(variant: OPTLOCK) -> Self {
variant as u8 != 0
}
}
pub type OPTLOCK_R = crate::BitReader<OPTLOCK>;
impl OPTLOCK_R {
#[inline(always)]
pub const fn variant(&self) -> OPTLOCK {
match self.bits {
false => OPTLOCK::Unlocked,
true => OPTLOCK::Locked,
}
}
#[inline(always)]
pub fn is_unlocked(&self) -> bool {
*self == OPTLOCK::Unlocked
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == OPTLOCK::Locked
}
}
pub type OPTLOCK_W<'a, REG> = crate::BitWriter<'a, REG, OPTLOCK>;
impl<'a, REG> OPTLOCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn unlocked(self) -> &'a mut crate::W<REG> {
self.variant(OPTLOCK::Unlocked)
}
#[inline(always)]
pub fn locked(self) -> &'a mut crate::W<REG> {
self.variant(OPTLOCK::Locked)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PROG {
NotSelected = 0,
Selected = 1,
}
impl From<PROG> for bool {
#[inline(always)]
fn from(variant: PROG) -> Self {
variant as u8 != 0
}
}
pub type PROG_R = crate::BitReader<PROG>;
impl PROG_R {
#[inline(always)]
pub const fn variant(&self) -> PROG {
match self.bits {
false => PROG::NotSelected,
true => PROG::Selected,
}
}
#[inline(always)]
pub fn is_not_selected(&self) -> bool {
*self == PROG::NotSelected
}
#[inline(always)]
pub fn is_selected(&self) -> bool {
*self == PROG::Selected
}
}
pub type PROG_W<'a, REG> = crate::BitWriter<'a, REG, PROG>;
impl<'a, REG> PROG_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_selected(self) -> &'a mut crate::W<REG> {
self.variant(PROG::NotSelected)
}
#[inline(always)]
pub fn selected(self) -> &'a mut crate::W<REG> {
self.variant(PROG::Selected)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DATA {
NotSelected = 0,
Selected = 1,
}
impl From<DATA> for bool {
#[inline(always)]
fn from(variant: DATA) -> Self {
variant as u8 != 0
}
}
pub type DATA_R = crate::BitReader<DATA>;
impl DATA_R {
#[inline(always)]
pub const fn variant(&self) -> DATA {
match self.bits {
false => DATA::NotSelected,
true => DATA::Selected,
}
}
#[inline(always)]
pub fn is_not_selected(&self) -> bool {
*self == DATA::NotSelected
}
#[inline(always)]
pub fn is_selected(&self) -> bool {
*self == DATA::Selected
}
}
pub type DATA_W<'a, REG> = crate::BitWriter<'a, REG, DATA>;
impl<'a, REG> DATA_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_selected(self) -> &'a mut crate::W<REG> {
self.variant(DATA::NotSelected)
}
#[inline(always)]
pub fn selected(self) -> &'a mut crate::W<REG> {
self.variant(DATA::Selected)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FIX {
AutoErase = 0,
PrelimErase = 1,
}
impl From<FIX> for bool {
#[inline(always)]
fn from(variant: FIX) -> Self {
variant as u8 != 0
}
}
pub type FIX_R = crate::BitReader<FIX>;
impl FIX_R {
#[inline(always)]
pub const fn variant(&self) -> FIX {
match self.bits {
false => FIX::AutoErase,
true => FIX::PrelimErase,
}
}
#[inline(always)]
pub fn is_auto_erase(&self) -> bool {
*self == FIX::AutoErase
}
#[inline(always)]
pub fn is_prelim_erase(&self) -> bool {
*self == FIX::PrelimErase
}
}
pub type FIX_W<'a, REG> = crate::BitWriter<'a, REG, FIX>;
impl<'a, REG> FIX_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn auto_erase(self) -> &'a mut crate::W<REG> {
self.variant(FIX::AutoErase)
}
#[inline(always)]
pub fn prelim_erase(self) -> &'a mut crate::W<REG> {
self.variant(FIX::PrelimErase)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERASE {
NoErase = 0,
Erase = 1,
}
impl From<ERASE> for bool {
#[inline(always)]
fn from(variant: ERASE) -> Self {
variant as u8 != 0
}
}
pub type ERASE_R = crate::BitReader<ERASE>;
impl ERASE_R {
#[inline(always)]
pub const fn variant(&self) -> ERASE {
match self.bits {
false => ERASE::NoErase,
true => ERASE::Erase,
}
}
#[inline(always)]
pub fn is_no_erase(&self) -> bool {
*self == ERASE::NoErase
}
#[inline(always)]
pub fn is_erase(&self) -> bool {
*self == ERASE::Erase
}
}
pub type ERASE_W<'a, REG> = crate::BitWriter<'a, REG, ERASE>;
impl<'a, REG> ERASE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn no_erase(self) -> &'a mut crate::W<REG> {
self.variant(ERASE::NoErase)
}
#[inline(always)]
pub fn erase(self) -> &'a mut crate::W<REG> {
self.variant(ERASE::Erase)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FPRG {
Disabled = 0,
Enabled = 1,
}
impl From<FPRG> for bool {
#[inline(always)]
fn from(variant: FPRG) -> Self {
variant as u8 != 0
}
}
pub type FPRG_R = crate::BitReader<FPRG>;
impl FPRG_R {
#[inline(always)]
pub const fn variant(&self) -> FPRG {
match self.bits {
false => FPRG::Disabled,
true => FPRG::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == FPRG::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == FPRG::Enabled
}
}
pub type FPRG_W<'a, REG> = crate::BitWriter<'a, REG, FPRG>;
impl<'a, REG> FPRG_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(FPRG::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(FPRG::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PARALLELBANK {
Disabled = 0,
Enabled = 1,
}
impl From<PARALLELBANK> for bool {
#[inline(always)]
fn from(variant: PARALLELBANK) -> Self {
variant as u8 != 0
}
}
pub type PARALLELBANK_R = crate::BitReader<PARALLELBANK>;
impl PARALLELBANK_R {
#[inline(always)]
pub const fn variant(&self) -> PARALLELBANK {
match self.bits {
false => PARALLELBANK::Disabled,
true => PARALLELBANK::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PARALLELBANK::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PARALLELBANK::Enabled
}
}
pub type PARALLELBANK_W<'a, REG> = crate::BitWriter<'a, REG, PARALLELBANK>;
impl<'a, REG> PARALLELBANK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(PARALLELBANK::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(PARALLELBANK::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EOPIE {
Disabled = 0,
Enabled = 1,
}
impl From<EOPIE> for bool {
#[inline(always)]
fn from(variant: EOPIE) -> Self {
variant as u8 != 0
}
}
pub type EOPIE_R = crate::BitReader<EOPIE>;
impl EOPIE_R {
#[inline(always)]
pub const fn variant(&self) -> EOPIE {
match self.bits {
false => EOPIE::Disabled,
true => EOPIE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EOPIE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EOPIE::Enabled
}
}
pub type EOPIE_W<'a, REG> = crate::BitWriter<'a, REG, EOPIE>;
impl<'a, REG> EOPIE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(EOPIE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(EOPIE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERRIE {
Disabled = 0,
Enabled = 1,
}
impl From<ERRIE> for bool {
#[inline(always)]
fn from(variant: ERRIE) -> Self {
variant as u8 != 0
}
}
pub type ERRIE_R = crate::BitReader<ERRIE>;
impl ERRIE_R {
#[inline(always)]
pub const fn variant(&self) -> ERRIE {
match self.bits {
false => ERRIE::Disabled,
true => ERRIE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ERRIE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ERRIE::Enabled
}
}
pub type ERRIE_W<'a, REG> = crate::BitWriter<'a, REG, ERRIE>;
impl<'a, REG> ERRIE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ERRIE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ERRIE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OBL_LAUNCHR {
Complete = 0,
NotComplete = 1,
}
impl From<OBL_LAUNCHR> for bool {
#[inline(always)]
fn from(variant: OBL_LAUNCHR) -> Self {
variant as u8 != 0
}
}
pub type OBL_LAUNCH_R = crate::BitReader<OBL_LAUNCHR>;
impl OBL_LAUNCH_R {
#[inline(always)]
pub const fn variant(&self) -> OBL_LAUNCHR {
match self.bits {
false => OBL_LAUNCHR::Complete,
true => OBL_LAUNCHR::NotComplete,
}
}
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == OBL_LAUNCHR::Complete
}
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == OBL_LAUNCHR::NotComplete
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OBL_LAUNCHW {
Reload = 1,
}
impl From<OBL_LAUNCHW> for bool {
#[inline(always)]
fn from(variant: OBL_LAUNCHW) -> Self {
variant as u8 != 0
}
}
pub type OBL_LAUNCH_W<'a, REG> = crate::BitWriter<'a, REG, OBL_LAUNCHW>;
impl<'a, REG> OBL_LAUNCH_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn reload(self) -> &'a mut crate::W<REG> {
self.variant(OBL_LAUNCHW::Reload)
}
}
pub type NZDISABLE_R = crate::BitReader;
pub type NZDISABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn pelock(&self) -> PELOCK_R {
PELOCK_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn prglock(&self) -> PRGLOCK_R {
PRGLOCK_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn optlock(&self) -> OPTLOCK_R {
OPTLOCK_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn prog(&self) -> PROG_R {
PROG_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn data(&self) -> DATA_R {
DATA_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn fix(&self) -> FIX_R {
FIX_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn erase(&self) -> ERASE_R {
ERASE_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn fprg(&self) -> FPRG_R {
FPRG_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn parallelbank(&self) -> PARALLELBANK_R {
PARALLELBANK_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn eopie(&self) -> EOPIE_R {
EOPIE_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn errie(&self) -> ERRIE_R {
ERRIE_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn obl_launch(&self) -> OBL_LAUNCH_R {
OBL_LAUNCH_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn nzdisable(&self) -> NZDISABLE_R {
NZDISABLE_R::new(((self.bits >> 23) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PECR")
.field("pelock", &self.pelock())
.field("prglock", &self.prglock())
.field("optlock", &self.optlock())
.field("prog", &self.prog())
.field("data", &self.data())
.field("fix", &self.fix())
.field("erase", &self.erase())
.field("fprg", &self.fprg())
.field("parallelbank", &self.parallelbank())
.field("eopie", &self.eopie())
.field("errie", &self.errie())
.field("obl_launch", &self.obl_launch())
.field("nzdisable", &self.nzdisable())
.finish()
}
}
impl W {
#[inline(always)]
pub fn pelock(&mut self) -> PELOCK_W<PECRrs> {
PELOCK_W::new(self, 0)
}
#[inline(always)]
pub fn prglock(&mut self) -> PRGLOCK_W<PECRrs> {
PRGLOCK_W::new(self, 1)
}
#[inline(always)]
pub fn optlock(&mut self) -> OPTLOCK_W<PECRrs> {
OPTLOCK_W::new(self, 2)
}
#[inline(always)]
pub fn prog(&mut self) -> PROG_W<PECRrs> {
PROG_W::new(self, 3)
}
#[inline(always)]
pub fn data(&mut self) -> DATA_W<PECRrs> {
DATA_W::new(self, 4)
}
#[inline(always)]
pub fn fix(&mut self) -> FIX_W<PECRrs> {
FIX_W::new(self, 8)
}
#[inline(always)]
pub fn erase(&mut self) -> ERASE_W<PECRrs> {
ERASE_W::new(self, 9)
}
#[inline(always)]
pub fn fprg(&mut self) -> FPRG_W<PECRrs> {
FPRG_W::new(self, 10)
}
#[inline(always)]
pub fn parallelbank(&mut self) -> PARALLELBANK_W<PECRrs> {
PARALLELBANK_W::new(self, 15)
}
#[inline(always)]
pub fn eopie(&mut self) -> EOPIE_W<PECRrs> {
EOPIE_W::new(self, 16)
}
#[inline(always)]
pub fn errie(&mut self) -> ERRIE_W<PECRrs> {
ERRIE_W::new(self, 17)
}
#[inline(always)]
pub fn obl_launch(&mut self) -> OBL_LAUNCH_W<PECRrs> {
OBL_LAUNCH_W::new(self, 18)
}
#[inline(always)]
pub fn nzdisable(&mut self) -> NZDISABLE_W<PECRrs> {
NZDISABLE_W::new(self, 23)
}
}
pub struct PECRrs;
impl crate::RegisterSpec for PECRrs {
type Ux = u32;
}
impl crate::Readable for PECRrs {}
impl crate::Writable for PECRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for PECRrs {
const RESET_VALUE: u32 = 0x07;
}