now passing the linter

This commit is contained in:
Sam Chin 2025-06-09 16:27:34 +08:00
parent e5cdeaf2ca
commit c291b6a11f
4 changed files with 58 additions and 54 deletions

View file

@ -142,8 +142,8 @@ impl CmdEnv {
let mut echo_cmd = Echo {}; // this command has no persistent storage, so we can "create" it every time we call dispatch (but it's a zero-cost absraction so this doesn't actually create any instructions) let mut echo_cmd = Echo {}; // this command has no persistent storage, so we can "create" it every time we call dispatch (but it's a zero-cost absraction so this doesn't actually create any instructions)
let mut ver_cmd = Ver {}; let mut ver_cmd = Ver {};
let mut console_cmd = Test {}; let mut console_cmd = Test {};
let mut i2cdetect_cmd = I2cDetect{}; let mut i2cdetect_cmd = I2cDetect {};
let mut cute_cmd = Cute{}; let mut cute_cmd = Cute {};
let commands: &mut [&mut dyn ShellCmdApi] = &mut [ let commands: &mut [&mut dyn ShellCmdApi] = &mut [
///// 4. add your command to this array, so that it can be looked up and dispatched ///// 4. add your command to this array, so that it can be looked up and dispatched

View file

@ -86,7 +86,5 @@ impl<'a> ShellCmdApi<'a> for Cute {
} }
Ok(Some(ret)) Ok(Some(ret))
} }
} }

View file

@ -1,7 +1,7 @@
use String; use String;
use cram_hal_service::I2c;
use cramium_api::I2cApi; use cramium_api::I2cApi;
use cramium_api::I2cResult; use cramium_api::I2cResult;
use cram_hal_service::I2c;
use crate::{CommonEnv, ShellCmdApi}; use crate::{CommonEnv, ShellCmdApi};
@ -23,7 +23,6 @@ fn probe_address(i2c: &mut I2c, addr: u8) -> ProbeStatus {
} }
} }
pub struct I2cDetect {} pub struct I2cDetect {}
impl<'a> ShellCmdApi<'a> for I2cDetect { impl<'a> ShellCmdApi<'a> for I2cDetect {
@ -48,12 +47,22 @@ impl<'a> ShellCmdApi<'a> for I2cDetect {
let mut i2c = I2c::new(); let mut i2c = I2c::new();
let status = probe_address(&mut i2c, addr); let status = probe_address(&mut i2c, addr);
match status { match status {
ProbeStatus::Ack => write!(ret, "Device found at address {:02X}\n", addr).unwrap(), ProbeStatus::Ack => {
ProbeStatus::Nack => write!(ret, "Device at address {:02X} responded with NACK\n", addr).unwrap(), write!(ret, "Device found at address {:02X}\n", addr).unwrap()
}
ProbeStatus::Nack => {
write!(ret, "Device at address {:02X} responded with NACK\n", addr)
.unwrap()
}
}; };
} }
Err(_) => { Err(_) => {
write!(ret, "Invalid hex address '{}'. Example: i2cdetect probe 3C\n", addr_str).unwrap(); write!(
ret,
"Invalid hex address '{}'. Example: i2cdetect probe 3C\n",
addr_str
)
.unwrap();
} }
} }
} else { } else {
@ -82,8 +91,6 @@ impl<'a> ShellCmdApi<'a> for I2cDetect {
} }
} }
_ => { _ => {
write!(ret, "{}\n", helpstring).unwrap(); write!(ret, "{}\n", helpstring).unwrap();
} }
@ -94,6 +101,4 @@ impl<'a> ShellCmdApi<'a> for I2cDetect {
Ok(Some(ret)) Ok(Some(ret))
} }
} }

View file

@ -612,7 +612,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// - [planned] vault application // - [planned] vault application
let bao_rram_pkgs = let bao_rram_pkgs =
["xous-ticktimer", "xous-log", "xous-names", "keystore" /* "usb-cramium" */].to_vec(); /* "usb-cramium" */ ["xous-ticktimer", "xous-log", "xous-names", "keystore" /* "usb-cramium" */].to_vec(); /* "usb-cramium" */
let bao_swap_pkgs = ["cram-hal-service", "bao-console", /*"modals", "pddb", "bao-video"*/].to_vec(); /* "bao-video" */ let bao_swap_pkgs =
["cram-hal-service", "bao-console" /* "modals", "pddb", "bao-video" */].to_vec(); /* "bao-video" */
if !builder.is_swap_set() { if !builder.is_swap_set() {
builder.set_swap(0, 8 * 1024 * 1024); builder.set_swap(0, 8 * 1024 * 1024);
} }