mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
fix hosted mode
This commit is contained in:
parent
33d8275321
commit
1b25f4c11d
1 changed files with 17 additions and 2 deletions
|
|
@ -10,8 +10,23 @@ impl I2cStateMachine {
|
|||
}
|
||||
pub fn suspend(&mut self) {}
|
||||
pub fn resume(&mut self) {}
|
||||
pub fn initiate(&mut self, _transaction: I2cTransaction) -> I2cStatus {
|
||||
I2cStatus::ResponseInProgress
|
||||
pub fn initiate(&mut self, mut msg: xous::MessageEnvelope) {
|
||||
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) {
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue