atsams70n21/sys_tick/
calib.rs1#[doc = "Register `CALIB` reader"]
2pub struct R(crate::R<CALIB_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CALIB_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CALIB_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CALIB_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `TENMS` reader - Reload value to use for 10ms timing"]
17pub struct TENMS_R(crate::FieldReader<u32, u32>);
18impl TENMS_R {
19 #[inline(always)]
20 pub(crate) fn new(bits: u32) -> Self {
21 TENMS_R(crate::FieldReader::new(bits))
22 }
23}
24impl core::ops::Deref for TENMS_R {
25 type Target = crate::FieldReader<u32, u32>;
26 #[inline(always)]
27 fn deref(&self) -> &Self::Target {
28 &self.0
29 }
30}
31#[doc = "Indicates whether the TENMS value is exact\n\nValue on reset: 0"]
32#[derive(Clone, Copy, Debug, PartialEq)]
33pub enum SKEW_A {
34 #[doc = "0: 10ms calibration value is exact"]
35 VALUE_0 = 0,
36 #[doc = "1: 10ms calibration value is inexact, because of the clock frequency"]
37 VALUE_1 = 1,
38}
39impl From<SKEW_A> for bool {
40 #[inline(always)]
41 fn from(variant: SKEW_A) -> Self {
42 variant as u8 != 0
43 }
44}
45#[doc = "Field `SKEW` reader - Indicates whether the TENMS value is exact"]
46pub struct SKEW_R(crate::FieldReader<bool, SKEW_A>);
47impl SKEW_R {
48 #[inline(always)]
49 pub(crate) fn new(bits: bool) -> Self {
50 SKEW_R(crate::FieldReader::new(bits))
51 }
52 #[doc = r"Get enumerated values variant"]
53 #[inline(always)]
54 pub fn variant(&self) -> SKEW_A {
55 match self.bits {
56 false => SKEW_A::VALUE_0,
57 true => SKEW_A::VALUE_1,
58 }
59 }
60 #[doc = "Checks if the value of the field is `VALUE_0`"]
61 #[inline(always)]
62 pub fn is_value_0(&self) -> bool {
63 **self == SKEW_A::VALUE_0
64 }
65 #[doc = "Checks if the value of the field is `VALUE_1`"]
66 #[inline(always)]
67 pub fn is_value_1(&self) -> bool {
68 **self == SKEW_A::VALUE_1
69 }
70}
71impl core::ops::Deref for SKEW_R {
72 type Target = crate::FieldReader<bool, SKEW_A>;
73 #[inline(always)]
74 fn deref(&self) -> &Self::Target {
75 &self.0
76 }
77}
78#[doc = "Indicates whether the device provides a reference clock to the processor\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq)]
80pub enum NOREF_A {
81 #[doc = "0: The reference clock is provided"]
82 VALUE_0 = 0,
83 #[doc = "1: The reference clock is not provided"]
84 VALUE_1 = 1,
85}
86impl From<NOREF_A> for bool {
87 #[inline(always)]
88 fn from(variant: NOREF_A) -> Self {
89 variant as u8 != 0
90 }
91}
92#[doc = "Field `NOREF` reader - Indicates whether the device provides a reference clock to the processor"]
93pub struct NOREF_R(crate::FieldReader<bool, NOREF_A>);
94impl NOREF_R {
95 #[inline(always)]
96 pub(crate) fn new(bits: bool) -> Self {
97 NOREF_R(crate::FieldReader::new(bits))
98 }
99 #[doc = r"Get enumerated values variant"]
100 #[inline(always)]
101 pub fn variant(&self) -> NOREF_A {
102 match self.bits {
103 false => NOREF_A::VALUE_0,
104 true => NOREF_A::VALUE_1,
105 }
106 }
107 #[doc = "Checks if the value of the field is `VALUE_0`"]
108 #[inline(always)]
109 pub fn is_value_0(&self) -> bool {
110 **self == NOREF_A::VALUE_0
111 }
112 #[doc = "Checks if the value of the field is `VALUE_1`"]
113 #[inline(always)]
114 pub fn is_value_1(&self) -> bool {
115 **self == NOREF_A::VALUE_1
116 }
117}
118impl core::ops::Deref for NOREF_R {
119 type Target = crate::FieldReader<bool, NOREF_A>;
120 #[inline(always)]
121 fn deref(&self) -> &Self::Target {
122 &self.0
123 }
124}
125impl R {
126 #[doc = "Bits 0:23 - Reload value to use for 10ms timing"]
127 #[inline(always)]
128 pub fn tenms(&self) -> TENMS_R {
129 TENMS_R::new((self.bits & 0x00ff_ffff) as u32)
130 }
131 #[doc = "Bit 30 - Indicates whether the TENMS value is exact"]
132 #[inline(always)]
133 pub fn skew(&self) -> SKEW_R {
134 SKEW_R::new(((self.bits >> 30) & 0x01) != 0)
135 }
136 #[doc = "Bit 31 - Indicates whether the device provides a reference clock to the processor"]
137 #[inline(always)]
138 pub fn noref(&self) -> NOREF_R {
139 NOREF_R::new(((self.bits >> 31) & 0x01) != 0)
140 }
141}
142#[doc = "Calibration Value Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [calib](index.html) module"]
143pub struct CALIB_SPEC;
144impl crate::RegisterSpec for CALIB_SPEC {
145 type Ux = u32;
146}
147#[doc = "`read()` method returns [calib::R](R) reader structure"]
148impl crate::Readable for CALIB_SPEC {
149 type Reader = R;
150}
151#[doc = "`reset()` method sets CALIB to value 0"]
152impl crate::Resettable for CALIB_SPEC {
153 #[inline(always)]
154 fn reset_value() -> Self::Ux {
155 0
156 }
157}