lpc550x/flash_cmpa/
boot_cfg.rs

1#[doc = "Register `BOOT_CFG` reader"]
2pub struct R(crate::R<BOOT_CFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<BOOT_CFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<BOOT_CFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<BOOT_CFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `BOOT_CFG` writer"]
17pub struct W(crate::W<BOOT_CFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<BOOT_CFG_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<BOOT_CFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<BOOT_CFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DEFAULT_ISP_MODE` reader - Default ISP mode:"]
38pub type DEFAULT_ISP_MODE_R = crate::FieldReader<u8, DEFAULT_ISP_MODE_A>;
39#[doc = "Default ISP mode:\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum DEFAULT_ISP_MODE_A {
43    #[doc = "0: Auto ISP."]
44    AUTO_ISP = 0,
45    #[doc = "1: USB_HID_ISP."]
46    USB_HID_ISP = 1,
47    #[doc = "2: UART ISP."]
48    UART_ISP = 2,
49    #[doc = "3: SPI Slave ISP."]
50    SPI_ISP = 3,
51    #[doc = "4: I2C Slave ISP."]
52    I2C_ISP = 4,
53    #[doc = "7: Disable ISP fall through."]
54    DISABLE = 7,
55}
56impl From<DEFAULT_ISP_MODE_A> for u8 {
57    #[inline(always)]
58    fn from(variant: DEFAULT_ISP_MODE_A) -> Self {
59        variant as _
60    }
61}
62impl DEFAULT_ISP_MODE_R {
63    #[doc = "Get enumerated values variant"]
64    #[inline(always)]
65    pub fn variant(&self) -> Option<DEFAULT_ISP_MODE_A> {
66        match self.bits {
67            0 => Some(DEFAULT_ISP_MODE_A::AUTO_ISP),
68            1 => Some(DEFAULT_ISP_MODE_A::USB_HID_ISP),
69            2 => Some(DEFAULT_ISP_MODE_A::UART_ISP),
70            3 => Some(DEFAULT_ISP_MODE_A::SPI_ISP),
71            4 => Some(DEFAULT_ISP_MODE_A::I2C_ISP),
72            7 => Some(DEFAULT_ISP_MODE_A::DISABLE),
73            _ => None,
74        }
75    }
76    #[doc = "Checks if the value of the field is `AUTO_ISP`"]
77    #[inline(always)]
78    pub fn is_auto_isp(&self) -> bool {
79        *self == DEFAULT_ISP_MODE_A::AUTO_ISP
80    }
81    #[doc = "Checks if the value of the field is `USB_HID_ISP`"]
82    #[inline(always)]
83    pub fn is_usb_hid_isp(&self) -> bool {
84        *self == DEFAULT_ISP_MODE_A::USB_HID_ISP
85    }
86    #[doc = "Checks if the value of the field is `UART_ISP`"]
87    #[inline(always)]
88    pub fn is_uart_isp(&self) -> bool {
89        *self == DEFAULT_ISP_MODE_A::UART_ISP
90    }
91    #[doc = "Checks if the value of the field is `SPI_ISP`"]
92    #[inline(always)]
93    pub fn is_spi_isp(&self) -> bool {
94        *self == DEFAULT_ISP_MODE_A::SPI_ISP
95    }
96    #[doc = "Checks if the value of the field is `I2C_ISP`"]
97    #[inline(always)]
98    pub fn is_i2c_isp(&self) -> bool {
99        *self == DEFAULT_ISP_MODE_A::I2C_ISP
100    }
101    #[doc = "Checks if the value of the field is `DISABLE`"]
102    #[inline(always)]
103    pub fn is_disable(&self) -> bool {
104        *self == DEFAULT_ISP_MODE_A::DISABLE
105    }
106}
107#[doc = "Field `DEFAULT_ISP_MODE` writer - Default ISP mode:"]
108pub type DEFAULT_ISP_MODE_W<'a, const O: u8> =
109    crate::FieldWriter<'a, u32, BOOT_CFG_SPEC, u8, DEFAULT_ISP_MODE_A, 3, O>;
110impl<'a, const O: u8> DEFAULT_ISP_MODE_W<'a, O> {
111    #[doc = "Auto ISP."]
112    #[inline(always)]
113    pub fn auto_isp(self) -> &'a mut W {
114        self.variant(DEFAULT_ISP_MODE_A::AUTO_ISP)
115    }
116    #[doc = "USB_HID_ISP."]
117    #[inline(always)]
118    pub fn usb_hid_isp(self) -> &'a mut W {
119        self.variant(DEFAULT_ISP_MODE_A::USB_HID_ISP)
120    }
121    #[doc = "UART ISP."]
122    #[inline(always)]
123    pub fn uart_isp(self) -> &'a mut W {
124        self.variant(DEFAULT_ISP_MODE_A::UART_ISP)
125    }
126    #[doc = "SPI Slave ISP."]
127    #[inline(always)]
128    pub fn spi_isp(self) -> &'a mut W {
129        self.variant(DEFAULT_ISP_MODE_A::SPI_ISP)
130    }
131    #[doc = "I2C Slave ISP."]
132    #[inline(always)]
133    pub fn i2c_isp(self) -> &'a mut W {
134        self.variant(DEFAULT_ISP_MODE_A::I2C_ISP)
135    }
136    #[doc = "Disable ISP fall through."]
137    #[inline(always)]
138    pub fn disable(self) -> &'a mut W {
139        self.variant(DEFAULT_ISP_MODE_A::DISABLE)
140    }
141}
142#[doc = "Field `BOOT_SPEED` reader - Core clock:"]
143pub type BOOT_SPEED_R = crate::FieldReader<u8, BOOT_SPEED_A>;
144#[doc = "Core clock:\n\nValue on reset: 0"]
145#[derive(Clone, Copy, Debug, PartialEq, Eq)]
146#[repr(u8)]
147pub enum BOOT_SPEED_A {
148    #[doc = "0: Defined by NMPA.SYSTEM_SPEED_CODE."]
149    VALUE_0 = 0,
150    #[doc = "2: 48MHz FRO."]
151    VALUE_2 = 2,
152}
153impl From<BOOT_SPEED_A> for u8 {
154    #[inline(always)]
155    fn from(variant: BOOT_SPEED_A) -> Self {
156        variant as _
157    }
158}
159impl BOOT_SPEED_R {
160    #[doc = "Get enumerated values variant"]
161    #[inline(always)]
162    pub fn variant(&self) -> Option<BOOT_SPEED_A> {
163        match self.bits {
164            0 => Some(BOOT_SPEED_A::VALUE_0),
165            2 => Some(BOOT_SPEED_A::VALUE_2),
166            _ => None,
167        }
168    }
169    #[doc = "Checks if the value of the field is `VALUE_0`"]
170    #[inline(always)]
171    pub fn is_value_0(&self) -> bool {
172        *self == BOOT_SPEED_A::VALUE_0
173    }
174    #[doc = "Checks if the value of the field is `VALUE_2`"]
175    #[inline(always)]
176    pub fn is_value_2(&self) -> bool {
177        *self == BOOT_SPEED_A::VALUE_2
178    }
179}
180#[doc = "Field `BOOT_SPEED` writer - Core clock:"]
181pub type BOOT_SPEED_W<'a, const O: u8> =
182    crate::FieldWriter<'a, u32, BOOT_CFG_SPEC, u8, BOOT_SPEED_A, 2, O>;
183impl<'a, const O: u8> BOOT_SPEED_W<'a, O> {
184    #[doc = "Defined by NMPA.SYSTEM_SPEED_CODE."]
185    #[inline(always)]
186    pub fn value_0(self) -> &'a mut W {
187        self.variant(BOOT_SPEED_A::VALUE_0)
188    }
189    #[doc = "48MHz FRO."]
190    #[inline(always)]
191    pub fn value_2(self) -> &'a mut W {
192        self.variant(BOOT_SPEED_A::VALUE_2)
193    }
194}
195#[doc = "Field `BOOT_FAILURE_PIN` reader - GPIO port and pin number to use for indicating failure reason. The toggle rate of the pin is used to decode the error type. \\[2:0\\]
196- Defines GPIO port \\[7:3\\]
197- Defines GPIO pin."]
198pub type BOOT_FAILURE_PIN_R = crate::FieldReader<u8, u8>;
199#[doc = "Field `BOOT_FAILURE_PIN` writer - GPIO port and pin number to use for indicating failure reason. The toggle rate of the pin is used to decode the error type. \\[2:0\\]
200- Defines GPIO port \\[7:3\\]
201- Defines GPIO pin."]
202pub type BOOT_FAILURE_PIN_W<'a, const O: u8> =
203    crate::FieldWriter<'a, u32, BOOT_CFG_SPEC, u8, u8, 8, O>;
204impl R {
205    #[doc = "Bits 4:6 - Default ISP mode:"]
206    #[inline(always)]
207    pub fn default_isp_mode(&self) -> DEFAULT_ISP_MODE_R {
208        DEFAULT_ISP_MODE_R::new(((self.bits >> 4) & 7) as u8)
209    }
210    #[doc = "Bits 7:8 - Core clock:"]
211    #[inline(always)]
212    pub fn boot_speed(&self) -> BOOT_SPEED_R {
213        BOOT_SPEED_R::new(((self.bits >> 7) & 3) as u8)
214    }
215    #[doc = "Bits 24:31 - GPIO port and pin number to use for indicating failure reason. The toggle rate of the pin is used to decode the error type. \\[2:0\\]
216- Defines GPIO port \\[7:3\\]
217- Defines GPIO pin."]
218    #[inline(always)]
219    pub fn boot_failure_pin(&self) -> BOOT_FAILURE_PIN_R {
220        BOOT_FAILURE_PIN_R::new(((self.bits >> 24) & 0xff) as u8)
221    }
222}
223impl W {
224    #[doc = "Bits 4:6 - Default ISP mode:"]
225    #[inline(always)]
226    pub fn default_isp_mode(&mut self) -> DEFAULT_ISP_MODE_W<4> {
227        DEFAULT_ISP_MODE_W::new(self)
228    }
229    #[doc = "Bits 7:8 - Core clock:"]
230    #[inline(always)]
231    pub fn boot_speed(&mut self) -> BOOT_SPEED_W<7> {
232        BOOT_SPEED_W::new(self)
233    }
234    #[doc = "Bits 24:31 - GPIO port and pin number to use for indicating failure reason. The toggle rate of the pin is used to decode the error type. \\[2:0\\]
235- Defines GPIO port \\[7:3\\]
236- Defines GPIO pin."]
237    #[inline(always)]
238    pub fn boot_failure_pin(&mut self) -> BOOT_FAILURE_PIN_W<24> {
239        BOOT_FAILURE_PIN_W::new(self)
240    }
241    #[doc = "Writes raw bits to the register."]
242    #[inline(always)]
243    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
244        self.0.bits(bits);
245        self
246    }
247}
248#[doc = "no description available.\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 [boot_cfg](index.html) module"]
249pub struct BOOT_CFG_SPEC;
250impl crate::RegisterSpec for BOOT_CFG_SPEC {
251    type Ux = u32;
252}
253#[doc = "`read()` method returns [boot_cfg::R](R) reader structure"]
254impl crate::Readable for BOOT_CFG_SPEC {
255    type Reader = R;
256}
257#[doc = "`write(|w| ..)` method takes [boot_cfg::W](W) writer structure"]
258impl crate::Writable for BOOT_CFG_SPEC {
259    type Writer = W;
260}
261#[doc = "`reset()` method sets BOOT_CFG to value 0"]
262impl crate::Resettable for BOOT_CFG_SPEC {
263    #[inline(always)]
264    fn reset_value() -> Self::Ux {
265        0
266    }
267}