atsamd51g/sys_tick/
calib.rs
1#[doc = "Register `CALIB` reader"]
2pub type R = crate::R<CalibSpec>;
3#[doc = "Field `TENMS` reader - Reload value to use for 10ms timing"]
4pub type TenmsR = crate::FieldReader<u32>;
5#[doc = "TENMS is rounded from non-integer ratio\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Skewselect {
8 #[doc = "0: 10ms calibration value is exact"]
9 Value0 = 0,
10 #[doc = "1: 10ms calibration value is inexact, because of the clock frequency"]
11 Value1 = 1,
12}
13impl From<Skewselect> for bool {
14 #[inline(always)]
15 fn from(variant: Skewselect) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `SKEW` reader - TENMS is rounded from non-integer ratio"]
20pub type SkewR = crate::BitReader<Skewselect>;
21impl SkewR {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> Skewselect {
25 match self.bits {
26 false => Skewselect::Value0,
27 true => Skewselect::Value1,
28 }
29 }
30 #[doc = "10ms calibration value is exact"]
31 #[inline(always)]
32 pub fn is_value_0(&self) -> bool {
33 *self == Skewselect::Value0
34 }
35 #[doc = "10ms calibration value is inexact, because of the clock frequency"]
36 #[inline(always)]
37 pub fn is_value_1(&self) -> bool {
38 *self == Skewselect::Value1
39 }
40}
41#[doc = "No Separate Reference Clock\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum Norefselect {
44 #[doc = "0: The reference clock is provided"]
45 Value0 = 0,
46 #[doc = "1: The reference clock is not provided"]
47 Value1 = 1,
48}
49impl From<Norefselect> for bool {
50 #[inline(always)]
51 fn from(variant: Norefselect) -> Self {
52 variant as u8 != 0
53 }
54}
55#[doc = "Field `NOREF` reader - No Separate Reference Clock"]
56pub type NorefR = crate::BitReader<Norefselect>;
57impl NorefR {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub const fn variant(&self) -> Norefselect {
61 match self.bits {
62 false => Norefselect::Value0,
63 true => Norefselect::Value1,
64 }
65 }
66 #[doc = "The reference clock is provided"]
67 #[inline(always)]
68 pub fn is_value_0(&self) -> bool {
69 *self == Norefselect::Value0
70 }
71 #[doc = "The reference clock is not provided"]
72 #[inline(always)]
73 pub fn is_value_1(&self) -> bool {
74 *self == Norefselect::Value1
75 }
76}
77impl R {
78 #[doc = "Bits 0:23 - Reload value to use for 10ms timing"]
79 #[inline(always)]
80 pub fn tenms(&self) -> TenmsR {
81 TenmsR::new(self.bits & 0x00ff_ffff)
82 }
83 #[doc = "Bit 30 - TENMS is rounded from non-integer ratio"]
84 #[inline(always)]
85 pub fn skew(&self) -> SkewR {
86 SkewR::new(((self.bits >> 30) & 1) != 0)
87 }
88 #[doc = "Bit 31 - No Separate Reference Clock"]
89 #[inline(always)]
90 pub fn noref(&self) -> NorefR {
91 NorefR::new(((self.bits >> 31) & 1) != 0)
92 }
93}
94#[doc = "SysTick Calibration Value Register\n\nYou can [`read`](crate::Reg::read) this register and get [`calib::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
95pub struct CalibSpec;
96impl crate::RegisterSpec for CalibSpec {
97 type Ux = u32;
98}
99#[doc = "`read()` method returns [`calib::R`](R) reader structure"]
100impl crate::Readable for CalibSpec {}
101#[doc = "`reset()` method sets CALIB to value 0"]
102impl crate::Resettable for CalibSpec {
103 const RESET_VALUE: u32 = 0;
104}