eos_s3/aip/
osc_ctrl_1.rs

1#[doc = "Register `OSC_CTRL_1` reader"]
2pub struct R(crate::R<OSC_CTRL_1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OSC_CTRL_1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OSC_CTRL_1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OSC_CTRL_1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OSC_CTRL_1` writer"]
17pub struct W(crate::W<OSC_CTRL_1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OSC_CTRL_1_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<OSC_CTRL_1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OSC_CTRL_1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `prog` reader - Please refer to the Technical Reference Manual for others (No SYNC Needed). Power On Default Value is 76.97 MHz. No Support on 'Delta Mode'."]
38pub struct PROG_R(crate::FieldReader<u16, u16>);
39impl PROG_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u16) -> Self {
42        PROG_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for PROG_R {
46    type Target = crate::FieldReader<u16, u16>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `prog` writer - Please refer to the Technical Reference Manual for others (No SYNC Needed). Power On Default Value is 76.97 MHz. No Support on 'Delta Mode'."]
53pub struct PROG_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> PROG_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u16) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x1fff) | (value as u32 & 0x1fff);
61        self.w
62    }
63}
64#[doc = "Field `General_Purpos_SFR` reader - No description given"]
65pub struct GENERAL_PURPOS_SFR_R(crate::FieldReader<u8, u8>);
66impl GENERAL_PURPOS_SFR_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u8) -> Self {
69        GENERAL_PURPOS_SFR_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for GENERAL_PURPOS_SFR_R {
73    type Target = crate::FieldReader<u8, u8>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `General_Purpos_SFR` writer - No description given"]
80pub struct GENERAL_PURPOS_SFR_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> GENERAL_PURPOS_SFR_W<'a> {
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub unsafe fn bits(self, value: u8) -> &'a mut W {
87        self.w.bits =
88            (self.w.bits & !(0x07 << 13)) | ((value as u32 & 0x07) << 13);
89        self.w
90    }
91}
92impl R {
93    #[doc = "Bits 0:12 - Please refer to the Technical Reference Manual for others (No SYNC Needed). Power On Default Value is 76.97 MHz. No Support on 'Delta Mode'."]
94    #[inline(always)]
95    pub fn prog(&self) -> PROG_R {
96        PROG_R::new((self.bits & 0x1fff) as u16)
97    }
98    #[doc = "Bits 13:15 - No description given"]
99    #[inline(always)]
100    pub fn general_purpos_sfr(&self) -> GENERAL_PURPOS_SFR_R {
101        GENERAL_PURPOS_SFR_R::new(((self.bits >> 13) & 0x07) as u8)
102    }
103}
104impl W {
105    #[doc = "Bits 0:12 - Please refer to the Technical Reference Manual for others (No SYNC Needed). Power On Default Value is 76.97 MHz. No Support on 'Delta Mode'."]
106    #[inline(always)]
107    pub fn prog(&mut self) -> PROG_W {
108        PROG_W { w: self }
109    }
110    #[doc = "Bits 13:15 - No description given"]
111    #[inline(always)]
112    pub fn general_purpos_sfr(&mut self) -> GENERAL_PURPOS_SFR_W {
113        GENERAL_PURPOS_SFR_W { w: self }
114    }
115    #[doc = "Writes raw bits to the register."]
116    #[inline(always)]
117    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
118        self.0.bits(bits);
119        self
120    }
121}
122#[doc = "Oscilator control register 1\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 [osc_ctrl_1](index.html) module"]
123pub struct OSC_CTRL_1_SPEC;
124impl crate::RegisterSpec for OSC_CTRL_1_SPEC {
125    type Ux = u32;
126}
127#[doc = "`read()` method returns [osc_ctrl_1::R](R) reader structure"]
128impl crate::Readable for OSC_CTRL_1_SPEC {
129    type Reader = R;
130}
131#[doc = "`write(|w| ..)` method takes [osc_ctrl_1::W](W) writer structure"]
132impl crate::Writable for OSC_CTRL_1_SPEC {
133    type Writer = W;
134}
135#[doc = "`reset()` method sets OSC_CTRL_1 to value 0x092d"]
136impl crate::Resettable for OSC_CTRL_1_SPEC {
137    #[inline(always)]
138    fn reset_value() -> Self::Ux {
139        0x092d
140    }
141}