d1_pac/ce_ns/
ce_icr.rs

1#[doc = "Register `ce_icr` reader"]
2pub type R = crate::R<CE_ICR_SPEC>;
3#[doc = "Register `ce_icr` writer"]
4pub type W = crate::W<CE_ICR_SPEC>;
5#[doc = "Field `task_irq_en[0-3]` reader - Task Channel 3-0 Interrupt Enable"]
6pub type TASK_IRQ_EN_R = crate::FieldReader<TASK_IRQ_EN_A>;
7#[doc = "Task Channel 3-0 Interrupt Enable\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum TASK_IRQ_EN_A {
11    #[doc = "0: Disable"]
12    DISABLE = 0,
13    #[doc = "1: Enable"]
14    ENABLE = 1,
15}
16impl From<TASK_IRQ_EN_A> for u8 {
17    #[inline(always)]
18    fn from(variant: TASK_IRQ_EN_A) -> Self {
19        variant as _
20    }
21}
22impl crate::FieldSpec for TASK_IRQ_EN_A {
23    type Ux = u8;
24}
25impl TASK_IRQ_EN_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> Option<TASK_IRQ_EN_A> {
29        match self.bits {
30            0 => Some(TASK_IRQ_EN_A::DISABLE),
31            1 => Some(TASK_IRQ_EN_A::ENABLE),
32            _ => None,
33        }
34    }
35    #[doc = "Disable"]
36    #[inline(always)]
37    pub fn is_disable(&self) -> bool {
38        *self == TASK_IRQ_EN_A::DISABLE
39    }
40    #[doc = "Enable"]
41    #[inline(always)]
42    pub fn is_enable(&self) -> bool {
43        *self == TASK_IRQ_EN_A::ENABLE
44    }
45}
46#[doc = "Field `task_irq_en[0-3]` writer - Task Channel 3-0 Interrupt Enable"]
47pub type TASK_IRQ_EN_W<'a, REG> = crate::FieldWriter<'a, REG, 4, TASK_IRQ_EN_A>;
48impl<'a, REG> TASK_IRQ_EN_W<'a, REG>
49where
50    REG: crate::Writable + crate::RegisterSpec,
51    REG::Ux: From<u8>,
52{
53    #[doc = "Disable"]
54    #[inline(always)]
55    pub fn disable(self) -> &'a mut crate::W<REG> {
56        self.variant(TASK_IRQ_EN_A::DISABLE)
57    }
58    #[doc = "Enable"]
59    #[inline(always)]
60    pub fn enable(self) -> &'a mut crate::W<REG> {
61        self.variant(TASK_IRQ_EN_A::ENABLE)
62    }
63}
64impl R {
65    #[doc = "Task Channel 3-0 Interrupt Enable\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `task0_irq_en` field"]
66    #[inline(always)]
67    pub fn task_irq_en(&self, n: u8) -> TASK_IRQ_EN_R {
68        #[allow(clippy::no_effect)]
69        [(); 4][n as usize];
70        TASK_IRQ_EN_R::new(((self.bits >> n) & 0x0f) as u8)
71    }
72    #[doc = "Bits 0:3 - Task Channel 3-0 Interrupt Enable"]
73    #[inline(always)]
74    pub fn task0_irq_en(&self) -> TASK_IRQ_EN_R {
75        TASK_IRQ_EN_R::new((self.bits & 0x0f) as u8)
76    }
77    #[doc = "Bits 1:4 - Task Channel 3-0 Interrupt Enable"]
78    #[inline(always)]
79    pub fn task1_irq_en(&self) -> TASK_IRQ_EN_R {
80        TASK_IRQ_EN_R::new(((self.bits >> 1) & 0x0f) as u8)
81    }
82    #[doc = "Bits 2:5 - Task Channel 3-0 Interrupt Enable"]
83    #[inline(always)]
84    pub fn task2_irq_en(&self) -> TASK_IRQ_EN_R {
85        TASK_IRQ_EN_R::new(((self.bits >> 2) & 0x0f) as u8)
86    }
87    #[doc = "Bits 3:6 - Task Channel 3-0 Interrupt Enable"]
88    #[inline(always)]
89    pub fn task3_irq_en(&self) -> TASK_IRQ_EN_R {
90        TASK_IRQ_EN_R::new(((self.bits >> 3) & 0x0f) as u8)
91    }
92}
93impl W {
94    #[doc = "Task Channel 3-0 Interrupt Enable\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `task0_irq_en` field"]
95    #[inline(always)]
96    #[must_use]
97    pub fn task_irq_en(&mut self, n: u8) -> TASK_IRQ_EN_W<CE_ICR_SPEC> {
98        #[allow(clippy::no_effect)]
99        [(); 4][n as usize];
100        TASK_IRQ_EN_W::new(self, n)
101    }
102    #[doc = "Bits 0:3 - Task Channel 3-0 Interrupt Enable"]
103    #[inline(always)]
104    #[must_use]
105    pub fn task0_irq_en(&mut self) -> TASK_IRQ_EN_W<CE_ICR_SPEC> {
106        TASK_IRQ_EN_W::new(self, 0)
107    }
108    #[doc = "Bits 1:4 - Task Channel 3-0 Interrupt Enable"]
109    #[inline(always)]
110    #[must_use]
111    pub fn task1_irq_en(&mut self) -> TASK_IRQ_EN_W<CE_ICR_SPEC> {
112        TASK_IRQ_EN_W::new(self, 1)
113    }
114    #[doc = "Bits 2:5 - Task Channel 3-0 Interrupt Enable"]
115    #[inline(always)]
116    #[must_use]
117    pub fn task2_irq_en(&mut self) -> TASK_IRQ_EN_W<CE_ICR_SPEC> {
118        TASK_IRQ_EN_W::new(self, 2)
119    }
120    #[doc = "Bits 3:6 - Task Channel 3-0 Interrupt Enable"]
121    #[inline(always)]
122    #[must_use]
123    pub fn task3_irq_en(&mut self) -> TASK_IRQ_EN_W<CE_ICR_SPEC> {
124        TASK_IRQ_EN_W::new(self, 3)
125    }
126    #[doc = r" Writes raw bits to the register."]
127    #[doc = r""]
128    #[doc = r" # Safety"]
129    #[doc = r""]
130    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
131    #[inline(always)]
132    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
133        self.bits = bits;
134        self
135    }
136}
137#[doc = "Interrupt Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ce_icr::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ce_icr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
138pub struct CE_ICR_SPEC;
139impl crate::RegisterSpec for CE_ICR_SPEC {
140    type Ux = u32;
141}
142#[doc = "`read()` method returns [`ce_icr::R`](R) reader structure"]
143impl crate::Readable for CE_ICR_SPEC {}
144#[doc = "`write(|w| ..)` method takes [`ce_icr::W`](W) writer structure"]
145impl crate::Writable for CE_ICR_SPEC {
146    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
147    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
148}
149#[doc = "`reset()` method sets ce_icr to value 0"]
150impl crate::Resettable for CE_ICR_SPEC {
151    const RESET_VALUE: Self::Ux = 0;
152}