efm32pg12_pac/etm/
etmsr.rs

1#[doc = "Reader of register ETMSR"]
2pub type R = crate::R<u32, super::ETMSR>;
3#[doc = "Writer for register ETMSR"]
4pub type W = crate::W<u32, super::ETMSR>;
5#[doc = "Register ETMSR `reset()`'s with value 0x02"]
6impl crate::ResetValue for super::ETMSR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x02
11    }
12}
13#[doc = "Reader of field `ETHOF`"]
14pub type ETHOF_R = crate::R<bool, bool>;
15#[doc = "Reader of field `ETMPROGBIT`"]
16pub type ETMPROGBIT_R = crate::R<bool, bool>;
17#[doc = "Reader of field `TRACESTAT`"]
18pub type TRACESTAT_R = crate::R<bool, bool>;
19#[doc = "Write proxy for field `TRACESTAT`"]
20pub struct TRACESTAT_W<'a> {
21    w: &'a mut W,
22}
23impl<'a> TRACESTAT_W<'a> {
24    #[doc = r"Sets the field bit"]
25    #[inline(always)]
26    pub fn set_bit(self) -> &'a mut W {
27        self.bit(true)
28    }
29    #[doc = r"Clears the field bit"]
30    #[inline(always)]
31    pub fn clear_bit(self) -> &'a mut W {
32        self.bit(false)
33    }
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub fn bit(self, value: bool) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
38        self.w
39    }
40}
41#[doc = "Reader of field `TRIGBIT`"]
42pub type TRIGBIT_R = crate::R<bool, bool>;
43#[doc = "Write proxy for field `TRIGBIT`"]
44pub struct TRIGBIT_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> TRIGBIT_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 << 3)) | (((value as u32) & 0x01) << 3);
62        self.w
63    }
64}
65impl R {
66    #[doc = "Bit 0 - ETM Overflow"]
67    #[inline(always)]
68    pub fn ethof(&self) -> ETHOF_R {
69        ETHOF_R::new((self.bits & 0x01) != 0)
70    }
71    #[doc = "Bit 1 - ETM Programming Bit Status"]
72    #[inline(always)]
73    pub fn etmprogbit(&self) -> ETMPROGBIT_R {
74        ETMPROGBIT_R::new(((self.bits >> 1) & 0x01) != 0)
75    }
76    #[doc = "Bit 2 - Trace Start/Stop Status"]
77    #[inline(always)]
78    pub fn tracestat(&self) -> TRACESTAT_R {
79        TRACESTAT_R::new(((self.bits >> 2) & 0x01) != 0)
80    }
81    #[doc = "Bit 3 - Trigger Bit"]
82    #[inline(always)]
83    pub fn trigbit(&self) -> TRIGBIT_R {
84        TRIGBIT_R::new(((self.bits >> 3) & 0x01) != 0)
85    }
86}
87impl W {
88    #[doc = "Bit 2 - Trace Start/Stop Status"]
89    #[inline(always)]
90    pub fn tracestat(&mut self) -> TRACESTAT_W {
91        TRACESTAT_W { w: self }
92    }
93    #[doc = "Bit 3 - Trigger Bit"]
94    #[inline(always)]
95    pub fn trigbit(&mut self) -> TRIGBIT_W {
96        TRIGBIT_W { w: self }
97    }
98}