|
|
|
@ -47,6 +47,7 @@ pub enum Packet { |
|
|
|
|
I2cReadRequest { destination: u8, busno: u8, ack: bool }, |
|
|
|
|
I2cReadReply { succeeded: bool, data: u8 }, |
|
|
|
|
I2cBasicReply { succeeded: bool }, |
|
|
|
|
I2cSwitchSelectRequest { destination: u8, busno: u8, address: u8, mask: u8 }, |
|
|
|
|
|
|
|
|
|
SpiSetConfigRequest { destination: u8, busno: u8, flags: u8, length: u8, div: u8, cs: u8 }, |
|
|
|
|
SpiWriteRequest { destination: u8, busno: u8, data: u32 }, |
|
|
|
@ -152,6 +153,12 @@ impl Packet { |
|
|
|
|
0x87 => Packet::I2cBasicReply { |
|
|
|
|
succeeded: reader.read_bool()? |
|
|
|
|
}, |
|
|
|
|
0x88 => Packet::I2cSwitchSelectRequest { |
|
|
|
|
destination: reader.read_u8()?, |
|
|
|
|
busno: reader.read_u8()?, |
|
|
|
|
address: reader.read_u8()?, |
|
|
|
|
mask: reader.read_u8()? |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
0x90 => Packet::SpiSetConfigRequest { |
|
|
|
|
destination: reader.read_u8()?, |
|
|
|
@ -301,6 +308,13 @@ impl Packet { |
|
|
|
|
writer.write_u8(0x87)?; |
|
|
|
|
writer.write_bool(succeeded)?; |
|
|
|
|
}, |
|
|
|
|
Packet::I2cSwitchSelectRequest { destination, busno, address, mask } => { |
|
|
|
|
writer.write_u8(0x88)?; |
|
|
|
|
writer.write_u8(destination)?; |
|
|
|
|
writer.write_u8(busno)?; |
|
|
|
|
writer.write_u8(address)?; |
|
|
|
|
writer.write_u8(mask)?; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
Packet::SpiSetConfigRequest { destination, busno, flags, length, div, cs } => { |
|
|
|
|
writer.write_u8(0x90)?; |
|
|
|
|