lpc82x_pac/flash_ctrl/
flashcfg.rs1#[doc = "Register `FLASHCFG` reader"]
2pub struct R(crate::R<FLASHCFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FLASHCFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FLASHCFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FLASHCFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `FLASHCFG` writer"]
17pub struct W(crate::W<FLASHCFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<FLASHCFG_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<FLASHCFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<FLASHCFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access.\n\nValue on reset: 1"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum FLASHTIM_A {
41 #[doc = "0: 1 system clock flash access time."]
42 ONE_SYSTEM_CLOCK_FLASH_ACCESS = 0,
43 #[doc = "1: 2 system clock flash access time."]
44 TWO_SYSTEM_CLOCK_FLASH_ACCESS = 1,
45}
46impl From<FLASHTIM_A> for u8 {
47 #[inline(always)]
48 fn from(variant: FLASHTIM_A) -> Self {
49 variant as _
50 }
51}
52#[doc = "Field `FLASHTIM` reader - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
53pub struct FLASHTIM_R(crate::FieldReader<u8, FLASHTIM_A>);
54impl FLASHTIM_R {
55 pub(crate) fn new(bits: u8) -> Self {
56 FLASHTIM_R(crate::FieldReader::new(bits))
57 }
58 #[doc = r"Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> Option<FLASHTIM_A> {
61 match self.bits {
62 0 => Some(FLASHTIM_A::ONE_SYSTEM_CLOCK_FLASH_ACCESS),
63 1 => Some(FLASHTIM_A::TWO_SYSTEM_CLOCK_FLASH_ACCESS),
64 _ => None,
65 }
66 }
67 #[doc = "Checks if the value of the field is `ONE_SYSTEM_CLOCK_FLASH_ACCESS`"]
68 #[inline(always)]
69 pub fn is_one_system_clock_flash_access(&self) -> bool {
70 **self == FLASHTIM_A::ONE_SYSTEM_CLOCK_FLASH_ACCESS
71 }
72 #[doc = "Checks if the value of the field is `TWO_SYSTEM_CLOCK_FLASH_ACCESS`"]
73 #[inline(always)]
74 pub fn is_two_system_clock_flash_access(&self) -> bool {
75 **self == FLASHTIM_A::TWO_SYSTEM_CLOCK_FLASH_ACCESS
76 }
77}
78impl core::ops::Deref for FLASHTIM_R {
79 type Target = crate::FieldReader<u8, FLASHTIM_A>;
80 #[inline(always)]
81 fn deref(&self) -> &Self::Target {
82 &self.0
83 }
84}
85#[doc = "Field `FLASHTIM` writer - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
86pub struct FLASHTIM_W<'a> {
87 w: &'a mut W,
88}
89impl<'a> FLASHTIM_W<'a> {
90 #[doc = r"Writes `variant` to the field"]
91 #[inline(always)]
92 pub fn variant(self, variant: FLASHTIM_A) -> &'a mut W {
93 unsafe { self.bits(variant.into()) }
94 }
95 #[doc = "1 system clock flash access time."]
96 #[inline(always)]
97 pub fn one_system_clock_flash_access(self) -> &'a mut W {
98 self.variant(FLASHTIM_A::ONE_SYSTEM_CLOCK_FLASH_ACCESS)
99 }
100 #[doc = "2 system clock flash access time."]
101 #[inline(always)]
102 pub fn two_system_clock_flash_access(self) -> &'a mut W {
103 self.variant(FLASHTIM_A::TWO_SYSTEM_CLOCK_FLASH_ACCESS)
104 }
105 #[doc = r"Writes raw bits to the field"]
106 #[inline(always)]
107 pub unsafe fn bits(self, value: u8) -> &'a mut W {
108 self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
109 self.w
110 }
111}
112impl R {
113 #[doc = "Bits 0:1 - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
114 #[inline(always)]
115 pub fn flashtim(&self) -> FLASHTIM_R {
116 FLASHTIM_R::new((self.bits & 0x03) as u8)
117 }
118}
119impl W {
120 #[doc = "Bits 0:1 - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
121 #[inline(always)]
122 pub fn flashtim(&mut self) -> FLASHTIM_W {
123 FLASHTIM_W { w: self }
124 }
125 #[doc = "Writes raw bits to the register."]
126 #[inline(always)]
127 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
128 self.0.bits(bits);
129 self
130 }
131}
132#[doc = "Flash configuration register\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 [flashcfg](index.html) module"]
133pub struct FLASHCFG_SPEC;
134impl crate::RegisterSpec for FLASHCFG_SPEC {
135 type Ux = u32;
136}
137#[doc = "`read()` method returns [flashcfg::R](R) reader structure"]
138impl crate::Readable for FLASHCFG_SPEC {
139 type Reader = R;
140}
141#[doc = "`write(|w| ..)` method takes [flashcfg::W](W) writer structure"]
142impl crate::Writable for FLASHCFG_SPEC {
143 type Writer = W;
144}
145#[doc = "`reset()` method sets FLASHCFG to value 0x01"]
146impl crate::Resettable for FLASHCFG_SPEC {
147 #[inline(always)]
148 fn reset_value() -> Self::Ux {
149 0x01
150 }
151}