lpc55_pac/powerquad/
outformat.rs

1#[doc = "Register `OUTFORMAT` reader"]
2pub struct R(crate::R<OUTFORMAT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OUTFORMAT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OUTFORMAT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OUTFORMAT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OUTFORMAT` writer"]
17pub struct W(crate::W<OUTFORMAT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OUTFORMAT_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<OUTFORMAT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OUTFORMAT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `out_formatint` reader - Output Internal format (00: q15; 01:q31; 10:float)"]
38pub struct OUT_FORMATINT_R(crate::FieldReader<u8, u8>);
39impl OUT_FORMATINT_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        OUT_FORMATINT_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for OUT_FORMATINT_R {
46    type Target = crate::FieldReader<u8, u8>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `out_formatint` writer - Output Internal format (00: q15; 01:q31; 10:float)"]
53pub struct OUT_FORMATINT_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> OUT_FORMATINT_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u8) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
61        self.w
62    }
63}
64#[doc = "Field `out_formatext` reader - Output External format (00: q15; 01:q31; 10:float)"]
65pub struct OUT_FORMATEXT_R(crate::FieldReader<u8, u8>);
66impl OUT_FORMATEXT_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u8) -> Self {
69        OUT_FORMATEXT_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for OUT_FORMATEXT_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 `out_formatext` writer - Output External format (00: q15; 01:q31; 10:float)"]
80pub struct OUT_FORMATEXT_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> OUT_FORMATEXT_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 = (self.w.bits & !(0x03 << 4)) | ((value as u32 & 0x03) << 4);
88        self.w
89    }
90}
91#[doc = "Field `out_scaler` reader - Output Scaler value (for scaled 'q31' formats)"]
92pub struct OUT_SCALER_R(crate::FieldReader<u8, u8>);
93impl OUT_SCALER_R {
94    #[inline(always)]
95    pub(crate) fn new(bits: u8) -> Self {
96        OUT_SCALER_R(crate::FieldReader::new(bits))
97    }
98}
99impl core::ops::Deref for OUT_SCALER_R {
100    type Target = crate::FieldReader<u8, u8>;
101    #[inline(always)]
102    fn deref(&self) -> &Self::Target {
103        &self.0
104    }
105}
106#[doc = "Field `out_scaler` writer - Output Scaler value (for scaled 'q31' formats)"]
107pub struct OUT_SCALER_W<'a> {
108    w: &'a mut W,
109}
110impl<'a> OUT_SCALER_W<'a> {
111    #[doc = r"Writes raw bits to the field"]
112    #[inline(always)]
113    pub unsafe fn bits(self, value: u8) -> &'a mut W {
114        self.w.bits = (self.w.bits & !(0xff << 8)) | ((value as u32 & 0xff) << 8);
115        self.w
116    }
117}
118impl R {
119    #[doc = "Bits 0:1 - Output Internal format (00: q15; 01:q31; 10:float)"]
120    #[inline(always)]
121    pub fn out_formatint(&self) -> OUT_FORMATINT_R {
122        OUT_FORMATINT_R::new((self.bits & 0x03) as u8)
123    }
124    #[doc = "Bits 4:5 - Output External format (00: q15; 01:q31; 10:float)"]
125    #[inline(always)]
126    pub fn out_formatext(&self) -> OUT_FORMATEXT_R {
127        OUT_FORMATEXT_R::new(((self.bits >> 4) & 0x03) as u8)
128    }
129    #[doc = "Bits 8:15 - Output Scaler value (for scaled 'q31' formats)"]
130    #[inline(always)]
131    pub fn out_scaler(&self) -> OUT_SCALER_R {
132        OUT_SCALER_R::new(((self.bits >> 8) & 0xff) as u8)
133    }
134}
135impl W {
136    #[doc = "Bits 0:1 - Output Internal format (00: q15; 01:q31; 10:float)"]
137    #[inline(always)]
138    pub fn out_formatint(&mut self) -> OUT_FORMATINT_W {
139        OUT_FORMATINT_W { w: self }
140    }
141    #[doc = "Bits 4:5 - Output External format (00: q15; 01:q31; 10:float)"]
142    #[inline(always)]
143    pub fn out_formatext(&mut self) -> OUT_FORMATEXT_W {
144        OUT_FORMATEXT_W { w: self }
145    }
146    #[doc = "Bits 8:15 - Output Scaler value (for scaled 'q31' formats)"]
147    #[inline(always)]
148    pub fn out_scaler(&mut self) -> OUT_SCALER_W {
149        OUT_SCALER_W { w: self }
150    }
151    #[doc = "Writes raw bits to the register."]
152    #[inline(always)]
153    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
154        self.0.bits(bits);
155        self
156    }
157}
158#[doc = "Output format\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 [outformat](index.html) module"]
159pub struct OUTFORMAT_SPEC;
160impl crate::RegisterSpec for OUTFORMAT_SPEC {
161    type Ux = u32;
162}
163#[doc = "`read()` method returns [outformat::R](R) reader structure"]
164impl crate::Readable for OUTFORMAT_SPEC {
165    type Reader = R;
166}
167#[doc = "`write(|w| ..)` method takes [outformat::W](W) writer structure"]
168impl crate::Writable for OUTFORMAT_SPEC {
169    type Writer = W;
170}
171#[doc = "`reset()` method sets OUTFORMAT to value 0"]
172impl crate::Resettable for OUTFORMAT_SPEC {
173    #[inline(always)]
174    fn reset_value() -> Self::Ux {
175        0
176    }
177}