max78000_pac/lpcmp/
ctrl.rs

1#[doc = "Register `CTRL[%s]` reader"]
2pub type R = crate::R<CtrlSpec>;
3#[doc = "Register `CTRL[%s]` writer"]
4pub type W = crate::W<CtrlSpec>;
5#[doc = "Field `EN` reader - Comparator Enable."]
6pub type EnR = crate::BitReader;
7#[doc = "Field `EN` writer - Comparator Enable."]
8pub type EnW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `POL` reader - Polarity Select"]
10pub type PolR = crate::BitReader;
11#[doc = "Field `POL` writer - Polarity Select"]
12pub type PolW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `INTEN` reader - IRQ Enable."]
14pub type IntenR = crate::BitReader;
15#[doc = "Field `INTEN` writer - IRQ Enable."]
16pub type IntenW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `OUT` reader - Raw Compartor Input."]
18pub type OutR = crate::BitReader;
19#[doc = "Field `OUT` writer - Raw Compartor Input."]
20pub type OutW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `INTFL` reader - IRQ Flag"]
22pub type IntflR = crate::BitReader;
23#[doc = "Field `INTFL` writer - IRQ Flag"]
24pub type IntflW<'a, REG> = crate::BitWriter<'a, REG>;
25impl R {
26    #[doc = "Bit 0 - Comparator Enable."]
27    #[inline(always)]
28    pub fn en(&self) -> EnR {
29        EnR::new((self.bits & 1) != 0)
30    }
31    #[doc = "Bit 5 - Polarity Select"]
32    #[inline(always)]
33    pub fn pol(&self) -> PolR {
34        PolR::new(((self.bits >> 5) & 1) != 0)
35    }
36    #[doc = "Bit 6 - IRQ Enable."]
37    #[inline(always)]
38    pub fn inten(&self) -> IntenR {
39        IntenR::new(((self.bits >> 6) & 1) != 0)
40    }
41    #[doc = "Bit 14 - Raw Compartor Input."]
42    #[inline(always)]
43    pub fn out(&self) -> OutR {
44        OutR::new(((self.bits >> 14) & 1) != 0)
45    }
46    #[doc = "Bit 15 - IRQ Flag"]
47    #[inline(always)]
48    pub fn intfl(&self) -> IntflR {
49        IntflR::new(((self.bits >> 15) & 1) != 0)
50    }
51}
52impl W {
53    #[doc = "Bit 0 - Comparator Enable."]
54    #[inline(always)]
55    pub fn en(&mut self) -> EnW<CtrlSpec> {
56        EnW::new(self, 0)
57    }
58    #[doc = "Bit 5 - Polarity Select"]
59    #[inline(always)]
60    pub fn pol(&mut self) -> PolW<CtrlSpec> {
61        PolW::new(self, 5)
62    }
63    #[doc = "Bit 6 - IRQ Enable."]
64    #[inline(always)]
65    pub fn inten(&mut self) -> IntenW<CtrlSpec> {
66        IntenW::new(self, 6)
67    }
68    #[doc = "Bit 14 - Raw Compartor Input."]
69    #[inline(always)]
70    pub fn out(&mut self) -> OutW<CtrlSpec> {
71        OutW::new(self, 14)
72    }
73    #[doc = "Bit 15 - IRQ Flag"]
74    #[inline(always)]
75    pub fn intfl(&mut self) -> IntflW<CtrlSpec> {
76        IntflW::new(self, 15)
77    }
78}
79#[doc = "Comparator Control Register.\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct CtrlSpec;
81impl crate::RegisterSpec for CtrlSpec {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
85impl crate::Readable for CtrlSpec {}
86#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
87impl crate::Writable for CtrlSpec {
88    type Safety = crate::Unsafe;
89    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
90    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
91}
92#[doc = "`reset()` method sets CTRL[%s]
93to value 0"]
94impl crate::Resettable for CtrlSpec {
95    const RESET_VALUE: u32 = 0;
96}