esp32h2/pcnt/
u_status.rs

1#[doc = "Register `U%s_STATUS` reader"]
2pub type R = crate::R<U_STATUS_SPEC>;
3#[doc = "Field `ZERO_MODE` reader - The pulse counter status of PCNT_U%s corresponding to 0. 0: pulse counter decreases from positive to 0. 1: pulse counter increases from negative to 0. 2: pulse counter is negative. 3: pulse counter is positive."]
4pub type ZERO_MODE_R = crate::FieldReader;
5#[doc = "Field `THRES1` reader - The latched value of thres1 event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thres1 and thres1 event is valid. 0: others"]
6pub type THRES1_R = crate::BitReader;
7#[doc = "Field `THRES0` reader - The latched value of thres0 event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thres0 and thres0 event is valid. 0: others"]
8pub type THRES0_R = crate::BitReader;
9#[doc = "Field `L_LIM` reader - The latched value of low limit event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thr_l_lim and low limit event is valid. 0: others"]
10pub type L_LIM_R = crate::BitReader;
11#[doc = "Field `H_LIM` reader - The latched value of high limit event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thr_h_lim and high limit event is valid. 0: others"]
12pub type H_LIM_R = crate::BitReader;
13#[doc = "Field `ZERO` reader - The latched value of zero threshold event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to 0 and zero threshold event is valid. 0: others"]
14pub type ZERO_R = crate::BitReader;
15impl R {
16    #[doc = "Bits 0:1 - The pulse counter status of PCNT_U%s corresponding to 0. 0: pulse counter decreases from positive to 0. 1: pulse counter increases from negative to 0. 2: pulse counter is negative. 3: pulse counter is positive."]
17    #[inline(always)]
18    pub fn zero_mode(&self) -> ZERO_MODE_R {
19        ZERO_MODE_R::new((self.bits & 3) as u8)
20    }
21    #[doc = "Bit 2 - The latched value of thres1 event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thres1 and thres1 event is valid. 0: others"]
22    #[inline(always)]
23    pub fn thres1(&self) -> THRES1_R {
24        THRES1_R::new(((self.bits >> 2) & 1) != 0)
25    }
26    #[doc = "Bit 3 - The latched value of thres0 event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thres0 and thres0 event is valid. 0: others"]
27    #[inline(always)]
28    pub fn thres0(&self) -> THRES0_R {
29        THRES0_R::new(((self.bits >> 3) & 1) != 0)
30    }
31    #[doc = "Bit 4 - The latched value of low limit event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thr_l_lim and low limit event is valid. 0: others"]
32    #[inline(always)]
33    pub fn l_lim(&self) -> L_LIM_R {
34        L_LIM_R::new(((self.bits >> 4) & 1) != 0)
35    }
36    #[doc = "Bit 5 - The latched value of high limit event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to thr_h_lim and high limit event is valid. 0: others"]
37    #[inline(always)]
38    pub fn h_lim(&self) -> H_LIM_R {
39        H_LIM_R::new(((self.bits >> 5) & 1) != 0)
40    }
41    #[doc = "Bit 6 - The latched value of zero threshold event of PCNT_U%s when threshold event interrupt is valid. 1: the current pulse counter equals to 0 and zero threshold event is valid. 0: others"]
42    #[inline(always)]
43    pub fn zero(&self) -> ZERO_R {
44        ZERO_R::new(((self.bits >> 6) & 1) != 0)
45    }
46}
47#[cfg(feature = "impl-register-debug")]
48impl core::fmt::Debug for R {
49    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
50        f.debug_struct("U_STATUS")
51            .field("zero_mode", &self.zero_mode())
52            .field("thres1", &self.thres1())
53            .field("thres0", &self.thres0())
54            .field("l_lim", &self.l_lim())
55            .field("h_lim", &self.h_lim())
56            .field("zero", &self.zero())
57            .finish()
58    }
59}
60#[doc = "PNCT UNIT%s status register\n\nYou can [`read`](crate::Reg::read) this register and get [`u_status::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
61pub struct U_STATUS_SPEC;
62impl crate::RegisterSpec for U_STATUS_SPEC {
63    type Ux = u32;
64}
65#[doc = "`read()` method returns [`u_status::R`](R) reader structure"]
66impl crate::Readable for U_STATUS_SPEC {}
67#[doc = "`reset()` method sets U%s_STATUS to value 0"]
68impl crate::Resettable for U_STATUS_SPEC {
69    const RESET_VALUE: u32 = 0;
70}