Skip to main content

mcxa_pac/edma_0_tcd0/tcd/
tcd_biter_elinkno.rs

1#[doc = "Register `TCD_BITER_ELINKNO` reader"]
2pub type R = crate::R<TcdBiterElinknoSpec>;
3#[doc = "Register `TCD_BITER_ELINKNO` writer"]
4pub type W = crate::W<TcdBiterElinknoSpec>;
5#[doc = "Field `BITER` reader - Starting Major Iteration Count"]
6pub type BiterR = crate::FieldReader<u16>;
7#[doc = "Field `BITER` writer - Starting Major Iteration Count"]
8pub type BiterW<'a, REG> = crate::FieldWriter<'a, REG, 15, u16>;
9#[doc = "Enables Link\n\nValue on reset: 0"]
10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12pub enum Elink {
13    #[doc = "0: Channel-to-channel linking disabled"]
14    Disable = 0,
15    #[doc = "1: Channel-to-channel linking enabled"]
16    Enable = 1,
17}
18impl From<Elink> for bool {
19    #[inline(always)]
20    fn from(variant: Elink) -> Self {
21        variant as u8 != 0
22    }
23}
24#[doc = "Field `ELINK` reader - Enables Link"]
25pub type ElinkR = crate::BitReader<Elink>;
26impl ElinkR {
27    #[doc = "Get enumerated values variant"]
28    #[inline(always)]
29    pub const fn variant(&self) -> Elink {
30        match self.bits {
31            false => Elink::Disable,
32            true => Elink::Enable,
33        }
34    }
35    #[doc = "Channel-to-channel linking disabled"]
36    #[inline(always)]
37    pub fn is_disable(&self) -> bool {
38        *self == Elink::Disable
39    }
40    #[doc = "Channel-to-channel linking enabled"]
41    #[inline(always)]
42    pub fn is_enable(&self) -> bool {
43        *self == Elink::Enable
44    }
45}
46#[doc = "Field `ELINK` writer - Enables Link"]
47pub type ElinkW<'a, REG> = crate::BitWriter<'a, REG, Elink>;
48impl<'a, REG> ElinkW<'a, REG>
49where
50    REG: crate::Writable + crate::RegisterSpec,
51{
52    #[doc = "Channel-to-channel linking disabled"]
53    #[inline(always)]
54    pub fn disable(self) -> &'a mut crate::W<REG> {
55        self.variant(Elink::Disable)
56    }
57    #[doc = "Channel-to-channel linking enabled"]
58    #[inline(always)]
59    pub fn enable(self) -> &'a mut crate::W<REG> {
60        self.variant(Elink::Enable)
61    }
62}
63impl R {
64    #[doc = "Bits 0:14 - Starting Major Iteration Count"]
65    #[inline(always)]
66    pub fn biter(&self) -> BiterR {
67        BiterR::new(self.bits & 0x7fff)
68    }
69    #[doc = "Bit 15 - Enables Link"]
70    #[inline(always)]
71    pub fn elink(&self) -> ElinkR {
72        ElinkR::new(((self.bits >> 15) & 1) != 0)
73    }
74}
75#[cfg(feature = "debug")]
76impl core::fmt::Debug for R {
77    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
78        f.debug_struct("TCD_BITER_ELINKNO")
79            .field("biter", &self.biter())
80            .field("elink", &self.elink())
81            .finish()
82    }
83}
84impl W {
85    #[doc = "Bits 0:14 - Starting Major Iteration Count"]
86    #[inline(always)]
87    pub fn biter(&mut self) -> BiterW<'_, TcdBiterElinknoSpec> {
88        BiterW::new(self, 0)
89    }
90    #[doc = "Bit 15 - Enables Link"]
91    #[inline(always)]
92    pub fn elink(&mut self) -> ElinkW<'_, TcdBiterElinknoSpec> {
93        ElinkW::new(self, 15)
94    }
95}
96#[doc = "TCD Beginning Major Loop Count (Minor Loop Channel Linking Disabled)\n\nYou can [`read`](crate::Reg::read) this register and get [`tcd_biter_elinkno::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tcd_biter_elinkno::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
97pub struct TcdBiterElinknoSpec;
98impl crate::RegisterSpec for TcdBiterElinknoSpec {
99    type Ux = u16;
100}
101#[doc = "`read()` method returns [`tcd_biter_elinkno::R`](R) reader structure"]
102impl crate::Readable for TcdBiterElinknoSpec {}
103#[doc = "`write(|w| ..)` method takes [`tcd_biter_elinkno::W`](W) writer structure"]
104impl crate::Writable for TcdBiterElinknoSpec {
105    type Safety = crate::Unsafe;
106}
107#[doc = "`reset()` method sets TCD_BITER_ELINKNO to value 0"]
108impl crate::Resettable for TcdBiterElinknoSpec {}