#[doc = "Reader of register CHCTRLB"]
pub type R = crate::R<u32, super::CHCTRLB>;
#[doc = "Writer for register CHCTRLB"]
pub type W = crate::W<u32, super::CHCTRLB>;
#[doc = "Register CHCTRLB `reset()`'s with value 0"]
impl crate::ResetValue for super::CHCTRLB {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Event Input Action\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EVACT_A {
#[doc = "0: No action"]
NOACT,
#[doc = "1: Transfer and periodic transfer trigger"]
TRIG,
#[doc = "2: Conditional transfer trigger"]
CTRIG,
#[doc = "3: Conditional block transfer"]
CBLOCK,
#[doc = "4: Channel suspend operation"]
SUSPEND,
#[doc = "5: Channel resume operation"]
RESUME,
#[doc = "6: Skip next block suspend action"]
SSKIP,
}
impl From<EVACT_A> for u8 {
#[inline(always)]
fn from(variant: EVACT_A) -> Self {
match variant {
EVACT_A::NOACT => 0,
EVACT_A::TRIG => 1,
EVACT_A::CTRIG => 2,
EVACT_A::CBLOCK => 3,
EVACT_A::SUSPEND => 4,
EVACT_A::RESUME => 5,
EVACT_A::SSKIP => 6,
}
}
}
#[doc = "Reader of field `EVACT`"]
pub type EVACT_R = crate::R<u8, EVACT_A>;
impl EVACT_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, EVACT_A> {
use crate::Variant::*;
match self.bits {
0 => Val(EVACT_A::NOACT),
1 => Val(EVACT_A::TRIG),
2 => Val(EVACT_A::CTRIG),
3 => Val(EVACT_A::CBLOCK),
4 => Val(EVACT_A::SUSPEND),
5 => Val(EVACT_A::RESUME),
6 => Val(EVACT_A::SSKIP),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `NOACT`"]
#[inline(always)]
pub fn is_noact(&self) -> bool {
*self == EVACT_A::NOACT
}
#[doc = "Checks if the value of the field is `TRIG`"]
#[inline(always)]
pub fn is_trig(&self) -> bool {
*self == EVACT_A::TRIG
}
#[doc = "Checks if the value of the field is `CTRIG`"]
#[inline(always)]
pub fn is_ctrig(&self) -> bool {
*self == EVACT_A::CTRIG
}
#[doc = "Checks if the value of the field is `CBLOCK`"]
#[inline(always)]
pub fn is_cblock(&self) -> bool {
*self == EVACT_A::CBLOCK
}
#[doc = "Checks if the value of the field is `SUSPEND`"]
#[inline(always)]
pub fn is_suspend(&self) -> bool {
*self == EVACT_A::SUSPEND
}
#[doc = "Checks if the value of the field is `RESUME`"]
#[inline(always)]
pub fn is_resume(&self) -> bool {
*self == EVACT_A::RESUME
}
#[doc = "Checks if the value of the field is `SSKIP`"]
#[inline(always)]
pub fn is_sskip(&self) -> bool {
*self == EVACT_A::SSKIP
}
}
#[doc = "Write proxy for field `EVACT`"]
pub struct EVACT_W<'a> {
w: &'a mut W,
}
impl<'a> EVACT_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EVACT_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "No action"]
#[inline(always)]
pub fn noact(self) -> &'a mut W {
self.variant(EVACT_A::NOACT)
}
#[doc = "Transfer and periodic transfer trigger"]
#[inline(always)]
pub fn trig(self) -> &'a mut W {
self.variant(EVACT_A::TRIG)
}
#[doc = "Conditional transfer trigger"]
#[inline(always)]
pub fn ctrig(self) -> &'a mut W {
self.variant(EVACT_A::CTRIG)
}
#[doc = "Conditional block transfer"]
#[inline(always)]
pub fn cblock(self) -> &'a mut W {
self.variant(EVACT_A::CBLOCK)
}
#[doc = "Channel suspend operation"]
#[inline(always)]
pub fn suspend(self) -> &'a mut W {
self.variant(EVACT_A::SUSPEND)
}
#[doc = "Channel resume operation"]
#[inline(always)]
pub fn resume(self) -> &'a mut W {
self.variant(EVACT_A::RESUME)
}
#[doc = "Skip next block suspend action"]
#[inline(always)]
pub fn sskip(self) -> &'a mut W {
self.variant(EVACT_A::SSKIP)
}
#[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 & !0x07) | ((value as u32) & 0x07);
self.w
}
}
#[doc = "Reader of field `EVIE`"]
pub type EVIE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `EVIE`"]
pub struct EVIE_W<'a> {
w: &'a mut W,
}
impl<'a> EVIE_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 << 3)) | (((value as u32) & 0x01) << 3);
self.w
}
}
#[doc = "Reader of field `EVOE`"]
pub type EVOE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `EVOE`"]
pub struct EVOE_W<'a> {
w: &'a mut W,
}
impl<'a> EVOE_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 << 4)) | (((value as u32) & 0x01) << 4);
self.w
}
}
#[doc = "Channel Arbitration Level\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LVL_A {
#[doc = "0: Channel Priority Level 0"]
LVL0,
#[doc = "1: Channel Priority Level 1"]
LVL1,
#[doc = "2: Channel Priority Level 2"]
LVL2,
#[doc = "3: Channel Priority Level 3"]
LVL3,
}
impl From<LVL_A> for u8 {
#[inline(always)]
fn from(variant: LVL_A) -> Self {
match variant {
LVL_A::LVL0 => 0,
LVL_A::LVL1 => 1,
LVL_A::LVL2 => 2,
LVL_A::LVL3 => 3,
}
}
}
#[doc = "Reader of field `LVL`"]
pub type LVL_R = crate::R<u8, LVL_A>;
impl LVL_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LVL_A {
match self.bits {
0 => LVL_A::LVL0,
1 => LVL_A::LVL1,
2 => LVL_A::LVL2,
3 => LVL_A::LVL3,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `LVL0`"]
#[inline(always)]
pub fn is_lvl0(&self) -> bool {
*self == LVL_A::LVL0
}
#[doc = "Checks if the value of the field is `LVL1`"]
#[inline(always)]
pub fn is_lvl1(&self) -> bool {
*self == LVL_A::LVL1
}
#[doc = "Checks if the value of the field is `LVL2`"]
#[inline(always)]
pub fn is_lvl2(&self) -> bool {
*self == LVL_A::LVL2
}
#[doc = "Checks if the value of the field is `LVL3`"]
#[inline(always)]
pub fn is_lvl3(&self) -> bool {
*self == LVL_A::LVL3
}
}
#[doc = "Write proxy for field `LVL`"]
pub struct LVL_W<'a> {
w: &'a mut W,
}
impl<'a> LVL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LVL_A) -> &'a mut W {
{
self.bits(variant.into())
}
}
#[doc = "Channel Priority Level 0"]
#[inline(always)]
pub fn lvl0(self) -> &'a mut W {
self.variant(LVL_A::LVL0)
}
#[doc = "Channel Priority Level 1"]
#[inline(always)]
pub fn lvl1(self) -> &'a mut W {
self.variant(LVL_A::LVL1)
}
#[doc = "Channel Priority Level 2"]
#[inline(always)]
pub fn lvl2(self) -> &'a mut W {
self.variant(LVL_A::LVL2)
}
#[doc = "Channel Priority Level 3"]
#[inline(always)]
pub fn lvl3(self) -> &'a mut W {
self.variant(LVL_A::LVL3)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 5)) | (((value as u32) & 0x03) << 5);
self.w
}
}
#[doc = "Trigger Source\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TRIGSRC_A {
#[doc = "0: Only software/event triggers"]
DISABLE,
}
impl From<TRIGSRC_A> for u8 {
#[inline(always)]
fn from(variant: TRIGSRC_A) -> Self {
match variant {
TRIGSRC_A::DISABLE => 0,
}
}
}
#[doc = "Reader of field `TRIGSRC`"]
pub type TRIGSRC_R = crate::R<u8, TRIGSRC_A>;
impl TRIGSRC_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, TRIGSRC_A> {
use crate::Variant::*;
match self.bits {
0 => Val(TRIGSRC_A::DISABLE),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `DISABLE`"]
#[inline(always)]
pub fn is_disable(&self) -> bool {
*self == TRIGSRC_A::DISABLE
}
}
#[doc = "Write proxy for field `TRIGSRC`"]
pub struct TRIGSRC_W<'a> {
w: &'a mut W,
}
impl<'a> TRIGSRC_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TRIGSRC_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "Only software/event triggers"]
#[inline(always)]
pub fn disable(self) -> &'a mut W {
self.variant(TRIGSRC_A::DISABLE)
}
#[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 & !(0x1f << 8)) | (((value as u32) & 0x1f) << 8);
self.w
}
}
#[doc = "Trigger Action\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TRIGACT_A {
#[doc = "0: One trigger required for each block transfer"]
BLOCK,
#[doc = "2: One trigger required for each beat transfer"]
BEAT,
#[doc = "3: One trigger required for each transaction"]
TRANSACTION,
}
impl From<TRIGACT_A> for u8 {
#[inline(always)]
fn from(variant: TRIGACT_A) -> Self {
match variant {
TRIGACT_A::BLOCK => 0,
TRIGACT_A::BEAT => 2,
TRIGACT_A::TRANSACTION => 3,
}
}
}
#[doc = "Reader of field `TRIGACT`"]
pub type TRIGACT_R = crate::R<u8, TRIGACT_A>;
impl TRIGACT_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, TRIGACT_A> {
use crate::Variant::*;
match self.bits {
0 => Val(TRIGACT_A::BLOCK),
2 => Val(TRIGACT_A::BEAT),
3 => Val(TRIGACT_A::TRANSACTION),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `BLOCK`"]
#[inline(always)]
pub fn is_block(&self) -> bool {
*self == TRIGACT_A::BLOCK
}
#[doc = "Checks if the value of the field is `BEAT`"]
#[inline(always)]
pub fn is_beat(&self) -> bool {
*self == TRIGACT_A::BEAT
}
#[doc = "Checks if the value of the field is `TRANSACTION`"]
#[inline(always)]
pub fn is_transaction(&self) -> bool {
*self == TRIGACT_A::TRANSACTION
}
}
#[doc = "Write proxy for field `TRIGACT`"]
pub struct TRIGACT_W<'a> {
w: &'a mut W,
}
impl<'a> TRIGACT_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TRIGACT_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "One trigger required for each block transfer"]
#[inline(always)]
pub fn block(self) -> &'a mut W {
self.variant(TRIGACT_A::BLOCK)
}
#[doc = "One trigger required for each beat transfer"]
#[inline(always)]
pub fn beat(self) -> &'a mut W {
self.variant(TRIGACT_A::BEAT)
}
#[doc = "One trigger required for each transaction"]
#[inline(always)]
pub fn transaction(self) -> &'a mut W {
self.variant(TRIGACT_A::TRANSACTION)
}
#[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 & !(0x03 << 22)) | (((value as u32) & 0x03) << 22);
self.w
}
}
#[doc = "Software Command\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CMD_A {
#[doc = "0: No action"]
NOACT,
#[doc = "1: Channel suspend operation"]
SUSPEND,
#[doc = "2: Channel resume operation"]
RESUME,
}
impl From<CMD_A> for u8 {
#[inline(always)]
fn from(variant: CMD_A) -> Self {
match variant {
CMD_A::NOACT => 0,
CMD_A::SUSPEND => 1,
CMD_A::RESUME => 2,
}
}
}
#[doc = "Reader of field `CMD`"]
pub type CMD_R = crate::R<u8, CMD_A>;
impl CMD_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, CMD_A> {
use crate::Variant::*;
match self.bits {
0 => Val(CMD_A::NOACT),
1 => Val(CMD_A::SUSPEND),
2 => Val(CMD_A::RESUME),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `NOACT`"]
#[inline(always)]
pub fn is_noact(&self) -> bool {
*self == CMD_A::NOACT
}
#[doc = "Checks if the value of the field is `SUSPEND`"]
#[inline(always)]
pub fn is_suspend(&self) -> bool {
*self == CMD_A::SUSPEND
}
#[doc = "Checks if the value of the field is `RESUME`"]
#[inline(always)]
pub fn is_resume(&self) -> bool {
*self == CMD_A::RESUME
}
}
#[doc = "Write proxy for field `CMD`"]
pub struct CMD_W<'a> {
w: &'a mut W,
}
impl<'a> CMD_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CMD_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "No action"]
#[inline(always)]
pub fn noact(self) -> &'a mut W {
self.variant(CMD_A::NOACT)
}
#[doc = "Channel suspend operation"]
#[inline(always)]
pub fn suspend(self) -> &'a mut W {
self.variant(CMD_A::SUSPEND)
}
#[doc = "Channel resume operation"]
#[inline(always)]
pub fn resume(self) -> &'a mut W {
self.variant(CMD_A::RESUME)
}
#[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 & !(0x03 << 24)) | (((value as u32) & 0x03) << 24);
self.w
}
}
impl R {
#[doc = "Bits 0:2 - Event Input Action"]
#[inline(always)]
pub fn evact(&self) -> EVACT_R {
EVACT_R::new((self.bits & 0x07) as u8)
}
#[doc = "Bit 3 - Channel Event Input Enable"]
#[inline(always)]
pub fn evie(&self) -> EVIE_R {
EVIE_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Channel Event Output Enable"]
#[inline(always)]
pub fn evoe(&self) -> EVOE_R {
EVOE_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bits 5:6 - Channel Arbitration Level"]
#[inline(always)]
pub fn lvl(&self) -> LVL_R {
LVL_R::new(((self.bits >> 5) & 0x03) as u8)
}
#[doc = "Bits 8:12 - Trigger Source"]
#[inline(always)]
pub fn trigsrc(&self) -> TRIGSRC_R {
TRIGSRC_R::new(((self.bits >> 8) & 0x1f) as u8)
}
#[doc = "Bits 22:23 - Trigger Action"]
#[inline(always)]
pub fn trigact(&self) -> TRIGACT_R {
TRIGACT_R::new(((self.bits >> 22) & 0x03) as u8)
}
#[doc = "Bits 24:25 - Software Command"]
#[inline(always)]
pub fn cmd(&self) -> CMD_R {
CMD_R::new(((self.bits >> 24) & 0x03) as u8)
}
}
impl W {
#[doc = "Bits 0:2 - Event Input Action"]
#[inline(always)]
pub fn evact(&mut self) -> EVACT_W {
EVACT_W { w: self }
}
#[doc = "Bit 3 - Channel Event Input Enable"]
#[inline(always)]
pub fn evie(&mut self) -> EVIE_W {
EVIE_W { w: self }
}
#[doc = "Bit 4 - Channel Event Output Enable"]
#[inline(always)]
pub fn evoe(&mut self) -> EVOE_W {
EVOE_W { w: self }
}
#[doc = "Bits 5:6 - Channel Arbitration Level"]
#[inline(always)]
pub fn lvl(&mut self) -> LVL_W {
LVL_W { w: self }
}
#[doc = "Bits 8:12 - Trigger Source"]
#[inline(always)]
pub fn trigsrc(&mut self) -> TRIGSRC_W {
TRIGSRC_W { w: self }
}
#[doc = "Bits 22:23 - Trigger Action"]
#[inline(always)]
pub fn trigact(&mut self) -> TRIGACT_W {
TRIGACT_W { w: self }
}
#[doc = "Bits 24:25 - Software Command"]
#[inline(always)]
pub fn cmd(&mut self) -> CMD_W {
CMD_W { w: self }
}
}