py32f0/py32f030/i2c/
sr2.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
///Register `SR2` reader
pub struct R(crate::R<SR2_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<SR2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<SR2_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<SR2_SPEC>) -> Self {
        R(reader)
    }
}
///Field `MSL` reader - Master/slave
pub type MSL_R = crate::BitReader<MSLR_A>;
/**Master/slave

Value on reset: 0*/
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MSLR_A {
    ///0: Slave mode
    Slave = 0,
    ///1: Master mode
    Master = 1,
}
impl From<MSLR_A> for bool {
    #[inline(always)]
    fn from(variant: MSLR_A) -> Self {
        variant as u8 != 0
    }
}
impl MSL_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub fn variant(&self) -> MSLR_A {
        match self.bits {
            false => MSLR_A::Slave,
            true => MSLR_A::Master,
        }
    }
    ///Checks if the value of the field is `Slave`
    #[inline(always)]
    pub fn is_slave(&self) -> bool {
        *self == MSLR_A::Slave
    }
    ///Checks if the value of the field is `Master`
    #[inline(always)]
    pub fn is_master(&self) -> bool {
        *self == MSLR_A::Master
    }
}
///Field `BUSY` reader - Bus busy
pub type BUSY_R = crate::BitReader<BUSYR_A>;
/**Bus busy

Value on reset: 0*/
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BUSYR_A {
    ///0: No communication on bus
    NotBusy = 0,
    ///1: Bus busy
    Busy = 1,
}
impl From<BUSYR_A> for bool {
    #[inline(always)]
    fn from(variant: BUSYR_A) -> Self {
        variant as u8 != 0
    }
}
impl BUSY_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub fn variant(&self) -> BUSYR_A {
        match self.bits {
            false => BUSYR_A::NotBusy,
            true => BUSYR_A::Busy,
        }
    }
    ///Checks if the value of the field is `NotBusy`
    #[inline(always)]
    pub fn is_not_busy(&self) -> bool {
        *self == BUSYR_A::NotBusy
    }
    ///Checks if the value of the field is `Busy`
    #[inline(always)]
    pub fn is_busy(&self) -> bool {
        *self == BUSYR_A::Busy
    }
}
///Field `TRA` reader - Transmitter/receiver
pub type TRA_R = crate::BitReader<TRAR_A>;
/**Transmitter/receiver

Value on reset: 0*/
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TRAR_A {
    ///0: Data received flag
    Received = 0,
    ///1: Data transferred flag
    Transferred = 1,
}
impl From<TRAR_A> for bool {
    #[inline(always)]
    fn from(variant: TRAR_A) -> Self {
        variant as u8 != 0
    }
}
impl TRA_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub fn variant(&self) -> TRAR_A {
        match self.bits {
            false => TRAR_A::Received,
            true => TRAR_A::Transferred,
        }
    }
    ///Checks if the value of the field is `Received`
    #[inline(always)]
    pub fn is_received(&self) -> bool {
        *self == TRAR_A::Received
    }
    ///Checks if the value of the field is `Transferred`
    #[inline(always)]
    pub fn is_transferred(&self) -> bool {
        *self == TRAR_A::Transferred
    }
}
///Field `GENCALL` reader - General call address (Slave mode)
pub type GENCALL_R = crate::BitReader<GENCALLR_A>;
/**General call address (Slave mode)

Value on reset: 0*/
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum GENCALLR_A {
    ///0: Not receive general call address
    NoGeneralCallRecv = 0,
    ///1: When ENGC=1, received a general call address
    GeneralCallRecv = 1,
}
impl From<GENCALLR_A> for bool {
    #[inline(always)]
    fn from(variant: GENCALLR_A) -> Self {
        variant as u8 != 0
    }
}
impl GENCALL_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub fn variant(&self) -> GENCALLR_A {
        match self.bits {
            false => GENCALLR_A::NoGeneralCallRecv,
            true => GENCALLR_A::GeneralCallRecv,
        }
    }
    ///Checks if the value of the field is `NoGeneralCallRecv`
    #[inline(always)]
    pub fn is_no_general_call_recv(&self) -> bool {
        *self == GENCALLR_A::NoGeneralCallRecv
    }
    ///Checks if the value of the field is `GeneralCallRecv`
    #[inline(always)]
    pub fn is_general_call_recv(&self) -> bool {
        *self == GENCALLR_A::GeneralCallRecv
    }
}
///Field `DUALF` reader - Dual flag (Slave mode)
pub type DUALF_R = crate::BitReader<bool>;
///Field `PEC` reader - acket error checking register
pub type PEC_R = crate::FieldReader<u8, u8>;
impl R {
    ///Bit 0 - Master/slave
    #[inline(always)]
    pub fn msl(&self) -> MSL_R {
        MSL_R::new((self.bits & 1) != 0)
    }
    ///Bit 1 - Bus busy
    #[inline(always)]
    pub fn busy(&self) -> BUSY_R {
        BUSY_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 2 - Transmitter/receiver
    #[inline(always)]
    pub fn tra(&self) -> TRA_R {
        TRA_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 4 - General call address (Slave mode)
    #[inline(always)]
    pub fn gencall(&self) -> GENCALL_R {
        GENCALL_R::new(((self.bits >> 4) & 1) != 0)
    }
    ///Bit 7 - Dual flag (Slave mode)
    #[inline(always)]
    pub fn dualf(&self) -> DUALF_R {
        DUALF_R::new(((self.bits >> 7) & 1) != 0)
    }
    ///Bits 8:15 - acket error checking register
    #[inline(always)]
    pub fn pec(&self) -> PEC_R {
        PEC_R::new(((self.bits >> 8) & 0xff) as u8)
    }
}
/**Status register 2

This register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).

For information about available fields see [sr2](index.html) module*/
pub struct SR2_SPEC;
impl crate::RegisterSpec for SR2_SPEC {
    type Ux = u32;
}
///`read()` method returns [sr2::R](R) reader structure
impl crate::Readable for SR2_SPEC {
    type Reader = R;
}
///`reset()` method sets SR2 to value 0
impl crate::Resettable for SR2_SPEC {
    const RESET_VALUE: Self::Ux = 0;
}