implement sync write

This commit is contained in:
Max Känner 2024-01-02 18:43:45 +01:00
parent f912c03661
commit f265a6a153

View File

@ -192,11 +192,12 @@ impl<'a> Instruction<'a> {
buffer[4..4 + ids.len()].copy_from_slice(ids);
Ok(4 + u16::try_from(ids.len()).map_err(|_| Error::Unknown)?)
}
SyncWrite {
addr: _,
len: _,
data: _,
} => unimplemented!(),
SyncWrite { addr, len, data } if buffer.len() >= 4 + data.len() => {
buffer[..2].copy_from_slice(&addr.to_le_bytes());
buffer[2..4].copy_from_slice(&len.to_le_bytes());
buffer[4..4 + data.len()].copy_from_slice(data);
Ok(4 + u16::try_from(data.len()).map_err(|_| Error::Unknown)?)
}
BulkRead { data: _ } => unimplemented!(),
BulkWrite { data: _ } => unimplemented!(),
FastBulkRead { data: _ } => unimplemented!(),