commit of mysterious tuple-vec problem

This commit is contained in:
bunnie 2021-01-12 01:37:52 +08:00
parent aeadbfb1b5
commit 6a3833ebc7
5 changed files with 20 additions and 17 deletions

View file

@ -58,8 +58,10 @@ set -- "${POSITIONAL[@]}"
DESTDIR=code/precursors
cargo xtask hw-image ../betrusted-soc/build/software/soc.svd
cp ../betrusted-soc/build/software/soc.svd svd2utra/examples/soc.svd
cp ../betrusted-soc/build/software/soc.svd emulation/renode.svd
# only copy if changed, othrewise it seems to trigger extra build effort...
rsync -a --no-times --checksum ../betrusted-soc/build/software/soc.svd svd2utra/examples/soc.svd
rsync -a --no-times --checksum ../betrusted-soc/build/software/soc.svd emulation/renode.svd
if [ $? -ne 0 ]
then

View file

@ -7,7 +7,7 @@ description = "Manage keyboard input"
[dependencies]
xous = { path = "../../xous-rs" }
heapless = "0.5"
heapless = "0.5.6"
log-server = { path = "../log-server" }
ticktimer-server = { path = "../ticktimer-server" }
xous-names = { path = "../xous-names" }

View file

@ -157,7 +157,7 @@ impl core::convert::TryFrom<& Message> for Opcode {
unsafe { *( (m.buf.as_mut_ptr()) as *mut xous_names::api::Registration) }
}))
} else {
Err("KBD api: unknown MutableBorrow ID")
Err("KBD api: unknown Borrow ID")
}
},
_ => Err("KBD api: unhandled message type"),

View file

@ -11,13 +11,9 @@ fn request_core(name: &str, kbd_conn: xous::CID, subtype: u8) -> Result<xous::Re
.expect("can't create sendable registration structure");
sendable_registration.set_subtype(subtype);
write!(sendable_registration.name, "{}", name).unwrap();
sendable_registration.lend_mut(kbd_conn, sendable_registration.mid()).expect("keyboard event request registration failure!");
sendable_registration.lend(kbd_conn, sendable_registration.mid()).expect("keyboard event request registration failure!");
if sendable_registration.success {
Ok(xous::Result::Ok)
} else {
Err(xous::Error::InternalError)
}
Ok(xous::Result::Ok)
}
pub fn request_events(name: &str, kbd_conn: xous::CID) -> Result<xous::Result, xous::Error> {

View file

@ -282,18 +282,22 @@ mod implementation {
/// which is structured as (row : col), where each of row and col are a u8.
/// Option "none" means no keys were pressed during this scan.
fn kbd_getcodes(&self) -> Option<Vec<(usize,usize), U16>> {
let mut keys = Vec::new();
let mut keys: Vec<(usize, usize), U16> = Vec::new();
for r in 0..KBD_ROWS {
let cols: u16 = self.kbd_getrow(r as u8);
for c in 0..KBD_COLS {
if (cols & (1 << c)) != 0 {
info!("KBD: kbd_getcodes() pushing r{} c{}", r, c);
keys.push( (r, c) ).unwrap();
}
}
}
if keys.len() > 0 {
for &(r, c) in keys.iter() {
info!("KBD: verified r{} c{}", r, c);
}
Some(keys)
} else {
None
@ -340,15 +344,16 @@ mod implementation {
// if there's keys pressed, continue to increment the debounce counter
if let Some(code) = &self.lastcode {
for (row, col) in code.iter() {
if self.debounce[*row][*col] < self.threshold {
self.debounce[*row][*col] += increment;
for &(row, col) in code.iter() {
info!("Debouncing row{} col{}", row, col);
if self.debounce[row][col] < self.threshold {
self.debounce[row][col] += increment;
// now check if we've passed the debounce threshold, and report a keydown
if self.debounce[*row][*col] >= self.threshold {
keydowns.push((*row,*col)).expect("KBD hw: probably ran out of space to track keydowns");
if self.debounce[row][col] >= self.threshold {
keydowns.push((row,col)).expect("KBD hw: probably ran out of space to track keydowns");
}
}
downs[*row][*col] = true; // record that we processed the key
downs[row][col] = true; // record that we processed the key
}
}