efm32pg12_pac/lesense/
prsctrl.rs

1#[doc = "Reader of register PRSCTRL"]
2pub type R = crate::R<u32, super::PRSCTRL>;
3#[doc = "Writer for register PRSCTRL"]
4pub type W = crate::W<u32, super::PRSCTRL>;
5#[doc = "Register PRSCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::PRSCTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `DECCMPVAL`"]
14pub type DECCMPVAL_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `DECCMPVAL`"]
16pub struct DECCMPVAL_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> DECCMPVAL_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 & !0x1f) | ((value as u32) & 0x1f);
24        self.w
25    }
26}
27#[doc = "Reader of field `DECCMPMASK`"]
28pub type DECCMPMASK_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `DECCMPMASK`"]
30pub struct DECCMPMASK_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> DECCMPMASK_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 & !(0x1f << 8)) | (((value as u32) & 0x1f) << 8);
38        self.w
39    }
40}
41#[doc = "Reader of field `DECCMPEN`"]
42pub type DECCMPEN_R = crate::R<bool, bool>;
43#[doc = "Write proxy for field `DECCMPEN`"]
44pub struct DECCMPEN_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> DECCMPEN_W<'a> {
48    #[doc = r"Sets the field bit"]
49    #[inline(always)]
50    pub fn set_bit(self) -> &'a mut W {
51        self.bit(true)
52    }
53    #[doc = r"Clears the field bit"]
54    #[inline(always)]
55    pub fn clear_bit(self) -> &'a mut W {
56        self.bit(false)
57    }
58    #[doc = r"Writes raw bits to the field"]
59    #[inline(always)]
60    pub fn bit(self, value: bool) -> &'a mut W {
61        self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
62        self.w
63    }
64}
65impl R {
66    #[doc = "Bits 0:4 - Decoder State Compare Value"]
67    #[inline(always)]
68    pub fn deccmpval(&self) -> DECCMPVAL_R {
69        DECCMPVAL_R::new((self.bits & 0x1f) as u8)
70    }
71    #[doc = "Bits 8:12 - Decoder State Compare Value Mask"]
72    #[inline(always)]
73    pub fn deccmpmask(&self) -> DECCMPMASK_R {
74        DECCMPMASK_R::new(((self.bits >> 8) & 0x1f) as u8)
75    }
76    #[doc = "Bit 16 - Enable PRS Output DECCMP"]
77    #[inline(always)]
78    pub fn deccmpen(&self) -> DECCMPEN_R {
79        DECCMPEN_R::new(((self.bits >> 16) & 0x01) != 0)
80    }
81}
82impl W {
83    #[doc = "Bits 0:4 - Decoder State Compare Value"]
84    #[inline(always)]
85    pub fn deccmpval(&mut self) -> DECCMPVAL_W {
86        DECCMPVAL_W { w: self }
87    }
88    #[doc = "Bits 8:12 - Decoder State Compare Value Mask"]
89    #[inline(always)]
90    pub fn deccmpmask(&mut self) -> DECCMPMASK_W {
91        DECCMPMASK_W { w: self }
92    }
93    #[doc = "Bit 16 - Enable PRS Output DECCMP"]
94    #[inline(always)]
95    pub fn deccmpen(&mut self) -> DECCMPEN_W {
96        DECCMPEN_W { w: self }
97    }
98}