rp2040_pac/rosc/
freqa.rs
1#[doc = "Register `FREQA` reader"]
2pub type R = crate::R<FREQA_SPEC>;
3#[doc = "Register `FREQA` writer"]
4pub type W = crate::W<FREQA_SPEC>;
5#[doc = "Field `DS0` reader - Stage 0 drive strength"]
6pub type DS0_R = crate::FieldReader;
7#[doc = "Field `DS0` writer - Stage 0 drive strength"]
8pub type DS0_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
9#[doc = "Field `DS1` reader - Stage 1 drive strength"]
10pub type DS1_R = crate::FieldReader;
11#[doc = "Field `DS1` writer - Stage 1 drive strength"]
12pub type DS1_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13#[doc = "Field `DS2` reader - Stage 2 drive strength"]
14pub type DS2_R = crate::FieldReader;
15#[doc = "Field `DS2` writer - Stage 2 drive strength"]
16pub type DS2_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
17#[doc = "Field `DS3` reader - Stage 3 drive strength"]
18pub type DS3_R = crate::FieldReader;
19#[doc = "Field `DS3` writer - Stage 3 drive strength"]
20pub type DS3_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21#[doc = "Field `PASSWD` reader - Set to 0x9696 to apply the settings
22 Any other value in this field will set all drive strengths to 0"]
23pub type PASSWD_R = crate::FieldReader<PASSWD_A>;
24#[doc = "Set to 0x9696 to apply the settings
25 Any other value in this field will set all drive strengths to 0
26
27Value on reset: 0"]
28#[derive(Clone, Copy, Debug, PartialEq, Eq)]
29#[repr(u16)]
30pub enum PASSWD_A {
31 #[doc = "38550: `1001011010010110`"]
32 PASS = 38550,
33}
34impl From<PASSWD_A> for u16 {
35 #[inline(always)]
36 fn from(variant: PASSWD_A) -> Self {
37 variant as _
38 }
39}
40impl crate::FieldSpec for PASSWD_A {
41 type Ux = u16;
42}
43impl PASSWD_R {
44 #[doc = "Get enumerated values variant"]
45 #[inline(always)]
46 pub const fn variant(&self) -> Option<PASSWD_A> {
47 match self.bits {
48 38550 => Some(PASSWD_A::PASS),
49 _ => None,
50 }
51 }
52 #[doc = "`1001011010010110`"]
53 #[inline(always)]
54 pub fn is_pass(&self) -> bool {
55 *self == PASSWD_A::PASS
56 }
57}
58#[doc = "Field `PASSWD` writer - Set to 0x9696 to apply the settings
59 Any other value in this field will set all drive strengths to 0"]
60pub type PASSWD_W<'a, REG> = crate::FieldWriter<'a, REG, 16, PASSWD_A>;
61impl<'a, REG> PASSWD_W<'a, REG>
62where
63 REG: crate::Writable + crate::RegisterSpec,
64 REG::Ux: From<u16>,
65{
66 #[doc = "`1001011010010110`"]
67 #[inline(always)]
68 pub fn pass(self) -> &'a mut crate::W<REG> {
69 self.variant(PASSWD_A::PASS)
70 }
71}
72impl R {
73 #[doc = "Bits 0:2 - Stage 0 drive strength"]
74 #[inline(always)]
75 pub fn ds0(&self) -> DS0_R {
76 DS0_R::new((self.bits & 7) as u8)
77 }
78 #[doc = "Bits 4:6 - Stage 1 drive strength"]
79 #[inline(always)]
80 pub fn ds1(&self) -> DS1_R {
81 DS1_R::new(((self.bits >> 4) & 7) as u8)
82 }
83 #[doc = "Bits 8:10 - Stage 2 drive strength"]
84 #[inline(always)]
85 pub fn ds2(&self) -> DS2_R {
86 DS2_R::new(((self.bits >> 8) & 7) as u8)
87 }
88 #[doc = "Bits 12:14 - Stage 3 drive strength"]
89 #[inline(always)]
90 pub fn ds3(&self) -> DS3_R {
91 DS3_R::new(((self.bits >> 12) & 7) as u8)
92 }
93 #[doc = "Bits 16:31 - Set to 0x9696 to apply the settings
94 Any other value in this field will set all drive strengths to 0"]
95 #[inline(always)]
96 pub fn passwd(&self) -> PASSWD_R {
97 PASSWD_R::new(((self.bits >> 16) & 0xffff) as u16)
98 }
99}
100impl W {
101 #[doc = "Bits 0:2 - Stage 0 drive strength"]
102 #[inline(always)]
103 #[must_use]
104 pub fn ds0(&mut self) -> DS0_W<FREQA_SPEC> {
105 DS0_W::new(self, 0)
106 }
107 #[doc = "Bits 4:6 - Stage 1 drive strength"]
108 #[inline(always)]
109 #[must_use]
110 pub fn ds1(&mut self) -> DS1_W<FREQA_SPEC> {
111 DS1_W::new(self, 4)
112 }
113 #[doc = "Bits 8:10 - Stage 2 drive strength"]
114 #[inline(always)]
115 #[must_use]
116 pub fn ds2(&mut self) -> DS2_W<FREQA_SPEC> {
117 DS2_W::new(self, 8)
118 }
119 #[doc = "Bits 12:14 - Stage 3 drive strength"]
120 #[inline(always)]
121 #[must_use]
122 pub fn ds3(&mut self) -> DS3_W<FREQA_SPEC> {
123 DS3_W::new(self, 12)
124 }
125 #[doc = "Bits 16:31 - Set to 0x9696 to apply the settings
126 Any other value in this field will set all drive strengths to 0"]
127 #[inline(always)]
128 #[must_use]
129 pub fn passwd(&mut self) -> PASSWD_W<FREQA_SPEC> {
130 PASSWD_W::new(self, 16)
131 }
132 #[doc = r" Writes raw bits to the register."]
133 #[doc = r""]
134 #[doc = r" # Safety"]
135 #[doc = r""]
136 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
137 #[inline(always)]
138 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
139 self.bits = bits;
140 self
141 }
142}
143#[doc = "The FREQA & FREQB registers control the frequency by controlling the drive strength of each stage
144 The drive strength has 4 levels determined by the number of bits set
145 Increasing the number of bits set increases the drive strength and increases the oscillation frequency
146 0 bits set is the default drive strength
147 1 bit set doubles the drive strength
148 2 bits set triples drive strength
149 3 bits set quadruples drive strength
150
151You can [`read`](crate::generic::Reg::read) this register and get [`freqa::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 [`freqa::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
152pub struct FREQA_SPEC;
153impl crate::RegisterSpec for FREQA_SPEC {
154 type Ux = u32;
155}
156#[doc = "`read()` method returns [`freqa::R`](R) reader structure"]
157impl crate::Readable for FREQA_SPEC {}
158#[doc = "`write(|w| ..)` method takes [`freqa::W`](W) writer structure"]
159impl crate::Writable for FREQA_SPEC {
160 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
161 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
162}
163#[doc = "`reset()` method sets FREQA to value 0"]
164impl crate::Resettable for FREQA_SPEC {
165 const RESET_VALUE: u32 = 0;
166}