lpc13xx_pac/lpc1313/usb/
cmdcode.rs1#[doc = "Register `CMDCODE` writer"]
2pub struct W(crate::W<CMDCODE_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<CMDCODE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl core::ops::DerefMut for W {
11 #[inline(always)]
12 fn deref_mut(&mut self) -> &mut Self::Target {
13 &mut self.0
14 }
15}
16impl From<crate::W<CMDCODE_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<CMDCODE_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Command phase action\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq)]
24#[repr(u8)]
25pub enum CMD_PHASE_AW {
26 #[doc = "1: Write"]
27 WRITE = 1,
28 #[doc = "2: Read"]
29 READ = 2,
30 #[doc = "5: Command"]
31 COMMAND = 5,
32}
33impl From<CMD_PHASE_AW> for u8 {
34 #[inline(always)]
35 fn from(variant: CMD_PHASE_AW) -> Self {
36 variant as _
37 }
38}
39#[doc = "Field `CMD_PHASE` writer - Command phase action"]
40pub type CMD_PHASE_W<'a, const O: u8> =
41 crate::FieldWriter<'a, u32, CMDCODE_SPEC, u8, CMD_PHASE_AW, 8, O>;
42impl<'a, const O: u8> CMD_PHASE_W<'a, O> {
43 #[doc = "Write"]
44 #[inline(always)]
45 pub fn write(self) -> &'a mut W {
46 self.variant(CMD_PHASE_AW::WRITE)
47 }
48 #[doc = "Read"]
49 #[inline(always)]
50 pub fn read(self) -> &'a mut W {
51 self.variant(CMD_PHASE_AW::READ)
52 }
53 #[doc = "Command"]
54 #[inline(always)]
55 pub fn command(self) -> &'a mut W {
56 self.variant(CMD_PHASE_AW::COMMAND)
57 }
58}
59#[doc = "Field `CODE_WDATA` writer - This is a multi-purpose field. When CMD_PHASE is Command or Read, this field contains the code for the command (CMD_CODE). When CMD_PHASE is Write, this field contains the command write data (CMD_WDATA)."]
60pub type CODE_WDATA_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CMDCODE_SPEC, u8, u8, 8, O>;
61impl W {
62 #[doc = "Bits 8:15 - Command phase action"]
63 #[inline(always)]
64 pub fn cmd_phase(&mut self) -> CMD_PHASE_W<8> {
65 CMD_PHASE_W::new(self)
66 }
67 #[doc = "Bits 16:23 - This is a multi-purpose field. When CMD_PHASE is Command or Read, this field contains the code for the command (CMD_CODE). When CMD_PHASE is Write, this field contains the command write data (CMD_WDATA)."]
68 #[inline(always)]
69 pub fn code_wdata(&mut self) -> CODE_WDATA_W<16> {
70 CODE_WDATA_W::new(self)
71 }
72 #[doc = "Writes raw bits to the register."]
73 #[inline(always)]
74 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75 self.0.bits(bits);
76 self
77 }
78}
79#[doc = "USB Command Code\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cmdcode](index.html) module"]
80pub struct CMDCODE_SPEC;
81impl crate::RegisterSpec for CMDCODE_SPEC {
82 type Ux = u32;
83}
84#[doc = "`write(|w| ..)` method takes [cmdcode::W](W) writer structure"]
85impl crate::Writable for CMDCODE_SPEC {
86 type Writer = W;
87}
88#[doc = "`reset()` method sets CMDCODE to value 0"]
89impl crate::Resettable for CMDCODE_SPEC {
90 #[inline(always)]
91 fn reset_value() -> Self::Ux {
92 0
93 }
94}