efm32pg12_pac/lesense/
ch14_timing.rs

1#[doc = "Reader of register CH14_TIMING"]
2pub type R = crate::R<u32, super::CH14_TIMING>;
3#[doc = "Writer for register CH14_TIMING"]
4pub type W = crate::W<u32, super::CH14_TIMING>;
5#[doc = "Register CH14_TIMING `reset()`'s with value 0"]
6impl crate::ResetValue for super::CH14_TIMING {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `EXTIME`"]
14pub type EXTIME_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `EXTIME`"]
16pub struct EXTIME_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> EXTIME_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x3f) | ((value as u32) & 0x3f);
24        self.w
25    }
26}
27#[doc = "Reader of field `SAMPLEDLY`"]
28pub type SAMPLEDLY_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `SAMPLEDLY`"]
30pub struct SAMPLEDLY_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> SAMPLEDLY_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0xff << 6)) | (((value as u32) & 0xff) << 6);
38        self.w
39    }
40}
41#[doc = "Reader of field `MEASUREDLY`"]
42pub type MEASUREDLY_R = crate::R<u16, u16>;
43#[doc = "Write proxy for field `MEASUREDLY`"]
44pub struct MEASUREDLY_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> MEASUREDLY_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u16) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x03ff << 14)) | (((value as u32) & 0x03ff) << 14);
52        self.w
53    }
54}
55impl R {
56    #[doc = "Bits 0:5 - Set Excitation Time"]
57    #[inline(always)]
58    pub fn extime(&self) -> EXTIME_R {
59        EXTIME_R::new((self.bits & 0x3f) as u8)
60    }
61    #[doc = "Bits 6:13 - Set Sample Delay"]
62    #[inline(always)]
63    pub fn sampledly(&self) -> SAMPLEDLY_R {
64        SAMPLEDLY_R::new(((self.bits >> 6) & 0xff) as u8)
65    }
66    #[doc = "Bits 14:23 - Set Measure Delay"]
67    #[inline(always)]
68    pub fn measuredly(&self) -> MEASUREDLY_R {
69        MEASUREDLY_R::new(((self.bits >> 14) & 0x03ff) as u16)
70    }
71}
72impl W {
73    #[doc = "Bits 0:5 - Set Excitation Time"]
74    #[inline(always)]
75    pub fn extime(&mut self) -> EXTIME_W {
76        EXTIME_W { w: self }
77    }
78    #[doc = "Bits 6:13 - Set Sample Delay"]
79    #[inline(always)]
80    pub fn sampledly(&mut self) -> SAMPLEDLY_W {
81        SAMPLEDLY_W { w: self }
82    }
83    #[doc = "Bits 14:23 - Set Measure Delay"]
84    #[inline(always)]
85    pub fn measuredly(&mut self) -> MEASUREDLY_W {
86        MEASUREDLY_W { w: self }
87    }
88}