lpc845_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: 2"]
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 #[doc = "2: 3 system clock flash access time."]
46 THREE_SYSTEM_CLOCK_FLASH_ACCESS = 2,
47}
48impl From<FLASHTIM_A> for u8 {
49 #[inline(always)]
50 fn from(variant: FLASHTIM_A) -> Self {
51 variant as _
52 }
53}
54#[doc = "Field `FLASHTIM` reader - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
55pub struct FLASHTIM_R(crate::FieldReader<u8, FLASHTIM_A>);
56impl FLASHTIM_R {
57 pub(crate) fn new(bits: u8) -> Self {
58 FLASHTIM_R(crate::FieldReader::new(bits))
59 }
60 #[doc = r"Get enumerated values variant"]
61 #[inline(always)]
62 pub fn variant(&self) -> Option<FLASHTIM_A> {
63 match self.bits {
64 0 => Some(FLASHTIM_A::ONE_SYSTEM_CLOCK_FLASH_ACCESS),
65 1 => Some(FLASHTIM_A::TWO_SYSTEM_CLOCK_FLASH_ACCESS),
66 2 => Some(FLASHTIM_A::THREE_SYSTEM_CLOCK_FLASH_ACCESS),
67 _ => None,
68 }
69 }
70 #[doc = "Checks if the value of the field is `ONE_SYSTEM_CLOCK_FLASH_ACCESS`"]
71 #[inline(always)]
72 pub fn is_one_system_clock_flash_access(&self) -> bool {
73 **self == FLASHTIM_A::ONE_SYSTEM_CLOCK_FLASH_ACCESS
74 }
75 #[doc = "Checks if the value of the field is `TWO_SYSTEM_CLOCK_FLASH_ACCESS`"]
76 #[inline(always)]
77 pub fn is_two_system_clock_flash_access(&self) -> bool {
78 **self == FLASHTIM_A::TWO_SYSTEM_CLOCK_FLASH_ACCESS
79 }
80 #[doc = "Checks if the value of the field is `THREE_SYSTEM_CLOCK_FLASH_ACCESS`"]
81 #[inline(always)]
82 pub fn is_three_system_clock_flash_access(&self) -> bool {
83 **self == FLASHTIM_A::THREE_SYSTEM_CLOCK_FLASH_ACCESS
84 }
85}
86impl core::ops::Deref for FLASHTIM_R {
87 type Target = crate::FieldReader<u8, FLASHTIM_A>;
88 #[inline(always)]
89 fn deref(&self) -> &Self::Target {
90 &self.0
91 }
92}
93#[doc = "Field `FLASHTIM` writer - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
94pub struct FLASHTIM_W<'a> {
95 w: &'a mut W,
96}
97impl<'a> FLASHTIM_W<'a> {
98 #[doc = r"Writes `variant` to the field"]
99 #[inline(always)]
100 pub fn variant(self, variant: FLASHTIM_A) -> &'a mut W {
101 unsafe { self.bits(variant.into()) }
102 }
103 #[doc = "1 system clock flash access time."]
104 #[inline(always)]
105 pub fn one_system_clock_flash_access(self) -> &'a mut W {
106 self.variant(FLASHTIM_A::ONE_SYSTEM_CLOCK_FLASH_ACCESS)
107 }
108 #[doc = "2 system clock flash access time."]
109 #[inline(always)]
110 pub fn two_system_clock_flash_access(self) -> &'a mut W {
111 self.variant(FLASHTIM_A::TWO_SYSTEM_CLOCK_FLASH_ACCESS)
112 }
113 #[doc = "3 system clock flash access time."]
114 #[inline(always)]
115 pub fn three_system_clock_flash_access(self) -> &'a mut W {
116 self.variant(FLASHTIM_A::THREE_SYSTEM_CLOCK_FLASH_ACCESS)
117 }
118 #[doc = r"Writes raw bits to the field"]
119 #[inline(always)]
120 pub unsafe fn bits(self, value: u8) -> &'a mut W {
121 self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
122 self.w
123 }
124}
125impl R {
126 #[doc = "Bits 0:1 - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
127 #[inline(always)]
128 pub fn flashtim(&self) -> FLASHTIM_R {
129 FLASHTIM_R::new((self.bits & 0x03) as u8)
130 }
131}
132impl W {
133 #[doc = "Bits 0:1 - Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access."]
134 #[inline(always)]
135 pub fn flashtim(&mut self) -> FLASHTIM_W {
136 FLASHTIM_W { w: self }
137 }
138 #[doc = "Writes raw bits to the register."]
139 #[inline(always)]
140 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
141 self.0.bits(bits);
142 self
143 }
144}
145#[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"]
146pub struct FLASHCFG_SPEC;
147impl crate::RegisterSpec for FLASHCFG_SPEC {
148 type Ux = u32;
149}
150#[doc = "`read()` method returns [flashcfg::R](R) reader structure"]
151impl crate::Readable for FLASHCFG_SPEC {
152 type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [flashcfg::W](W) writer structure"]
155impl crate::Writable for FLASHCFG_SPEC {
156 type Writer = W;
157}
158#[doc = "`reset()` method sets FLASHCFG to value 0x02"]
159impl crate::Resettable for FLASHCFG_SPEC {
160 #[inline(always)]
161 fn reset_value() -> Self::Ux {
162 0x02
163 }
164}