update the xous API to handle bitmask-based setting of the BIO pins

This commit is contained in:
bunnie 2025-12-26 20:18:49 +08:00
parent acc9771886
commit 1c0d8eea17
2 changed files with 12 additions and 5 deletions

View file

@ -286,6 +286,7 @@ fn main() {
#[cfg(feature = "board-dabao")]
servers::trng::start_trng_service();
servers::rtc::start_rtc_service();
servers::bio::start_bio_service();
let mut msg_opt = None;
log::debug!("Starting main loop");
@ -524,12 +525,17 @@ fn main() {
if let Some(scalar) = msg_opt.as_mut().unwrap().body.scalar_message_mut() {
let port: IoxPort = num_traits::FromPrimitive::from_usize(scalar.arg1).unwrap();
let pin = scalar.arg2 as u8;
match iox.set_bio_bit_from_port_and_pin(port, pin) {
Some(bit) => {
scalar.arg1 = bit as usize;
scalar.arg2 = 1
if scalar.arg3 == 0 {
match iox.set_bio_bit_from_port_and_pin(port, pin) {
Some(bit) => {
scalar.arg1 = bit as usize;
scalar.arg2 = 1
}
_ => scalar.arg2 = 0,
}
_ => scalar.arg2 = 0,
} else {
iox.set_ports_from_bio_bitmask(scalar.arg1 as u32);
// no return values need to be set
}
}
}

View file

@ -3,6 +3,7 @@ pub mod keyboard;
// TRNG server is only needed for baosec; dabao can cheat and use the kernel TRNG port
#[cfg(feature = "board-baosec")]
mod baosec_hw;
pub mod bio;
pub mod rtc;
pub mod susres;
pub mod trng;