fix hosted mode and warnings

This commit is contained in:
bunnie 2026-01-28 15:21:39 +08:00
parent a76222bda3
commit c2640458f5
6 changed files with 19 additions and 7 deletions

View file

@ -540,6 +540,9 @@ fn main() -> ! {
let previous = allow_totp_rendering.load(Ordering::SeqCst);
allow_totp_rendering.store(false, Ordering::SeqCst);
let mut test_data = [0u8; 40];
#[cfg(feature = "hosted-baosec")]
let mut trng = bao1x_emu::trng::Trng::new(&xns).unwrap();
#[cfg(not(feature = "hosted-baosec"))]
let mut trng = bao1x_hal_service::trng::Trng::new(&xns).unwrap();
trng.fill_bytes_via_next(&mut test_data);
let encoded = base45::encode(&test_data);

View file

@ -27,7 +27,7 @@ bytemuck = "1.24.0"
susres = { path = "../../api/xous-api-susres", package = "xous-api-susres" }
keystore = { path = "../keystore" }
bio-lib = { path = "../../libs/bio-lib" }
bio-lib = { path = "../../libs/bio-lib", optional = true }
arbitrary-int = "1.2"
# pddb testing
@ -59,6 +59,7 @@ board-baosec = [
"pddb/board-baosec",
"xous-swapper",
"ux-api/board-baosec",
"bio-lib",
]
oem-baosec-lite = ["bao1x-hal/sensor-lis2dh12"]
hosted-baosec = [

View file

@ -1,5 +1,3 @@
use std::time::Duration;
use String;
use crate::{CommonEnv, ShellCmdApi};
@ -252,6 +250,7 @@ impl<'a> ShellCmdApi<'a> for Test {
}
}
}
#[cfg(not(feature = "hosted-baosec"))]
"cam" => {
use bao1x_api::I2cApi;
let mut i2c = bao1x_hal::i2c::I2c::new();
@ -270,8 +269,9 @@ impl<'a> ShellCmdApi<'a> for Test {
write!(ret, "Wrote {:x} into {:x}", data, adr).ok();
}
}
#[cfg(all(not(feature = "hosted-baosec"), feature = "oem-baosec-lite"))]
"accel" => {
use std::time::Instant;
use std::time::{Duration, Instant};
use bao1x_hal::i2c::I2c;
use bao1x_hal::lis2dh12::{Lis2dh12, Orientation};

View file

@ -266,7 +266,7 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
udma_global.udma_clock_config(PeriphId::Cam, true);
// ---- camera initialization
#[cfg(not(feature = "oem-baosec-lite"))]
#[cfg(all(not(feature = "oem-baosec-lite"), not(feature = "hosted-baosec")))]
let cam_clk = (IoxPort::PA, 0);
#[cfg(feature = "oem-baosec-lite")]
let cam_clk = (IoxPort::PA, 3);

View file

@ -172,6 +172,15 @@ impl FrameBuffer for Oled128x128 {
}
}
unsafe fn put_pixel_unchecked(&mut self, p: Point, on: ColorNative) {
let bitnum = (p.x + p.y * COLUMN) as usize;
if on.0 != 0 {
self.buffer[bitnum / 32] |= 1 << (bitnum % 32);
} else {
self.buffer[bitnum / 32] &= !(1 << (bitnum % 32));
}
}
fn dimensions(&self) -> Point { Point::new(COLUMN, ROW) }
fn get_pixel(&self, p: Point) -> Option<ColorNative> {

View file

@ -1,6 +1,5 @@
use core::sync::atomic::{AtomicU32, Ordering};
use bao1x_hal_service::api::ClockOp;
use num_traits::*;
use utralib::*;
use xous::{CID, Message, msg_blocking_scalar_unpack, msg_scalar_unpack, send_message, sender::Sender};
@ -222,7 +221,7 @@ fn susres_service() {
log::trace!("still waiting on callbacks, returning to main loop");
}
}),
Some(Opcode::SuspendRequest) => msg_blocking_scalar_unpack!(msg, deepsleep, 0, 0, 0, {
Some(Opcode::SuspendRequest) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
log::info!("registered suspend listeners:");
for sub in suspend_subscribers.iter() {
log::info!("{:?}", sub);