pub type R = crate::R<CRrs>;
pub type W = crate::W<CRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PG {
Program = 1,
}
impl From<PG> for bool {
#[inline(always)]
fn from(variant: PG) -> Self {
variant as u8 != 0
}
}
pub type PG_R = crate::BitReader<PG>;
impl PG_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PG> {
match self.bits {
true => Some(PG::Program),
_ => None,
}
}
#[inline(always)]
pub fn is_program(&self) -> bool {
*self == PG::Program
}
}
pub type PG_W<'a, REG> = crate::BitWriter<'a, REG, PG>;
impl<'a, REG> PG_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn program(self) -> &'a mut crate::W<REG> {
self.variant(PG::Program)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SER {
SectorErase = 1,
}
impl From<SER> for bool {
#[inline(always)]
fn from(variant: SER) -> Self {
variant as u8 != 0
}
}
pub type SER_R = crate::BitReader<SER>;
impl SER_R {
#[inline(always)]
pub const fn variant(&self) -> Option<SER> {
match self.bits {
true => Some(SER::SectorErase),
_ => None,
}
}
#[inline(always)]
pub fn is_sector_erase(&self) -> bool {
*self == SER::SectorErase
}
}
pub type SER_W<'a, REG> = crate::BitWriter<'a, REG, SER>;
impl<'a, REG> SER_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn sector_erase(self) -> &'a mut crate::W<REG> {
self.variant(SER::SectorErase)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MER {
MassErase = 1,
}
impl From<MER> for bool {
#[inline(always)]
fn from(variant: MER) -> Self {
variant as u8 != 0
}
}
pub type MER_R = crate::BitReader<MER>;
impl MER_R {
#[inline(always)]
pub const fn variant(&self) -> Option<MER> {
match self.bits {
true => Some(MER::MassErase),
_ => None,
}
}
#[inline(always)]
pub fn is_mass_erase(&self) -> bool {
*self == MER::MassErase
}
}
pub type MER_W<'a, REG> = crate::BitWriter<'a, REG, MER>;
impl<'a, REG> MER_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn mass_erase(self) -> &'a mut crate::W<REG> {
self.variant(MER::MassErase)
}
}
pub type SNB_R = crate::FieldReader;
pub type SNB_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PSIZE {
Psize8 = 0,
Psize16 = 1,
Psize32 = 2,
Psize64 = 3,
}
impl From<PSIZE> for u8 {
#[inline(always)]
fn from(variant: PSIZE) -> Self {
variant as _
}
}
impl crate::FieldSpec for PSIZE {
type Ux = u8;
}
impl crate::IsEnum for PSIZE {}
pub type PSIZE_R = crate::FieldReader<PSIZE>;
impl PSIZE_R {
#[inline(always)]
pub const fn variant(&self) -> PSIZE {
match self.bits {
0 => PSIZE::Psize8,
1 => PSIZE::Psize16,
2 => PSIZE::Psize32,
3 => PSIZE::Psize64,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_psize8(&self) -> bool {
*self == PSIZE::Psize8
}
#[inline(always)]
pub fn is_psize16(&self) -> bool {
*self == PSIZE::Psize16
}
#[inline(always)]
pub fn is_psize32(&self) -> bool {
*self == PSIZE::Psize32
}
#[inline(always)]
pub fn is_psize64(&self) -> bool {
*self == PSIZE::Psize64
}
}
pub type PSIZE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PSIZE, crate::Safe>;
impl<'a, REG> PSIZE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn psize8(self) -> &'a mut crate::W<REG> {
self.variant(PSIZE::Psize8)
}
#[inline(always)]
pub fn psize16(self) -> &'a mut crate::W<REG> {
self.variant(PSIZE::Psize16)
}
#[inline(always)]
pub fn psize32(self) -> &'a mut crate::W<REG> {
self.variant(PSIZE::Psize32)
}
#[inline(always)]
pub fn psize64(self) -> &'a mut crate::W<REG> {
self.variant(PSIZE::Psize64)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STRT {
Start = 1,
}
impl From<STRT> for bool {
#[inline(always)]
fn from(variant: STRT) -> Self {
variant as u8 != 0
}
}
pub type STRT_R = crate::BitReader<STRT>;
impl STRT_R {
#[inline(always)]
pub const fn variant(&self) -> Option<STRT> {
match self.bits {
true => Some(STRT::Start),
_ => None,
}
}
#[inline(always)]
pub fn is_start(&self) -> bool {
*self == STRT::Start
}
}
pub type STRT_W<'a, REG> = crate::BitWriter<'a, REG, STRT>;
impl<'a, REG> STRT_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn start(self) -> &'a mut crate::W<REG> {
self.variant(STRT::Start)
}
}
#[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 LOCK {
Unlocked = 0,
Locked = 1,
}
impl From<LOCK> for bool {
#[inline(always)]
fn from(variant: LOCK) -> Self {
variant as u8 != 0
}
}
pub type LOCK_R = crate::BitReader<LOCK>;
impl LOCK_R {
#[inline(always)]
pub const fn variant(&self) -> LOCK {
match self.bits {
false => LOCK::Unlocked,
true => LOCK::Locked,
}
}
#[inline(always)]
pub fn is_unlocked(&self) -> bool {
*self == LOCK::Unlocked
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == LOCK::Locked
}
}
pub type LOCK_W<'a, REG> = crate::BitWriter<'a, REG, LOCK>;
impl<'a, REG> LOCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn unlocked(self) -> &'a mut crate::W<REG> {
self.variant(LOCK::Unlocked)
}
#[inline(always)]
pub fn locked(self) -> &'a mut crate::W<REG> {
self.variant(LOCK::Locked)
}
}
impl R {
#[inline(always)]
pub fn pg(&self) -> PG_R {
PG_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn ser(&self) -> SER_R {
SER_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn mer(&self) -> MER_R {
MER_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn snb(&self) -> SNB_R {
SNB_R::new(((self.bits >> 3) & 0x0f) as u8)
}
#[inline(always)]
pub fn psize(&self) -> PSIZE_R {
PSIZE_R::new(((self.bits >> 8) & 3) as u8)
}
#[inline(always)]
pub fn strt(&self) -> STRT_R {
STRT_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn eopie(&self) -> EOPIE_R {
EOPIE_R::new(((self.bits >> 24) & 1) != 0)
}
#[inline(always)]
pub fn errie(&self) -> ERRIE_R {
ERRIE_R::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn lock(&self) -> LOCK_R {
LOCK_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR")
.field("pg", &self.pg())
.field("ser", &self.ser())
.field("mer", &self.mer())
.field("snb", &self.snb())
.field("psize", &self.psize())
.field("strt", &self.strt())
.field("eopie", &self.eopie())
.field("errie", &self.errie())
.field("lock", &self.lock())
.finish()
}
}
impl W {
#[inline(always)]
pub fn pg(&mut self) -> PG_W<CRrs> {
PG_W::new(self, 0)
}
#[inline(always)]
pub fn ser(&mut self) -> SER_W<CRrs> {
SER_W::new(self, 1)
}
#[inline(always)]
pub fn mer(&mut self) -> MER_W<CRrs> {
MER_W::new(self, 2)
}
#[inline(always)]
pub fn snb(&mut self) -> SNB_W<CRrs> {
SNB_W::new(self, 3)
}
#[inline(always)]
pub fn psize(&mut self) -> PSIZE_W<CRrs> {
PSIZE_W::new(self, 8)
}
#[inline(always)]
pub fn strt(&mut self) -> STRT_W<CRrs> {
STRT_W::new(self, 16)
}
#[inline(always)]
pub fn eopie(&mut self) -> EOPIE_W<CRrs> {
EOPIE_W::new(self, 24)
}
#[inline(always)]
pub fn errie(&mut self) -> ERRIE_W<CRrs> {
ERRIE_W::new(self, 25)
}
#[inline(always)]
pub fn lock(&mut self) -> LOCK_W<CRrs> {
LOCK_W::new(self, 31)
}
}
pub struct CRrs;
impl crate::RegisterSpec for CRrs {
type Ux = u32;
}
impl crate::Readable for CRrs {}
impl crate::Writable for CRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CRrs {
const RESET_VALUE: u32 = 0x8000_0000;
}