fix hosted mode with dummy i2c emulation calls

This commit is contained in:
bunnie 2021-03-16 19:28:01 +08:00
parent eda33b5de7
commit edb099d3f2
2 changed files with 25 additions and 2 deletions

View file

@ -3,6 +3,8 @@ use heapless::consts::*;
use llio::api::*;
use llio::send_i2c_response;
#[cfg(target_os = "none")]
use utralib::*;
#[derive(Eq, PartialEq)]
@ -11,6 +13,25 @@ enum I2cState {
Write,
Read,
}
#[cfg(not(target_os = "none"))]
pub struct I2cStateMachine {
}
#[cfg(not(target_os = "none"))]
impl I2cStateMachine {
pub fn new(_ticktimer: xous::CID, _i2c_base: *mut u32) -> Self {
I2cStateMachine {}
}
pub fn initiate(&mut self, _transaction: I2cTransaction ) -> I2cStatus {
I2cStatus::ResponseInProgress
}
pub fn register_listener(&mut self, _listener: xous::CID) -> Result<(), xous::CID> {
Ok(())
}
pub fn handler(&mut self) {
}
}
#[cfg(target_os = "none")]
pub struct I2cStateMachine {
transaction: I2cTransaction,
state: I2cState,
@ -20,6 +41,7 @@ pub struct I2cStateMachine {
i2c_csr: utralib::CSR<u32>,
listeners: Vec<xous::CID, U32>,
}
#[cfg(target_os = "none")]
impl I2cStateMachine {
pub fn new(ticktimer: xous::CID, i2c_base: *mut u32) -> Self {
I2cStateMachine {

View file

@ -360,17 +360,18 @@ mod implementation {
// a stub to try to avoid breaking hosted mode for as long as possible.
#[cfg(not(target_os = "none"))]
mod implementation {
use crate::api::*;
use llio::api::*;
use log::{error, info};
pub struct Llio {
}
impl Llio {
pub fn new() -> Llio {
pub fn new(_handler_conn: xous::CID) -> Llio {
Llio {
}
}
pub fn get_i2c_base(&self) -> *mut u32 { 0 as *mut u32 }
pub fn reboot(&self, _reboot_soc: bool) {}
pub fn set_reboot_vector(&self, _vector: u32) {}