#[doc = "Reader of register CHCFG3"] pub type R = crate::R; #[doc = "Writer for register CHCFG3"] pub type W = crate::W; #[doc = "Register CHCFG3 `reset()`'s with value 0"] impl crate::ResetValue for super::CHCFG3 { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `SOURCE`"] pub type SOURCE_R = crate::R; #[doc = "Write proxy for field `SOURCE`"] pub struct SOURCE_W<'a> { w: &'a mut W, } impl<'a> SOURCE_W<'a> { #[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 & !0x3f) | ((value as u8) & 0x3f); self.w } } #[doc = "DMA Channel Trigger Enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TRIG_A { #[doc = "0: Triggering is disabled. If triggering is disabled and ENBL is set, the DMA Channel will simply route the specified source to the DMA channel. (Normal mode)"] _0 = 0, #[doc = "1: Triggering is enabled. If triggering is enabled and ENBL is set, the DMAMUX is in Periodic Trigger mode."] _1 = 1, } impl From for bool { #[inline(always)] fn from(variant: TRIG_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TRIG`"] pub type TRIG_R = crate::R; impl TRIG_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TRIG_A { match self.bits { false => TRIG_A::_0, true => TRIG_A::_1, } } #[doc = "Checks if the value of the field is `_0`"] #[inline(always)] pub fn is_0(&self) -> bool { *self == TRIG_A::_0 } #[doc = "Checks if the value of the field is `_1`"] #[inline(always)] pub fn is_1(&self) -> bool { *self == TRIG_A::_1 } } #[doc = "Write proxy for field `TRIG`"] pub struct TRIG_W<'a> { w: &'a mut W, } impl<'a> TRIG_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TRIG_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Triggering is disabled. If triggering is disabled and ENBL is set, the DMA Channel will simply route the specified source to the DMA channel. (Normal mode)"] #[inline(always)] pub fn _0(self) -> &'a mut W { self.variant(TRIG_A::_0) } #[doc = "Triggering is enabled. If triggering is enabled and ENBL is set, the DMAMUX is in Periodic Trigger mode."] #[inline(always)] pub fn _1(self) -> &'a mut W { self.variant(TRIG_A::_1) } #[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 << 6)) | (((value as u8) & 0x01) << 6); self.w } } #[doc = "DMA Channel Enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ENBL_A { #[doc = "0: DMA channel is disabled. This mode is primarily used during configuration of the DMAMux. The DMA has separate channel enables/disables, which should be used to disable or reconfigure a DMA channel."] _0 = 0, #[doc = "1: DMA channel is enabled"] _1 = 1, } impl From for bool { #[inline(always)] fn from(variant: ENBL_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `ENBL`"] pub type ENBL_R = crate::R; impl ENBL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> ENBL_A { match self.bits { false => ENBL_A::_0, true => ENBL_A::_1, } } #[doc = "Checks if the value of the field is `_0`"] #[inline(always)] pub fn is_0(&self) -> bool { *self == ENBL_A::_0 } #[doc = "Checks if the value of the field is `_1`"] #[inline(always)] pub fn is_1(&self) -> bool { *self == ENBL_A::_1 } } #[doc = "Write proxy for field `ENBL`"] pub struct ENBL_W<'a> { w: &'a mut W, } impl<'a> ENBL_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: ENBL_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "DMA channel is disabled. This mode is primarily used during configuration of the DMAMux. The DMA has separate channel enables/disables, which should be used to disable or reconfigure a DMA channel."] #[inline(always)] pub fn _0(self) -> &'a mut W { self.variant(ENBL_A::_0) } #[doc = "DMA channel is enabled"] #[inline(always)] pub fn _1(self) -> &'a mut W { self.variant(ENBL_A::_1) } #[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 << 7)) | (((value as u8) & 0x01) << 7); self.w } } impl R { #[doc = "Bits 0:5 - DMA Channel Source (Slot)"] #[inline(always)] pub fn source(&self) -> SOURCE_R { SOURCE_R::new((self.bits & 0x3f) as u8) } #[doc = "Bit 6 - DMA Channel Trigger Enable"] #[inline(always)] pub fn trig(&self) -> TRIG_R { TRIG_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 7 - DMA Channel Enable"] #[inline(always)] pub fn enbl(&self) -> ENBL_R { ENBL_R::new(((self.bits >> 7) & 0x01) != 0) } } impl W { #[doc = "Bits 0:5 - DMA Channel Source (Slot)"] #[inline(always)] pub fn source(&mut self) -> SOURCE_W { SOURCE_W { w: self } } #[doc = "Bit 6 - DMA Channel Trigger Enable"] #[inline(always)] pub fn trig(&mut self) -> TRIG_W { TRIG_W { w: self } } #[doc = "Bit 7 - DMA Channel Enable"] #[inline(always)] pub fn enbl(&mut self) -> ENBL_W { ENBL_W { w: self } } }