Type Definition atsaml21e16b::generic::FieldWriter

source ·
pub type FieldWriter<'a, U, REG, N, FI, const WI: u8, const O: u8> = FieldWriterRaw<'a, U, REG, N, FI, Unsafe, WI, O>;
Expand description

Write field Proxy with unsafe bits

Implementations§

Field width

Writes raw bits to the field

Safety

Passing incorrect value can cause undefined behaviour. See reference manual

Examples found in repository?
src/generic.rs (line 509)
508
509
510
    pub fn variant(self, variant: FI) -> &'a mut REG::Writer {
        unsafe { self.bits(N::from(variant)) }
    }

Writes variant to the field

Examples found in repository?
src/nvmctrl/ctrla.rs (line 185)
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
    pub fn er(self) -> &'a mut W {
        self.variant(CMDSELECT_A::ER)
    }
    #[doc = "Write Page - Writes the contents of the page buffer to the page addressed by the ADDR register."]
    #[inline(always)]
    pub fn wp(self) -> &'a mut W {
        self.variant(CMDSELECT_A::WP)
    }
    #[doc = "Erase Auxiliary Row - Erases the auxiliary row addressed by the ADDR register. This command can be given only when the security bit is not set and only to the user configuration row."]
    #[inline(always)]
    pub fn ear(self) -> &'a mut W {
        self.variant(CMDSELECT_A::EAR)
    }
    #[doc = "Write Auxiliary Page - Writes the contents of the page buffer to the page addressed by the ADDR register. This command can be given only when the security bit is not set and only to the user configuration row."]
    #[inline(always)]
    pub fn wap(self) -> &'a mut W {
        self.variant(CMDSELECT_A::WAP)
    }
    #[doc = "Security Flow Command"]
    #[inline(always)]
    pub fn sf(self) -> &'a mut W {
        self.variant(CMDSELECT_A::SF)
    }
    #[doc = "Write lockbits"]
    #[inline(always)]
    pub fn wl(self) -> &'a mut W {
        self.variant(CMDSELECT_A::WL)
    }
    #[doc = "RWW EEPROM area Erase Row - Erases the row addressed by the ADDR register."]
    #[inline(always)]
    pub fn rwweeer(self) -> &'a mut W {
        self.variant(CMDSELECT_A::RWWEEER)
    }
    #[doc = "RWW EEPROM Write Page - Writes the contents of the page buffer to the page addressed by the ADDR register."]
    #[inline(always)]
    pub fn rwweewp(self) -> &'a mut W {
        self.variant(CMDSELECT_A::RWWEEWP)
    }
    #[doc = "Lock Region - Locks the region containing the address location in the ADDR register."]
    #[inline(always)]
    pub fn lr(self) -> &'a mut W {
        self.variant(CMDSELECT_A::LR)
    }
    #[doc = "Unlock Region - Unlocks the region containing the address location in the ADDR register."]
    #[inline(always)]
    pub fn ur(self) -> &'a mut W {
        self.variant(CMDSELECT_A::UR)
    }
    #[doc = "Sets the power reduction mode."]
    #[inline(always)]
    pub fn sprm(self) -> &'a mut W {
        self.variant(CMDSELECT_A::SPRM)
    }
    #[doc = "Clears the power reduction mode."]
    #[inline(always)]
    pub fn cprm(self) -> &'a mut W {
        self.variant(CMDSELECT_A::CPRM)
    }
    #[doc = "Page Buffer Clear - Clears the page buffer."]
    #[inline(always)]
    pub fn pbc(self) -> &'a mut W {
        self.variant(CMDSELECT_A::PBC)
    }
    #[doc = "Set Security Bit - Sets the security bit by writing 0x00 to the first byte in the lockbit row."]
    #[inline(always)]
    pub fn ssb(self) -> &'a mut W {
        self.variant(CMDSELECT_A::SSB)
    }
    #[doc = "Invalidate all cache lines."]
    #[inline(always)]
    pub fn invall(self) -> &'a mut W {
        self.variant(CMDSELECT_A::INVALL)
    }
}
#[doc = "Field `CMDEX` reader - Command Execution"]
pub type CMDEX_R = crate::FieldReader<u8, CMDEXSELECT_A>;
#[doc = "Command Execution\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CMDEXSELECT_A {
    #[doc = "165: Execution Key"]
    KEY = 165,
}
impl From<CMDEXSELECT_A> for u8 {
    #[inline(always)]
    fn from(variant: CMDEXSELECT_A) -> Self {
        variant as _
    }
}
impl CMDEX_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<CMDEXSELECT_A> {
        match self.bits {
            165 => Some(CMDEXSELECT_A::KEY),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `KEY`"]
    #[inline(always)]
    pub fn is_key(&self) -> bool {
        *self == CMDEXSELECT_A::KEY
    }
}
#[doc = "Field `CMDEX` writer - Command Execution"]
pub type CMDEX_W<'a, const O: u8> =
    crate::FieldWriter<'a, u16, CTRLA_SPEC, u8, CMDEXSELECT_A, 8, O>;
impl<'a, const O: u8> CMDEX_W<'a, O> {
    #[doc = "Execution Key"]
    #[inline(always)]
    pub fn key(self) -> &'a mut W {
        self.variant(CMDEXSELECT_A::KEY)
    }
More examples
Hide additional examples
src/rtc/mode2/alarm.rs (line 89)
88
89
90
91
92
93
94
95
    pub fn am(self) -> &'a mut W {
        self.variant(HOURSELECT_A::AM)
    }
    #[doc = "Afternoon hour"]
    #[inline(always)]
    pub fn pm(self) -> &'a mut W {
        self.variant(HOURSELECT_A::PM)
    }
src/rtc/mode2/clock.rs (line 89)
88
89
90
91
92
93
94
95
    pub fn am(self) -> &'a mut W {
        self.variant(HOURSELECT_A::AM)
    }
    #[doc = "PM when CLKREP in 12-hour"]
    #[inline(always)]
    pub fn pm(self) -> &'a mut W {
        self.variant(HOURSELECT_A::PM)
    }
src/pac/wrctrl.rs (line 101)
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
    pub fn off(self) -> &'a mut W {
        self.variant(KEYSELECT_A::OFF)
    }
    #[doc = "Clear protection"]
    #[inline(always)]
    pub fn clr(self) -> &'a mut W {
        self.variant(KEYSELECT_A::CLR)
    }
    #[doc = "Set protection"]
    #[inline(always)]
    pub fn set(self) -> &'a mut W {
        self.variant(KEYSELECT_A::SET)
    }
    #[doc = "Set and lock protection"]
    #[inline(always)]
    pub fn setlck(self) -> &'a mut W {
        self.variant(KEYSELECT_A::SETLCK)
    }
src/rtc/mode2/mask.rs (line 121)
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
    pub fn off(self) -> &'a mut W {
        self.variant(SELSELECT_A::OFF)
    }
    #[doc = "Match seconds only"]
    #[inline(always)]
    pub fn ss(self) -> &'a mut W {
        self.variant(SELSELECT_A::SS)
    }
    #[doc = "Match seconds and minutes only"]
    #[inline(always)]
    pub fn mmss(self) -> &'a mut W {
        self.variant(SELSELECT_A::MMSS)
    }
    #[doc = "Match seconds, minutes, and hours only"]
    #[inline(always)]
    pub fn hhmmss(self) -> &'a mut W {
        self.variant(SELSELECT_A::HHMMSS)
    }
    #[doc = "Match seconds, minutes, hours, and days only"]
    #[inline(always)]
    pub fn ddhhmmss(self) -> &'a mut W {
        self.variant(SELSELECT_A::DDHHMMSS)
    }
    #[doc = "Match seconds, minutes, hours, days, and months only"]
    #[inline(always)]
    pub fn mmddhhmmss(self) -> &'a mut W {
        self.variant(SELSELECT_A::MMDDHHMMSS)
    }
    #[doc = "Match seconds, minutes, hours, days, months, and years"]
    #[inline(always)]
    pub fn yymmddhhmmss(self) -> &'a mut W {
        self.variant(SELSELECT_A::YYMMDDHHMMSS)
    }
src/supc/vreg.rs (line 93)
92
93
94
95
96
97
98
99
100
101
102
103
104
    pub fn ldo(self) -> &'a mut W {
        self.variant(SELSELECT_A::LDO)
    }
    #[doc = "Buck selection"]
    #[inline(always)]
    pub fn buck(self) -> &'a mut W {
        self.variant(SELSELECT_A::BUCK)
    }
    #[doc = "Switched Cap selection"]
    #[inline(always)]
    pub fn scvreg(self) -> &'a mut W {
        self.variant(SELSELECT_A::SCVREG)
    }