mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
reset the i2c machine every new transaction
This commit is contained in:
parent
f7874aab94
commit
6825e2e7e8
3 changed files with 4 additions and 4 deletions
|
|
@ -553,7 +553,7 @@ fn imef_cb(s: String::<4000>) {
|
||||||
#[xous::xous_main]
|
#[xous::xous_main]
|
||||||
fn xmain() -> ! {
|
fn xmain() -> ! {
|
||||||
log_server::init_wait().unwrap();
|
log_server::init_wait().unwrap();
|
||||||
log::set_max_level(log::LevelFilter::Debug);
|
log::set_max_level(log::LevelFilter::Info);
|
||||||
info!("my PID is {}", xous::process::id());
|
info!("my PID is {}", xous::process::id());
|
||||||
|
|
||||||
let xns = xous_names::XousNames::new().unwrap();
|
let xns = xous_names::XousNames::new().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -157,8 +157,8 @@ impl I2cStateMachine {
|
||||||
self.state = I2cState::Idle;
|
self.state = I2cState::Idle;
|
||||||
self.index = 0;
|
self.index = 0;
|
||||||
// reset the block - this resest just the state machine and not the prescaler or interrupt enable configs
|
// reset the block - this resest just the state machine and not the prescaler or interrupt enable configs
|
||||||
self.i2c_csr.wfo(utra::i2c::CORE_RESET_RESET, 1);
|
|
||||||
}
|
}
|
||||||
|
self.i2c_csr.wfo(utra::i2c::CORE_RESET_RESET, 1);
|
||||||
self.error = false;
|
self.error = false;
|
||||||
self.timestamp = now;
|
self.timestamp = now;
|
||||||
self.transaction = transaction.clone();
|
self.transaction = transaction.clone();
|
||||||
|
|
|
||||||
|
|
@ -552,10 +552,10 @@ fn i2c_thread(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
|
||||||
let sr_cid = xous::connect(i2c_sid).expect("couldn't create suspend callback connection");
|
let sr_cid = xous::connect(i2c_sid).expect("couldn't create suspend callback connection");
|
||||||
let mut susres = susres::Susres::new(&xns, I2cOpcode::SuspendResume as u32, sr_cid).expect("couldn't create suspend/resume object");
|
let mut susres = susres::Susres::new(&xns, I2cOpcode::SuspendResume as u32, sr_cid).expect("couldn't create suspend/resume object");
|
||||||
|
|
||||||
log::trace!("starting main loop");
|
log::trace!("starting i2c main loop");
|
||||||
loop {
|
loop {
|
||||||
let mut msg = xous::receive_message(i2c_sid).unwrap();
|
let mut msg = xous::receive_message(i2c_sid).unwrap();
|
||||||
log::trace!("Message: {:?}", msg);
|
log::trace!("i2c message: {:?}", msg);
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
match FromPrimitive::from_usize(msg.body.id()) {
|
||||||
Some(I2cOpcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
Some(I2cOpcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
||||||
i2c.suspend();
|
i2c.suspend();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue