Skip to content

Commit 5270c86

Browse files
authored
Fix I2C/COMD/OPCODE values (#267)
1 parent db62264 commit 5270c86

File tree

10 files changed

+189
-178
lines changed

10 files changed

+189
-178
lines changed

common_patches/i2c0.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ COMD%s:
2828
access: read-write
2929
OPCODE:
3030
_name: Opcode
31-
Rstart: [0, RSTART opcode]
3231
Write: [1, WRITE opcode]
33-
Read: [2, READ opcode]
34-
Stop: [3, STOP opcode]
35-
End: [4, END opcode]
32+
Read: [3, READ opcode]
33+
Stop: [2, STOP opcode]
34+
End: [4, END opcode]
35+
Rstart: [6, RSTART opcode]
36+

common_patches/i2c_opcode.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
COMD%s:
2+
OPCODE:
3+
_replace_enum:
4+
Rstart: [0, RSTART opcode]
5+
Write: [1, WRITE opcode]
6+
Read: [2, READ opcode]
7+
Stop: [3, STOP opcode]
8+
End: [4, END opcode]

esp32/svd/patches/esp32.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ I2C0:
66
name: INT_ST
77
_include:
88
- ../../../common_patches/i2c0.yaml
9+
- ../../../common_patches/i2c_opcode.yaml
910

1011
RTC_I2C:
1112
_modify:

esp32c2/src/i2c0/comd.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ pub type ACK_VALUE_W<'a, REG> = crate::BitWriter<'a, REG>;
2323
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2424
#[repr(u8)]
2525
pub enum OPCODE {
26-
#[doc = "0: RSTART opcode"]
27-
Rstart = 0,
2826
#[doc = "1: WRITE opcode"]
2927
Write = 1,
30-
#[doc = "2: READ opcode"]
31-
Read = 2,
32-
#[doc = "3: STOP opcode"]
33-
Stop = 3,
28+
#[doc = "2: STOP opcode"]
29+
Stop = 2,
30+
#[doc = "3: READ opcode"]
31+
Read = 3,
3432
#[doc = "4: END opcode"]
3533
End = 4,
34+
#[doc = "6: RSTART opcode"]
35+
Rstart = 6,
3636
}
3737
impl From<OPCODE> for u8 {
3838
#[inline(always)]
@@ -51,39 +51,39 @@ impl OPCODE_R {
5151
#[inline(always)]
5252
pub const fn variant(&self) -> Option<OPCODE> {
5353
match self.bits {
54-
0 => Some(OPCODE::Rstart),
5554
1 => Some(OPCODE::Write),
56-
2 => Some(OPCODE::Read),
57-
3 => Some(OPCODE::Stop),
55+
2 => Some(OPCODE::Stop),
56+
3 => Some(OPCODE::Read),
5857
4 => Some(OPCODE::End),
58+
6 => Some(OPCODE::Rstart),
5959
_ => None,
6060
}
6161
}
62-
#[doc = "RSTART opcode"]
63-
#[inline(always)]
64-
pub fn is_rstart(&self) -> bool {
65-
*self == OPCODE::Rstart
66-
}
6762
#[doc = "WRITE opcode"]
6863
#[inline(always)]
6964
pub fn is_write(&self) -> bool {
7065
*self == OPCODE::Write
7166
}
72-
#[doc = "READ opcode"]
73-
#[inline(always)]
74-
pub fn is_read(&self) -> bool {
75-
*self == OPCODE::Read
76-
}
7767
#[doc = "STOP opcode"]
7868
#[inline(always)]
7969
pub fn is_stop(&self) -> bool {
8070
*self == OPCODE::Stop
8171
}
72+
#[doc = "READ opcode"]
73+
#[inline(always)]
74+
pub fn is_read(&self) -> bool {
75+
*self == OPCODE::Read
76+
}
8277
#[doc = "END opcode"]
8378
#[inline(always)]
8479
pub fn is_end(&self) -> bool {
8580
*self == OPCODE::End
8681
}
82+
#[doc = "RSTART opcode"]
83+
#[inline(always)]
84+
pub fn is_rstart(&self) -> bool {
85+
*self == OPCODE::Rstart
86+
}
8787
}
8888
#[doc = "Field `OPCODE` writer - Opcode part of command %s."]
8989
pub type OPCODE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, OPCODE>;
@@ -92,31 +92,31 @@ where
9292
REG: crate::Writable + crate::RegisterSpec,
9393
REG::Ux: From<u8>,
9494
{
95-
#[doc = "RSTART opcode"]
96-
#[inline(always)]
97-
pub fn rstart(self) -> &'a mut crate::W<REG> {
98-
self.variant(OPCODE::Rstart)
99-
}
10095
#[doc = "WRITE opcode"]
10196
#[inline(always)]
10297
pub fn write(self) -> &'a mut crate::W<REG> {
10398
self.variant(OPCODE::Write)
10499
}
105-
#[doc = "READ opcode"]
106-
#[inline(always)]
107-
pub fn read(self) -> &'a mut crate::W<REG> {
108-
self.variant(OPCODE::Read)
109-
}
110100
#[doc = "STOP opcode"]
111101
#[inline(always)]
112102
pub fn stop(self) -> &'a mut crate::W<REG> {
113103
self.variant(OPCODE::Stop)
114104
}
105+
#[doc = "READ opcode"]
106+
#[inline(always)]
107+
pub fn read(self) -> &'a mut crate::W<REG> {
108+
self.variant(OPCODE::Read)
109+
}
115110
#[doc = "END opcode"]
116111
#[inline(always)]
117112
pub fn end(self) -> &'a mut crate::W<REG> {
118113
self.variant(OPCODE::End)
119114
}
115+
#[doc = "RSTART opcode"]
116+
#[inline(always)]
117+
pub fn rstart(self) -> &'a mut crate::W<REG> {
118+
self.variant(OPCODE::Rstart)
119+
}
120120
}
121121
#[doc = "Field `COMMAND_DONE` reader - When command 0 is done in I2C Master mode, this bit changes to high level."]
122122
pub type COMMAND_DONE_R = crate::BitReader;

esp32c3/src/i2c0/comd.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ pub type ACK_VALUE_W<'a, REG> = crate::BitWriter<'a, REG>;
2323
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2424
#[repr(u8)]
2525
pub enum OPCODE {
26-
#[doc = "0: RSTART opcode"]
27-
Rstart = 0,
2826
#[doc = "1: WRITE opcode"]
2927
Write = 1,
30-
#[doc = "2: READ opcode"]
31-
Read = 2,
32-
#[doc = "3: STOP opcode"]
33-
Stop = 3,
28+
#[doc = "2: STOP opcode"]
29+
Stop = 2,
30+
#[doc = "3: READ opcode"]
31+
Read = 3,
3432
#[doc = "4: END opcode"]
3533
End = 4,
34+
#[doc = "6: RSTART opcode"]
35+
Rstart = 6,
3636
}
3737
impl From<OPCODE> for u8 {
3838
#[inline(always)]
@@ -51,39 +51,39 @@ impl OPCODE_R {
5151
#[inline(always)]
5252
pub const fn variant(&self) -> Option<OPCODE> {
5353
match self.bits {
54-
0 => Some(OPCODE::Rstart),
5554
1 => Some(OPCODE::Write),
56-
2 => Some(OPCODE::Read),
57-
3 => Some(OPCODE::Stop),
55+
2 => Some(OPCODE::Stop),
56+
3 => Some(OPCODE::Read),
5857
4 => Some(OPCODE::End),
58+
6 => Some(OPCODE::Rstart),
5959
_ => None,
6060
}
6161
}
62-
#[doc = "RSTART opcode"]
63-
#[inline(always)]
64-
pub fn is_rstart(&self) -> bool {
65-
*self == OPCODE::Rstart
66-
}
6762
#[doc = "WRITE opcode"]
6863
#[inline(always)]
6964
pub fn is_write(&self) -> bool {
7065
*self == OPCODE::Write
7166
}
72-
#[doc = "READ opcode"]
73-
#[inline(always)]
74-
pub fn is_read(&self) -> bool {
75-
*self == OPCODE::Read
76-
}
7767
#[doc = "STOP opcode"]
7868
#[inline(always)]
7969
pub fn is_stop(&self) -> bool {
8070
*self == OPCODE::Stop
8171
}
72+
#[doc = "READ opcode"]
73+
#[inline(always)]
74+
pub fn is_read(&self) -> bool {
75+
*self == OPCODE::Read
76+
}
8277
#[doc = "END opcode"]
8378
#[inline(always)]
8479
pub fn is_end(&self) -> bool {
8580
*self == OPCODE::End
8681
}
82+
#[doc = "RSTART opcode"]
83+
#[inline(always)]
84+
pub fn is_rstart(&self) -> bool {
85+
*self == OPCODE::Rstart
86+
}
8787
}
8888
#[doc = "Field `OPCODE` writer - Opcode part of command %s."]
8989
pub type OPCODE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, OPCODE>;
@@ -92,31 +92,31 @@ where
9292
REG: crate::Writable + crate::RegisterSpec,
9393
REG::Ux: From<u8>,
9494
{
95-
#[doc = "RSTART opcode"]
96-
#[inline(always)]
97-
pub fn rstart(self) -> &'a mut crate::W<REG> {
98-
self.variant(OPCODE::Rstart)
99-
}
10095
#[doc = "WRITE opcode"]
10196
#[inline(always)]
10297
pub fn write(self) -> &'a mut crate::W<REG> {
10398
self.variant(OPCODE::Write)
10499
}
105-
#[doc = "READ opcode"]
106-
#[inline(always)]
107-
pub fn read(self) -> &'a mut crate::W<REG> {
108-
self.variant(OPCODE::Read)
109-
}
110100
#[doc = "STOP opcode"]
111101
#[inline(always)]
112102
pub fn stop(self) -> &'a mut crate::W<REG> {
113103
self.variant(OPCODE::Stop)
114104
}
105+
#[doc = "READ opcode"]
106+
#[inline(always)]
107+
pub fn read(self) -> &'a mut crate::W<REG> {
108+
self.variant(OPCODE::Read)
109+
}
115110
#[doc = "END opcode"]
116111
#[inline(always)]
117112
pub fn end(self) -> &'a mut crate::W<REG> {
118113
self.variant(OPCODE::End)
119114
}
115+
#[doc = "RSTART opcode"]
116+
#[inline(always)]
117+
pub fn rstart(self) -> &'a mut crate::W<REG> {
118+
self.variant(OPCODE::Rstart)
119+
}
120120
}
121121
#[doc = "Field `COMMAND_DONE` reader - reg_command_done"]
122122
pub type COMMAND_DONE_R = crate::BitReader;

esp32c6/src/i2c0/comd.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ pub type ACK_VALUE_W<'a, REG> = crate::BitWriter<'a, REG>;
2323
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2424
#[repr(u8)]
2525
pub enum OPCODE {
26-
#[doc = "0: RSTART opcode"]
27-
Rstart = 0,
2826
#[doc = "1: WRITE opcode"]
2927
Write = 1,
30-
#[doc = "2: READ opcode"]
31-
Read = 2,
32-
#[doc = "3: STOP opcode"]
33-
Stop = 3,
28+
#[doc = "2: STOP opcode"]
29+
Stop = 2,
30+
#[doc = "3: READ opcode"]
31+
Read = 3,
3432
#[doc = "4: END opcode"]
3533
End = 4,
34+
#[doc = "6: RSTART opcode"]
35+
Rstart = 6,
3636
}
3737
impl From<OPCODE> for u8 {
3838
#[inline(always)]
@@ -51,39 +51,39 @@ impl OPCODE_R {
5151
#[inline(always)]
5252
pub const fn variant(&self) -> Option<OPCODE> {
5353
match self.bits {
54-
0 => Some(OPCODE::Rstart),
5554
1 => Some(OPCODE::Write),
56-
2 => Some(OPCODE::Read),
57-
3 => Some(OPCODE::Stop),
55+
2 => Some(OPCODE::Stop),
56+
3 => Some(OPCODE::Read),
5857
4 => Some(OPCODE::End),
58+
6 => Some(OPCODE::Rstart),
5959
_ => None,
6060
}
6161
}
62-
#[doc = "RSTART opcode"]
63-
#[inline(always)]
64-
pub fn is_rstart(&self) -> bool {
65-
*self == OPCODE::Rstart
66-
}
6762
#[doc = "WRITE opcode"]
6863
#[inline(always)]
6964
pub fn is_write(&self) -> bool {
7065
*self == OPCODE::Write
7166
}
72-
#[doc = "READ opcode"]
73-
#[inline(always)]
74-
pub fn is_read(&self) -> bool {
75-
*self == OPCODE::Read
76-
}
7767
#[doc = "STOP opcode"]
7868
#[inline(always)]
7969
pub fn is_stop(&self) -> bool {
8070
*self == OPCODE::Stop
8171
}
72+
#[doc = "READ opcode"]
73+
#[inline(always)]
74+
pub fn is_read(&self) -> bool {
75+
*self == OPCODE::Read
76+
}
8277
#[doc = "END opcode"]
8378
#[inline(always)]
8479
pub fn is_end(&self) -> bool {
8580
*self == OPCODE::End
8681
}
82+
#[doc = "RSTART opcode"]
83+
#[inline(always)]
84+
pub fn is_rstart(&self) -> bool {
85+
*self == OPCODE::Rstart
86+
}
8787
}
8888
#[doc = "Field `OPCODE` writer - Opcode part of command %s."]
8989
pub type OPCODE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, OPCODE>;
@@ -92,31 +92,31 @@ where
9292
REG: crate::Writable + crate::RegisterSpec,
9393
REG::Ux: From<u8>,
9494
{
95-
#[doc = "RSTART opcode"]
96-
#[inline(always)]
97-
pub fn rstart(self) -> &'a mut crate::W<REG> {
98-
self.variant(OPCODE::Rstart)
99-
}
10095
#[doc = "WRITE opcode"]
10196
#[inline(always)]
10297
pub fn write(self) -> &'a mut crate::W<REG> {
10398
self.variant(OPCODE::Write)
10499
}
105-
#[doc = "READ opcode"]
106-
#[inline(always)]
107-
pub fn read(self) -> &'a mut crate::W<REG> {
108-
self.variant(OPCODE::Read)
109-
}
110100
#[doc = "STOP opcode"]
111101
#[inline(always)]
112102
pub fn stop(self) -> &'a mut crate::W<REG> {
113103
self.variant(OPCODE::Stop)
114104
}
105+
#[doc = "READ opcode"]
106+
#[inline(always)]
107+
pub fn read(self) -> &'a mut crate::W<REG> {
108+
self.variant(OPCODE::Read)
109+
}
115110
#[doc = "END opcode"]
116111
#[inline(always)]
117112
pub fn end(self) -> &'a mut crate::W<REG> {
118113
self.variant(OPCODE::End)
119114
}
115+
#[doc = "RSTART opcode"]
116+
#[inline(always)]
117+
pub fn rstart(self) -> &'a mut crate::W<REG> {
118+
self.variant(OPCODE::Rstart)
119+
}
120120
}
121121
#[doc = "Field `COMMAND_DONE` reader - When command 0 is done in I2C Master mode, this bit changes to high level."]
122122
pub type COMMAND_DONE_R = crate::BitReader;

0 commit comments

Comments
 (0)