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 EN {
Disabled = 0,
Enabled = 1,
}
impl From<EN> for bool {
#[inline(always)]
fn from(variant: EN) -> Self {
variant as u8 != 0
}
}
pub type EN_R = crate::BitReader<EN>;
impl EN_R {
#[inline(always)]
pub const fn variant(&self) -> EN {
match self.bits {
false => EN::Disabled,
true => EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EN::Enabled
}
}
pub type EN_W<'a, REG> = crate::BitWriter<'a, REG, EN>;
impl<'a, REG> EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(EN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DATATYPE {
None = 0,
HalfWord = 1,
Byte = 2,
Bit = 3,
}
impl From<DATATYPE> for u8 {
#[inline(always)]
fn from(variant: DATATYPE) -> Self {
variant as _
}
}
impl crate::FieldSpec for DATATYPE {
type Ux = u8;
}
impl crate::IsEnum for DATATYPE {}
pub type DATATYPE_R = crate::FieldReader<DATATYPE>;
impl DATATYPE_R {
#[inline(always)]
pub const fn variant(&self) -> DATATYPE {
match self.bits {
0 => DATATYPE::None,
1 => DATATYPE::HalfWord,
2 => DATATYPE::Byte,
3 => DATATYPE::Bit,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == DATATYPE::None
}
#[inline(always)]
pub fn is_half_word(&self) -> bool {
*self == DATATYPE::HalfWord
}
#[inline(always)]
pub fn is_byte(&self) -> bool {
*self == DATATYPE::Byte
}
#[inline(always)]
pub fn is_bit(&self) -> bool {
*self == DATATYPE::Bit
}
}
pub type DATATYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DATATYPE, crate::Safe>;
impl<'a, REG> DATATYPE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn none(self) -> &'a mut crate::W<REG> {
self.variant(DATATYPE::None)
}
#[inline(always)]
pub fn half_word(self) -> &'a mut crate::W<REG> {
self.variant(DATATYPE::HalfWord)
}
#[inline(always)]
pub fn byte(self) -> &'a mut crate::W<REG> {
self.variant(DATATYPE::Byte)
}
#[inline(always)]
pub fn bit_(self) -> &'a mut crate::W<REG> {
self.variant(DATATYPE::Bit)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MODE {
Mode1 = 0,
Mode2 = 1,
Mode3 = 2,
Mode4 = 3,
}
impl From<MODE> for u8 {
#[inline(always)]
fn from(variant: MODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for MODE {
type Ux = u8;
}
impl crate::IsEnum for MODE {}
pub type MODE_R = crate::FieldReader<MODE>;
impl MODE_R {
#[inline(always)]
pub const fn variant(&self) -> MODE {
match self.bits {
0 => MODE::Mode1,
1 => MODE::Mode2,
2 => MODE::Mode3,
3 => MODE::Mode4,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_mode1(&self) -> bool {
*self == MODE::Mode1
}
#[inline(always)]
pub fn is_mode2(&self) -> bool {
*self == MODE::Mode2
}
#[inline(always)]
pub fn is_mode3(&self) -> bool {
*self == MODE::Mode3
}
#[inline(always)]
pub fn is_mode4(&self) -> bool {
*self == MODE::Mode4
}
}
pub type MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, MODE, crate::Safe>;
impl<'a, REG> MODE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn mode1(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Mode1)
}
#[inline(always)]
pub fn mode2(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Mode2)
}
#[inline(always)]
pub fn mode3(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Mode3)
}
#[inline(always)]
pub fn mode4(self) -> &'a mut crate::W<REG> {
self.variant(MODE::Mode4)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CHMOD {
Ecb = 0,
Cbc = 1,
Ctr = 2,
}
impl From<CHMOD> for u8 {
#[inline(always)]
fn from(variant: CHMOD) -> Self {
variant as _
}
}
impl crate::FieldSpec for CHMOD {
type Ux = u8;
}
impl crate::IsEnum for CHMOD {}
pub type CHMOD_R = crate::FieldReader<CHMOD>;
impl CHMOD_R {
#[inline(always)]
pub const fn variant(&self) -> Option<CHMOD> {
match self.bits {
0 => Some(CHMOD::Ecb),
1 => Some(CHMOD::Cbc),
2 => Some(CHMOD::Ctr),
_ => None,
}
}
#[inline(always)]
pub fn is_ecb(&self) -> bool {
*self == CHMOD::Ecb
}
#[inline(always)]
pub fn is_cbc(&self) -> bool {
*self == CHMOD::Cbc
}
#[inline(always)]
pub fn is_ctr(&self) -> bool {
*self == CHMOD::Ctr
}
}
pub type CHMOD_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CHMOD>;
impl<'a, REG> CHMOD_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn ecb(self) -> &'a mut crate::W<REG> {
self.variant(CHMOD::Ecb)
}
#[inline(always)]
pub fn cbc(self) -> &'a mut crate::W<REG> {
self.variant(CHMOD::Cbc)
}
#[inline(always)]
pub fn ctr(self) -> &'a mut crate::W<REG> {
self.variant(CHMOD::Ctr)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CCFCW {
Clear = 1,
}
impl From<CCFCW> for bool {
#[inline(always)]
fn from(variant: CCFCW) -> Self {
variant as u8 != 0
}
}
pub type CCFC_R = crate::BitReader<CCFCW>;
impl CCFC_R {
#[inline(always)]
pub const fn variant(&self) -> Option<CCFCW> {
match self.bits {
true => Some(CCFCW::Clear),
_ => None,
}
}
#[inline(always)]
pub fn is_clear(&self) -> bool {
*self == CCFCW::Clear
}
}
pub type CCFC_W<'a, REG> = crate::BitWriter<'a, REG, CCFCW>;
impl<'a, REG> CCFC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn clear(self) -> &'a mut crate::W<REG> {
self.variant(CCFCW::Clear)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERRCW {
Clear = 1,
}
impl From<ERRCW> for bool {
#[inline(always)]
fn from(variant: ERRCW) -> Self {
variant as u8 != 0
}
}
pub type ERRC_R = crate::BitReader<ERRCW>;
impl ERRC_R {
#[inline(always)]
pub const fn variant(&self) -> Option<ERRCW> {
match self.bits {
true => Some(ERRCW::Clear),
_ => None,
}
}
#[inline(always)]
pub fn is_clear(&self) -> bool {
*self == ERRCW::Clear
}
}
pub type ERRC_W<'a, REG> = crate::BitWriter<'a, REG, ERRCW>;
impl<'a, REG> ERRC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn clear(self) -> &'a mut crate::W<REG> {
self.variant(ERRCW::Clear)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CCFIE {
Disabled = 0,
Enabled = 1,
}
impl From<CCFIE> for bool {
#[inline(always)]
fn from(variant: CCFIE) -> Self {
variant as u8 != 0
}
}
pub type CCFIE_R = crate::BitReader<CCFIE>;
impl CCFIE_R {
#[inline(always)]
pub const fn variant(&self) -> CCFIE {
match self.bits {
false => CCFIE::Disabled,
true => CCFIE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CCFIE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CCFIE::Enabled
}
}
pub type CCFIE_W<'a, REG> = crate::BitWriter<'a, REG, CCFIE>;
impl<'a, REG> CCFIE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CCFIE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CCFIE::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 DMAINEN {
Disabled = 0,
Enabled = 1,
}
impl From<DMAINEN> for bool {
#[inline(always)]
fn from(variant: DMAINEN) -> Self {
variant as u8 != 0
}
}
pub type DMAINEN_R = crate::BitReader<DMAINEN>;
impl DMAINEN_R {
#[inline(always)]
pub const fn variant(&self) -> DMAINEN {
match self.bits {
false => DMAINEN::Disabled,
true => DMAINEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMAINEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMAINEN::Enabled
}
}
pub type DMAINEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAINEN>;
impl<'a, REG> DMAINEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAINEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAINEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAOUTEN {
Disabled = 0,
Enabled = 1,
}
impl From<DMAOUTEN> for bool {
#[inline(always)]
fn from(variant: DMAOUTEN) -> Self {
variant as u8 != 0
}
}
pub type DMAOUTEN_R = crate::BitReader<DMAOUTEN>;
impl DMAOUTEN_R {
#[inline(always)]
pub const fn variant(&self) -> DMAOUTEN {
match self.bits {
false => DMAOUTEN::Disabled,
true => DMAOUTEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMAOUTEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMAOUTEN::Enabled
}
}
pub type DMAOUTEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAOUTEN>;
impl<'a, REG> DMAOUTEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAOUTEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAOUTEN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn en(&self) -> EN_R {
EN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn datatype(&self) -> DATATYPE_R {
DATATYPE_R::new(((self.bits >> 1) & 3) as u8)
}
#[inline(always)]
pub fn mode(&self) -> MODE_R {
MODE_R::new(((self.bits >> 3) & 3) as u8)
}
#[inline(always)]
pub fn chmod(&self) -> CHMOD_R {
CHMOD_R::new(((self.bits >> 5) & 3) as u8)
}
#[inline(always)]
pub fn ccfc(&self) -> CCFC_R {
CCFC_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn errc(&self) -> ERRC_R {
ERRC_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn ccfie(&self) -> CCFIE_R {
CCFIE_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn errie(&self) -> ERRIE_R {
ERRIE_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn dmainen(&self) -> DMAINEN_R {
DMAINEN_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn dmaouten(&self) -> DMAOUTEN_R {
DMAOUTEN_R::new(((self.bits >> 12) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR")
.field("dmaouten", &self.dmaouten())
.field("dmainen", &self.dmainen())
.field("errie", &self.errie())
.field("ccfie", &self.ccfie())
.field("errc", &self.errc())
.field("ccfc", &self.ccfc())
.field("chmod", &self.chmod())
.field("mode", &self.mode())
.field("datatype", &self.datatype())
.field("en", &self.en())
.finish()
}
}
impl W {
#[inline(always)]
pub fn en(&mut self) -> EN_W<CRrs> {
EN_W::new(self, 0)
}
#[inline(always)]
pub fn datatype(&mut self) -> DATATYPE_W<CRrs> {
DATATYPE_W::new(self, 1)
}
#[inline(always)]
pub fn mode(&mut self) -> MODE_W<CRrs> {
MODE_W::new(self, 3)
}
#[inline(always)]
pub fn chmod(&mut self) -> CHMOD_W<CRrs> {
CHMOD_W::new(self, 5)
}
#[inline(always)]
pub fn ccfc(&mut self) -> CCFC_W<CRrs> {
CCFC_W::new(self, 7)
}
#[inline(always)]
pub fn errc(&mut self) -> ERRC_W<CRrs> {
ERRC_W::new(self, 8)
}
#[inline(always)]
pub fn ccfie(&mut self) -> CCFIE_W<CRrs> {
CCFIE_W::new(self, 9)
}
#[inline(always)]
pub fn errie(&mut self) -> ERRIE_W<CRrs> {
ERRIE_W::new(self, 10)
}
#[inline(always)]
pub fn dmainen(&mut self) -> DMAINEN_W<CRrs> {
DMAINEN_W::new(self, 11)
}
#[inline(always)]
pub fn dmaouten(&mut self) -> DMAOUTEN_W<CRrs> {
DMAOUTEN_W::new(self, 12)
}
}
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 {}