mcxn947_pac/tsi0/
data.rs

1#[doc = "Register `DATA` reader"]
2pub type R = crate::R<DATA_SPEC>;
3#[doc = "Register `DATA` writer"]
4pub type W = crate::W<DATA_SPEC>;
5#[doc = "Field `TSICNT` reader - TSI Conversion Counter Value"]
6pub type TSICNT_R = crate::FieldReader<u16>;
7#[doc = "Field `EOSF` reader - End-of-Scan Flag"]
8pub type EOSF_R = crate::BitReader;
9#[doc = "Field `EOSF` writer - End-of-Scan Flag"]
10pub type EOSF_W<'a, REG> = crate::BitWriter<'a, REG>;
11#[doc = "Field `OVERRUNF` reader - Overrun Flag"]
12pub type OVERRUNF_R = crate::BitReader<OVERRUNF_A>;
13#[doc = "Overrun Flag\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq, Eq)]
15pub enum OVERRUNF_A {
16    #[doc = "0: No"]
17    DISABLED = 0,
18    #[doc = "1: Yes"]
19    ENABLED = 1,
20}
21impl From<OVERRUNF_A> for bool {
22    #[inline(always)]
23    fn from(variant: OVERRUNF_A) -> Self {
24        variant as u8 != 0
25    }
26}
27impl OVERRUNF_R {
28    #[doc = "Get enumerated values variant"]
29    #[inline(always)]
30    pub const fn variant(&self) -> OVERRUNF_A {
31        match self.bits {
32            false => OVERRUNF_A::DISABLED,
33            true => OVERRUNF_A::ENABLED,
34        }
35    }
36    #[doc = "No"]
37    #[inline(always)]
38    pub fn is_disabled(&self) -> bool {
39        *self == OVERRUNF_A::DISABLED
40    }
41    #[doc = "Yes"]
42    #[inline(always)]
43    pub fn is_enabled(&self) -> bool {
44        *self == OVERRUNF_A::ENABLED
45    }
46}
47#[doc = "Field `OVERRUNF` writer - Overrun Flag"]
48pub type OVERRUNF_W<'a, REG> = crate::BitWriter<'a, REG, OVERRUNF_A>;
49impl<'a, REG> OVERRUNF_W<'a, REG>
50where
51    REG: crate::Writable + crate::RegisterSpec,
52{
53    #[doc = "No"]
54    #[inline(always)]
55    pub fn disabled(self) -> &'a mut crate::W<REG> {
56        self.variant(OVERRUNF_A::DISABLED)
57    }
58    #[doc = "Yes"]
59    #[inline(always)]
60    pub fn enabled(self) -> &'a mut crate::W<REG> {
61        self.variant(OVERRUNF_A::ENABLED)
62    }
63}
64#[doc = "Field `OUTRGF` reader - Out-of-Range Flag"]
65pub type OUTRGF_R = crate::BitReader;
66#[doc = "Field `OUTRGF` writer - Out-of-Range Flag"]
67pub type OUTRGF_W<'a, REG> = crate::BitWriter<'a, REG>;
68impl R {
69    #[doc = "Bits 0:15 - TSI Conversion Counter Value"]
70    #[inline(always)]
71    pub fn tsicnt(&self) -> TSICNT_R {
72        TSICNT_R::new((self.bits & 0xffff) as u16)
73    }
74    #[doc = "Bit 27 - End-of-Scan Flag"]
75    #[inline(always)]
76    pub fn eosf(&self) -> EOSF_R {
77        EOSF_R::new(((self.bits >> 27) & 1) != 0)
78    }
79    #[doc = "Bit 29 - Overrun Flag"]
80    #[inline(always)]
81    pub fn overrunf(&self) -> OVERRUNF_R {
82        OVERRUNF_R::new(((self.bits >> 29) & 1) != 0)
83    }
84    #[doc = "Bit 30 - Out-of-Range Flag"]
85    #[inline(always)]
86    pub fn outrgf(&self) -> OUTRGF_R {
87        OUTRGF_R::new(((self.bits >> 30) & 1) != 0)
88    }
89}
90impl W {
91    #[doc = "Bit 27 - End-of-Scan Flag"]
92    #[inline(always)]
93    #[must_use]
94    pub fn eosf(&mut self) -> EOSF_W<DATA_SPEC> {
95        EOSF_W::new(self, 27)
96    }
97    #[doc = "Bit 29 - Overrun Flag"]
98    #[inline(always)]
99    #[must_use]
100    pub fn overrunf(&mut self) -> OVERRUNF_W<DATA_SPEC> {
101        OVERRUNF_W::new(self, 29)
102    }
103    #[doc = "Bit 30 - Out-of-Range Flag"]
104    #[inline(always)]
105    #[must_use]
106    pub fn outrgf(&mut self) -> OUTRGF_W<DATA_SPEC> {
107        OUTRGF_W::new(self, 30)
108    }
109    #[doc = r" Writes raw bits to the register."]
110    #[doc = r""]
111    #[doc = r" # Safety"]
112    #[doc = r""]
113    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
114    #[inline(always)]
115    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
116        self.bits = bits;
117        self
118    }
119}
120#[doc = "TSI Data and Status\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`data::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 [`data::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
121pub struct DATA_SPEC;
122impl crate::RegisterSpec for DATA_SPEC {
123    type Ux = u32;
124}
125#[doc = "`read()` method returns [`data::R`](R) reader structure"]
126impl crate::Readable for DATA_SPEC {}
127#[doc = "`write(|w| ..)` method takes [`data::W`](W) writer structure"]
128impl crate::Writable for DATA_SPEC {
129    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
130    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
131}
132#[doc = "`reset()` method sets DATA to value 0"]
133impl crate::Resettable for DATA_SPEC {
134    const RESET_VALUE: u32 = 0;
135}