xmc4800/ecat0/
dc_sys_time_diff.rs1#[doc = "Register `DC_SYS_TIME_DIFF` reader"]
2pub type R = crate::R<DC_SYS_TIME_DIFF_SPEC>;
3#[doc = "Field `TIME_DIF` reader - Mean difference between local copy of System Time and received System Time values"]
4pub type TIME_DIF_R = crate::FieldReader<u32>;
5#[doc = "Local copy of System Time\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum CPY_A {
8 #[doc = "0: Greater than or equal received System Time"]
9 VALUE1 = 0,
10 #[doc = "1: Smaller than received System Time"]
11 VALUE2 = 1,
12}
13impl From<CPY_A> for bool {
14 #[inline(always)]
15 fn from(variant: CPY_A) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `CPY` reader - Local copy of System Time"]
20pub type CPY_R = crate::BitReader<CPY_A>;
21impl CPY_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> CPY_A {
25 match self.bits {
26 false => CPY_A::VALUE1,
27 true => CPY_A::VALUE2,
28 }
29 }
30 #[doc = "Greater than or equal received System Time"]
31 #[inline(always)]
32 pub fn is_value1(&self) -> bool {
33 *self == CPY_A::VALUE1
34 }
35 #[doc = "Smaller than received System Time"]
36 #[inline(always)]
37 pub fn is_value2(&self) -> bool {
38 *self == CPY_A::VALUE2
39 }
40}
41impl R {
42 #[doc = "Bits 0:30 - Mean difference between local copy of System Time and received System Time values"]
43 #[inline(always)]
44 pub fn time_dif(&self) -> TIME_DIF_R {
45 TIME_DIF_R::new(self.bits & 0x7fff_ffff)
46 }
47 #[doc = "Bit 31 - Local copy of System Time"]
48 #[inline(always)]
49 pub fn cpy(&self) -> CPY_R {
50 CPY_R::new(((self.bits >> 31) & 1) != 0)
51 }
52}
53#[doc = "System Time Difference\n\nYou can [`read`](crate::Reg::read) this register and get [`dc_sys_time_diff::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
54pub struct DC_SYS_TIME_DIFF_SPEC;
55impl crate::RegisterSpec for DC_SYS_TIME_DIFF_SPEC {
56 type Ux = u32;
57}
58#[doc = "`read()` method returns [`dc_sys_time_diff::R`](R) reader structure"]
59impl crate::Readable for DC_SYS_TIME_DIFF_SPEC {}
60#[doc = "`reset()` method sets DC_SYS_TIME_DIFF to value 0"]
61impl crate::Resettable for DC_SYS_TIME_DIFF_SPEC {
62 const RESET_VALUE: u32 = 0;
63}