d1_pac/cir_rx/
cir_rxpcfg.rs

1#[doc = "Register `cir_rxpcfg` reader"]
2pub type R = crate::R<CIR_RXPCFG_SPEC>;
3#[doc = "Register `cir_rxpcfg` writer"]
4pub type W = crate::W<CIR_RXPCFG_SPEC>;
5#[doc = "Field `rppi` reader - Receiver Pulse Polarity Invert"]
6pub type RPPI_R = crate::BitReader<RPPI_A>;
7#[doc = "Receiver Pulse Polarity Invert\n\nValue on reset: 1"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum RPPI_A {
10    #[doc = "0: Do not invert receiver signal"]
11    NOT_INVERT = 0,
12    #[doc = "1: Invert receiver signal"]
13    INVERT = 1,
14}
15impl From<RPPI_A> for bool {
16    #[inline(always)]
17    fn from(variant: RPPI_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl RPPI_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> RPPI_A {
25        match self.bits {
26            false => RPPI_A::NOT_INVERT,
27            true => RPPI_A::INVERT,
28        }
29    }
30    #[doc = "Do not invert receiver signal"]
31    #[inline(always)]
32    pub fn is_not_invert(&self) -> bool {
33        *self == RPPI_A::NOT_INVERT
34    }
35    #[doc = "Invert receiver signal"]
36    #[inline(always)]
37    pub fn is_invert(&self) -> bool {
38        *self == RPPI_A::INVERT
39    }
40}
41#[doc = "Field `rppi` writer - Receiver Pulse Polarity Invert"]
42pub type RPPI_W<'a, REG> = crate::BitWriter<'a, REG, RPPI_A>;
43impl<'a, REG> RPPI_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Do not invert receiver signal"]
48    #[inline(always)]
49    pub fn not_invert(self) -> &'a mut crate::W<REG> {
50        self.variant(RPPI_A::NOT_INVERT)
51    }
52    #[doc = "Invert receiver signal"]
53    #[inline(always)]
54    pub fn invert(self) -> &'a mut crate::W<REG> {
55        self.variant(RPPI_A::INVERT)
56    }
57}
58impl R {
59    #[doc = "Bit 2 - Receiver Pulse Polarity Invert"]
60    #[inline(always)]
61    pub fn rppi(&self) -> RPPI_R {
62        RPPI_R::new(((self.bits >> 2) & 1) != 0)
63    }
64}
65impl W {
66    #[doc = "Bit 2 - Receiver Pulse Polarity Invert"]
67    #[inline(always)]
68    #[must_use]
69    pub fn rppi(&mut self) -> RPPI_W<CIR_RXPCFG_SPEC> {
70        RPPI_W::new(self, 2)
71    }
72    #[doc = r" Writes raw bits to the register."]
73    #[doc = r""]
74    #[doc = r" # Safety"]
75    #[doc = r""]
76    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
77    #[inline(always)]
78    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
79        self.bits = bits;
80        self
81    }
82}
83#[doc = "CIR Receiver Pulse Configure Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cir_rxpcfg::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 [`cir_rxpcfg::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
84pub struct CIR_RXPCFG_SPEC;
85impl crate::RegisterSpec for CIR_RXPCFG_SPEC {
86    type Ux = u32;
87}
88#[doc = "`read()` method returns [`cir_rxpcfg::R`](R) reader structure"]
89impl crate::Readable for CIR_RXPCFG_SPEC {}
90#[doc = "`write(|w| ..)` method takes [`cir_rxpcfg::W`](W) writer structure"]
91impl crate::Writable for CIR_RXPCFG_SPEC {
92    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
93    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
94}
95#[doc = "`reset()` method sets cir_rxpcfg to value 0x04"]
96impl crate::Resettable for CIR_RXPCFG_SPEC {
97    const RESET_VALUE: Self::Ux = 0x04;
98}