efm32gg11b/usb/
ifs.rs

1#[doc = "Writer for register IFS"]
2pub type W = crate::W<u32, super::IFS>;
3#[doc = "Register IFS `reset()`'s with value 0"]
4impl crate::ResetValue for super::IFS {
5    type Type = u32;
6    #[inline(always)]
7    fn reset_value() -> Self::Type { 0 }
8}
9#[doc = "Write proxy for field `VBUSDETH`"]
10pub struct VBUSDETH_W<'a> {
11    w: &'a mut W,
12}
13impl<'a> VBUSDETH_W<'a> {
14    #[doc = r"Sets the field bit"]
15    #[inline(always)]
16    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
17    #[doc = r"Clears the field bit"]
18    #[inline(always)]
19    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub fn bit(self, value: bool) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
24        self.w
25    }
26}
27#[doc = "Write proxy for field `VBUSDETL`"]
28pub struct VBUSDETL_W<'a> {
29    w: &'a mut W,
30}
31impl<'a> VBUSDETL_W<'a> {
32    #[doc = r"Sets the field bit"]
33    #[inline(always)]
34    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
35    #[doc = r"Clears the field bit"]
36    #[inline(always)]
37    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
38    #[doc = r"Writes raw bits to the field"]
39    #[inline(always)]
40    pub fn bit(self, value: bool) -> &'a mut W {
41        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
42        self.w
43    }
44}
45#[doc = "Write proxy for field `ERR`"]
46pub struct ERR_W<'a> {
47    w: &'a mut W,
48}
49impl<'a> ERR_W<'a> {
50    #[doc = r"Sets the field bit"]
51    #[inline(always)]
52    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
53    #[doc = r"Clears the field bit"]
54    #[inline(always)]
55    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
56    #[doc = r"Writes raw bits to the field"]
57    #[inline(always)]
58    pub fn bit(self, value: bool) -> &'a mut W {
59        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
60        self.w
61    }
62}
63#[doc = "Write proxy for field `DCD`"]
64pub struct DCD_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> DCD_W<'a> {
68    #[doc = r"Sets the field bit"]
69    #[inline(always)]
70    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
71    #[doc = r"Clears the field bit"]
72    #[inline(always)]
73    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
74    #[doc = r"Writes raw bits to the field"]
75    #[inline(always)]
76    pub fn bit(self, value: bool) -> &'a mut W {
77        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
78        self.w
79    }
80}
81#[doc = "Write proxy for field `PD`"]
82pub struct PD_W<'a> {
83    w: &'a mut W,
84}
85impl<'a> PD_W<'a> {
86    #[doc = r"Sets the field bit"]
87    #[inline(always)]
88    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
89    #[doc = r"Clears the field bit"]
90    #[inline(always)]
91    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
96        self.w
97    }
98}
99#[doc = "Write proxy for field `SD`"]
100pub struct SD_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> SD_W<'a> {
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
107    #[doc = r"Clears the field bit"]
108    #[inline(always)]
109    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
110    #[doc = r"Writes raw bits to the field"]
111    #[inline(always)]
112    pub fn bit(self, value: bool) -> &'a mut W {
113        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
114        self.w
115    }
116}
117impl W {
118    #[doc = "Bit 0 - Set VBUSDETH Interrupt Flag"]
119    #[inline(always)]
120    pub fn vbusdeth(&mut self) -> VBUSDETH_W { VBUSDETH_W { w: self } }
121    #[doc = "Bit 1 - Set VBUSDETL Interrupt Flag"]
122    #[inline(always)]
123    pub fn vbusdetl(&mut self) -> VBUSDETL_W { VBUSDETL_W { w: self } }
124    #[doc = "Bit 8 - Set ERR Interrupt Flag"]
125    #[inline(always)]
126    pub fn err(&mut self) -> ERR_W { ERR_W { w: self } }
127    #[doc = "Bit 9 - Set DCD Interrupt Flag"]
128    #[inline(always)]
129    pub fn dcd(&mut self) -> DCD_W { DCD_W { w: self } }
130    #[doc = "Bit 10 - Set PD Interrupt Flag"]
131    #[inline(always)]
132    pub fn pd(&mut self) -> PD_W { PD_W { w: self } }
133    #[doc = "Bit 11 - Set SD Interrupt Flag"]
134    #[inline(always)]
135    pub fn sd(&mut self) -> SD_W { SD_W { w: self } }
136}