bl602_pac/glb/
led_driver.rs

1#[doc = "Register `led_driver` reader"]
2pub struct R(crate::R<LED_DRIVER_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<LED_DRIVER_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<LED_DRIVER_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<LED_DRIVER_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `led_driver` writer"]
17pub struct W(crate::W<LED_DRIVER_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<LED_DRIVER_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<LED_DRIVER_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<LED_DRIVER_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `led_din_reg` reader - "]
38pub type LED_DIN_REG_R = crate::BitReader<bool>;
39#[doc = "Field `led_din_reg` writer - "]
40pub type LED_DIN_REG_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_DRIVER_SPEC, bool, O>;
41#[doc = "Field `led_din_sel` reader - "]
42pub type LED_DIN_SEL_R = crate::BitReader<bool>;
43#[doc = "Field `led_din_sel` writer - "]
44pub type LED_DIN_SEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_DRIVER_SPEC, bool, O>;
45#[doc = "Field `led_din_polarity_sel` reader - "]
46pub type LED_DIN_POLARITY_SEL_R = crate::BitReader<bool>;
47#[doc = "Field `led_din_polarity_sel` writer - "]
48pub type LED_DIN_POLARITY_SEL_W<'a, const O: u8> =
49    crate::BitWriter<'a, u32, LED_DRIVER_SPEC, bool, O>;
50#[doc = "Field `leddrv_ibias` reader - "]
51pub type LEDDRV_IBIAS_R = crate::FieldReader<u8, u8>;
52#[doc = "Field `leddrv_ibias` writer - "]
53pub type LEDDRV_IBIAS_W<'a, const O: u8> =
54    crate::FieldWriter<'a, u32, LED_DRIVER_SPEC, u8, u8, 4, O>;
55#[doc = "Field `ir_rx_gpio_sel` reader - "]
56pub type IR_RX_GPIO_SEL_R = crate::FieldReader<u8, u8>;
57#[doc = "Field `ir_rx_gpio_sel` writer - "]
58pub type IR_RX_GPIO_SEL_W<'a, const O: u8> =
59    crate::FieldWriter<'a, u32, LED_DRIVER_SPEC, u8, u8, 2, O>;
60#[doc = "Field `pu_leddrv` reader - "]
61pub type PU_LEDDRV_R = crate::BitReader<bool>;
62#[doc = "Field `pu_leddrv` writer - "]
63pub type PU_LEDDRV_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_DRIVER_SPEC, bool, O>;
64impl R {
65    #[doc = "Bit 0"]
66    #[inline(always)]
67    pub fn led_din_reg(&self) -> LED_DIN_REG_R {
68        LED_DIN_REG_R::new((self.bits & 1) != 0)
69    }
70    #[doc = "Bit 1"]
71    #[inline(always)]
72    pub fn led_din_sel(&self) -> LED_DIN_SEL_R {
73        LED_DIN_SEL_R::new(((self.bits >> 1) & 1) != 0)
74    }
75    #[doc = "Bit 2"]
76    #[inline(always)]
77    pub fn led_din_polarity_sel(&self) -> LED_DIN_POLARITY_SEL_R {
78        LED_DIN_POLARITY_SEL_R::new(((self.bits >> 2) & 1) != 0)
79    }
80    #[doc = "Bits 4:7"]
81    #[inline(always)]
82    pub fn leddrv_ibias(&self) -> LEDDRV_IBIAS_R {
83        LEDDRV_IBIAS_R::new(((self.bits >> 4) & 0x0f) as u8)
84    }
85    #[doc = "Bits 8:9"]
86    #[inline(always)]
87    pub fn ir_rx_gpio_sel(&self) -> IR_RX_GPIO_SEL_R {
88        IR_RX_GPIO_SEL_R::new(((self.bits >> 8) & 3) as u8)
89    }
90    #[doc = "Bit 31"]
91    #[inline(always)]
92    pub fn pu_leddrv(&self) -> PU_LEDDRV_R {
93        PU_LEDDRV_R::new(((self.bits >> 31) & 1) != 0)
94    }
95}
96impl W {
97    #[doc = "Bit 0"]
98    #[inline(always)]
99    #[must_use]
100    pub fn led_din_reg(&mut self) -> LED_DIN_REG_W<0> {
101        LED_DIN_REG_W::new(self)
102    }
103    #[doc = "Bit 1"]
104    #[inline(always)]
105    #[must_use]
106    pub fn led_din_sel(&mut self) -> LED_DIN_SEL_W<1> {
107        LED_DIN_SEL_W::new(self)
108    }
109    #[doc = "Bit 2"]
110    #[inline(always)]
111    #[must_use]
112    pub fn led_din_polarity_sel(&mut self) -> LED_DIN_POLARITY_SEL_W<2> {
113        LED_DIN_POLARITY_SEL_W::new(self)
114    }
115    #[doc = "Bits 4:7"]
116    #[inline(always)]
117    #[must_use]
118    pub fn leddrv_ibias(&mut self) -> LEDDRV_IBIAS_W<4> {
119        LEDDRV_IBIAS_W::new(self)
120    }
121    #[doc = "Bits 8:9"]
122    #[inline(always)]
123    #[must_use]
124    pub fn ir_rx_gpio_sel(&mut self) -> IR_RX_GPIO_SEL_W<8> {
125        IR_RX_GPIO_SEL_W::new(self)
126    }
127    #[doc = "Bit 31"]
128    #[inline(always)]
129    #[must_use]
130    pub fn pu_leddrv(&mut self) -> PU_LEDDRV_W<31> {
131        PU_LEDDRV_W::new(self)
132    }
133    #[doc = "Writes raw bits to the register."]
134    #[inline(always)]
135    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
136        self.0.bits(bits);
137        self
138    }
139}
140#[doc = "led_driver.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [led_driver](index.html) module"]
141pub struct LED_DRIVER_SPEC;
142impl crate::RegisterSpec for LED_DRIVER_SPEC {
143    type Ux = u32;
144}
145#[doc = "`read()` method returns [led_driver::R](R) reader structure"]
146impl crate::Readable for LED_DRIVER_SPEC {
147    type Reader = R;
148}
149#[doc = "`write(|w| ..)` method takes [led_driver::W](W) writer structure"]
150impl crate::Writable for LED_DRIVER_SPEC {
151    type Writer = W;
152    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
153    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
154}
155#[doc = "`reset()` method sets led_driver to value 0x80"]
156impl crate::Resettable for LED_DRIVER_SPEC {
157    const RESET_VALUE: Self::Ux = 0x80;
158}