pub type R = crate::R<PCRrs>;
pub type W = crate::W<PCRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PWAITEN {
Disabled = 0,
Enabled = 1,
}
impl From<PWAITEN> for bool {
#[inline(always)]
fn from(variant: PWAITEN) -> Self {
variant as u8 != 0
}
}
pub type PWAITEN_R = crate::BitReader<PWAITEN>;
impl PWAITEN_R {
#[inline(always)]
pub const fn variant(&self) -> PWAITEN {
match self.bits {
false => PWAITEN::Disabled,
true => PWAITEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PWAITEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PWAITEN::Enabled
}
}
pub type PWAITEN_W<'a, REG> = crate::BitWriter<'a, REG, PWAITEN>;
impl<'a, REG> PWAITEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(PWAITEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(PWAITEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PBKEN {
Disabled = 0,
Enabled = 1,
}
impl From<PBKEN> for bool {
#[inline(always)]
fn from(variant: PBKEN) -> Self {
variant as u8 != 0
}
}
pub type PBKEN_R = crate::BitReader<PBKEN>;
impl PBKEN_R {
#[inline(always)]
pub const fn variant(&self) -> PBKEN {
match self.bits {
false => PBKEN::Disabled,
true => PBKEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PBKEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PBKEN::Enabled
}
}
pub type PBKEN_W<'a, REG> = crate::BitWriter<'a, REG, PBKEN>;
impl<'a, REG> PBKEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(PBKEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(PBKEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PTYP {
Nandflash = 1,
}
impl From<PTYP> for bool {
#[inline(always)]
fn from(variant: PTYP) -> Self {
variant as u8 != 0
}
}
pub type PTYP_R = crate::BitReader<PTYP>;
impl PTYP_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PTYP> {
match self.bits {
true => Some(PTYP::Nandflash),
_ => None,
}
}
#[inline(always)]
pub fn is_nandflash(&self) -> bool {
*self == PTYP::Nandflash
}
}
pub type PTYP_W<'a, REG> = crate::BitWriter<'a, REG, PTYP>;
impl<'a, REG> PTYP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn nandflash(self) -> &'a mut crate::W<REG> {
self.variant(PTYP::Nandflash)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PWID {
Bits8 = 0,
Bits16 = 1,
}
impl From<PWID> for u8 {
#[inline(always)]
fn from(variant: PWID) -> Self {
variant as _
}
}
impl crate::FieldSpec for PWID {
type Ux = u8;
}
impl crate::IsEnum for PWID {}
pub type PWID_R = crate::FieldReader<PWID>;
impl PWID_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PWID> {
match self.bits {
0 => Some(PWID::Bits8),
1 => Some(PWID::Bits16),
_ => None,
}
}
#[inline(always)]
pub fn is_bits8(&self) -> bool {
*self == PWID::Bits8
}
#[inline(always)]
pub fn is_bits16(&self) -> bool {
*self == PWID::Bits16
}
}
pub type PWID_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PWID>;
impl<'a, REG> PWID_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bits8(self) -> &'a mut crate::W<REG> {
self.variant(PWID::Bits8)
}
#[inline(always)]
pub fn bits16(self) -> &'a mut crate::W<REG> {
self.variant(PWID::Bits16)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ECCEN {
Disabled = 0,
Enabled = 1,
}
impl From<ECCEN> for bool {
#[inline(always)]
fn from(variant: ECCEN) -> Self {
variant as u8 != 0
}
}
pub type ECCEN_R = crate::BitReader<ECCEN>;
impl ECCEN_R {
#[inline(always)]
pub const fn variant(&self) -> ECCEN {
match self.bits {
false => ECCEN::Disabled,
true => ECCEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ECCEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ECCEN::Enabled
}
}
pub type ECCEN_W<'a, REG> = crate::BitWriter<'a, REG, ECCEN>;
impl<'a, REG> ECCEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ECCEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ECCEN::Enabled)
}
}
pub type TCLR_R = crate::FieldReader;
pub type TCLR_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
pub type TAR_R = crate::FieldReader;
pub type TAR_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ECCPS {
Bytes256 = 0,
Bytes512 = 1,
Bytes1024 = 2,
Bytes2048 = 3,
Bytes4096 = 4,
Bytes8192 = 5,
}
impl From<ECCPS> for u8 {
#[inline(always)]
fn from(variant: ECCPS) -> Self {
variant as _
}
}
impl crate::FieldSpec for ECCPS {
type Ux = u8;
}
impl crate::IsEnum for ECCPS {}
pub type ECCPS_R = crate::FieldReader<ECCPS>;
impl ECCPS_R {
#[inline(always)]
pub const fn variant(&self) -> Option<ECCPS> {
match self.bits {
0 => Some(ECCPS::Bytes256),
1 => Some(ECCPS::Bytes512),
2 => Some(ECCPS::Bytes1024),
3 => Some(ECCPS::Bytes2048),
4 => Some(ECCPS::Bytes4096),
5 => Some(ECCPS::Bytes8192),
_ => None,
}
}
#[inline(always)]
pub fn is_bytes256(&self) -> bool {
*self == ECCPS::Bytes256
}
#[inline(always)]
pub fn is_bytes512(&self) -> bool {
*self == ECCPS::Bytes512
}
#[inline(always)]
pub fn is_bytes1024(&self) -> bool {
*self == ECCPS::Bytes1024
}
#[inline(always)]
pub fn is_bytes2048(&self) -> bool {
*self == ECCPS::Bytes2048
}
#[inline(always)]
pub fn is_bytes4096(&self) -> bool {
*self == ECCPS::Bytes4096
}
#[inline(always)]
pub fn is_bytes8192(&self) -> bool {
*self == ECCPS::Bytes8192
}
}
pub type ECCPS_W<'a, REG> = crate::FieldWriter<'a, REG, 3, ECCPS>;
impl<'a, REG> ECCPS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bytes256(self) -> &'a mut crate::W<REG> {
self.variant(ECCPS::Bytes256)
}
#[inline(always)]
pub fn bytes512(self) -> &'a mut crate::W<REG> {
self.variant(ECCPS::Bytes512)
}
#[inline(always)]
pub fn bytes1024(self) -> &'a mut crate::W<REG> {
self.variant(ECCPS::Bytes1024)
}
#[inline(always)]
pub fn bytes2048(self) -> &'a mut crate::W<REG> {
self.variant(ECCPS::Bytes2048)
}
#[inline(always)]
pub fn bytes4096(self) -> &'a mut crate::W<REG> {
self.variant(ECCPS::Bytes4096)
}
#[inline(always)]
pub fn bytes8192(self) -> &'a mut crate::W<REG> {
self.variant(ECCPS::Bytes8192)
}
}
impl R {
#[inline(always)]
pub fn pwaiten(&self) -> PWAITEN_R {
PWAITEN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn pbken(&self) -> PBKEN_R {
PBKEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn ptyp(&self) -> PTYP_R {
PTYP_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn pwid(&self) -> PWID_R {
PWID_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn eccen(&self) -> ECCEN_R {
ECCEN_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn tclr(&self) -> TCLR_R {
TCLR_R::new(((self.bits >> 9) & 0x0f) as u8)
}
#[inline(always)]
pub fn tar(&self) -> TAR_R {
TAR_R::new(((self.bits >> 13) & 0x0f) as u8)
}
#[inline(always)]
pub fn eccps(&self) -> ECCPS_R {
ECCPS_R::new(((self.bits >> 17) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PCR")
.field("eccps", &self.eccps())
.field("tar", &self.tar())
.field("tclr", &self.tclr())
.field("eccen", &self.eccen())
.field("pwid", &self.pwid())
.field("ptyp", &self.ptyp())
.field("pbken", &self.pbken())
.field("pwaiten", &self.pwaiten())
.finish()
}
}
impl W {
#[inline(always)]
pub fn pwaiten(&mut self) -> PWAITEN_W<PCRrs> {
PWAITEN_W::new(self, 1)
}
#[inline(always)]
pub fn pbken(&mut self) -> PBKEN_W<PCRrs> {
PBKEN_W::new(self, 2)
}
#[inline(always)]
pub fn ptyp(&mut self) -> PTYP_W<PCRrs> {
PTYP_W::new(self, 3)
}
#[inline(always)]
pub fn pwid(&mut self) -> PWID_W<PCRrs> {
PWID_W::new(self, 4)
}
#[inline(always)]
pub fn eccen(&mut self) -> ECCEN_W<PCRrs> {
ECCEN_W::new(self, 6)
}
#[inline(always)]
pub fn tclr(&mut self) -> TCLR_W<PCRrs> {
TCLR_W::new(self, 9)
}
#[inline(always)]
pub fn tar(&mut self) -> TAR_W<PCRrs> {
TAR_W::new(self, 13)
}
#[inline(always)]
pub fn eccps(&mut self) -> ECCPS_W<PCRrs> {
ECCPS_W::new(self, 17)
}
}
pub struct PCRrs;
impl crate::RegisterSpec for PCRrs {
type Ux = u32;
}
impl crate::Readable for PCRrs {}
impl crate::Writable for PCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for PCRrs {
const RESET_VALUE: u32 = 0x18;
}