mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge branch 'bunnie-dev' into main
This commit is contained in:
commit
f6131693ab
1 changed files with 17 additions and 2 deletions
|
|
@ -10,8 +10,23 @@ impl I2cStateMachine {
|
||||||
}
|
}
|
||||||
pub fn suspend(&mut self) {}
|
pub fn suspend(&mut self) {}
|
||||||
pub fn resume(&mut self) {}
|
pub fn resume(&mut self) {}
|
||||||
pub fn initiate(&mut self, _transaction: I2cTransaction) -> I2cStatus {
|
pub fn initiate(&mut self, mut msg: xous::MessageEnvelope) {
|
||||||
I2cStatus::ResponseInProgress
|
let mut buffer = unsafe { xous_ipc::Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
||||||
|
let transaction = buffer.to_original::<I2cTransaction, _>().unwrap();
|
||||||
|
let response = if transaction.rxbuf.is_some() {
|
||||||
|
I2cResult {
|
||||||
|
rxbuf: [0u8; I2C_MAX_LEN],
|
||||||
|
rxlen: transaction.rxbuf.unwrap().len() as u32,
|
||||||
|
status: I2cStatus::ResponseReadOk,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
I2cResult {
|
||||||
|
rxbuf: [0u8; I2C_MAX_LEN],
|
||||||
|
rxlen: 0,
|
||||||
|
status: I2cStatus::ResponseWriteOk,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
buffer.replace(response).unwrap();
|
||||||
}
|
}
|
||||||
pub fn report_write_done(&mut self) {
|
pub fn report_write_done(&mut self) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue