stm32wb_pac/stk/
calib.rs

1#[doc = "Reader of register CALIB"]
2pub type R = crate::R<u32, super::CALIB>;
3#[doc = "Writer for register CALIB"]
4pub type W = crate::W<u32, super::CALIB>;
5#[doc = "Register CALIB `reset()`'s with value 0"]
6impl crate::ResetValue for super::CALIB {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `TENMS`"]
14pub type TENMS_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `TENMS`"]
16pub struct TENMS_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> TENMS_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x00ff_ffff) | ((value as u32) & 0x00ff_ffff);
24        self.w
25    }
26}
27#[doc = "Reader of field `SKEW`"]
28pub type SKEW_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `SKEW`"]
30pub struct SKEW_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> SKEW_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
48        self.w
49    }
50}
51#[doc = "Reader of field `NOREF`"]
52pub type NOREF_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `NOREF`"]
54pub struct NOREF_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> NOREF_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
72        self.w
73    }
74}
75impl R {
76    #[doc = "Bits 0:23 - Calibration value"]
77    #[inline(always)]
78    pub fn tenms(&self) -> TENMS_R {
79        TENMS_R::new((self.bits & 0x00ff_ffff) as u32)
80    }
81    #[doc = "Bit 30 - SKEW flag: Indicates whether the TENMS value is exact"]
82    #[inline(always)]
83    pub fn skew(&self) -> SKEW_R {
84        SKEW_R::new(((self.bits >> 30) & 0x01) != 0)
85    }
86    #[doc = "Bit 31 - NOREF flag. Reads as zero"]
87    #[inline(always)]
88    pub fn noref(&self) -> NOREF_R {
89        NOREF_R::new(((self.bits >> 31) & 0x01) != 0)
90    }
91}
92impl W {
93    #[doc = "Bits 0:23 - Calibration value"]
94    #[inline(always)]
95    pub fn tenms(&mut self) -> TENMS_W {
96        TENMS_W { w: self }
97    }
98    #[doc = "Bit 30 - SKEW flag: Indicates whether the TENMS value is exact"]
99    #[inline(always)]
100    pub fn skew(&mut self) -> SKEW_W {
101        SKEW_W { w: self }
102    }
103    #[doc = "Bit 31 - NOREF flag. Reads as zero"]
104    #[inline(always)]
105    pub fn noref(&mut self) -> NOREF_W {
106        NOREF_W { w: self }
107    }
108}