mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
commit of mysterious tuple-vec problem
This commit is contained in:
parent
aeadbfb1b5
commit
6a3833ebc7
5 changed files with 20 additions and 17 deletions
|
|
@ -58,8 +58,10 @@ set -- "${POSITIONAL[@]}"
|
||||||
DESTDIR=code/precursors
|
DESTDIR=code/precursors
|
||||||
|
|
||||||
cargo xtask hw-image ../betrusted-soc/build/software/soc.svd
|
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 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ description = "Manage keyboard input"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
xous = { path = "../../xous-rs" }
|
xous = { path = "../../xous-rs" }
|
||||||
heapless = "0.5"
|
heapless = "0.5.6"
|
||||||
log-server = { path = "../log-server" }
|
log-server = { path = "../log-server" }
|
||||||
ticktimer-server = { path = "../ticktimer-server" }
|
ticktimer-server = { path = "../ticktimer-server" }
|
||||||
xous-names = { path = "../xous-names" }
|
xous-names = { path = "../xous-names" }
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ impl core::convert::TryFrom<& Message> for Opcode {
|
||||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut xous_names::api::Registration) }
|
unsafe { *( (m.buf.as_mut_ptr()) as *mut xous_names::api::Registration) }
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
Err("KBD api: unknown MutableBorrow ID")
|
Err("KBD api: unknown Borrow ID")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => Err("KBD api: unhandled message type"),
|
_ => Err("KBD api: unhandled message type"),
|
||||||
|
|
|
||||||
|
|
@ -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");
|
.expect("can't create sendable registration structure");
|
||||||
sendable_registration.set_subtype(subtype);
|
sendable_registration.set_subtype(subtype);
|
||||||
write!(sendable_registration.name, "{}", name).unwrap();
|
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)
|
Ok(xous::Result::Ok)
|
||||||
} else {
|
|
||||||
Err(xous::Error::InternalError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn request_events(name: &str, kbd_conn: xous::CID) -> Result<xous::Result, xous::Error> {
|
pub fn request_events(name: &str, kbd_conn: xous::CID) -> Result<xous::Result, xous::Error> {
|
||||||
|
|
|
||||||
|
|
@ -282,18 +282,22 @@ mod implementation {
|
||||||
/// which is structured as (row : col), where each of row and col are a u8.
|
/// 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.
|
/// Option "none" means no keys were pressed during this scan.
|
||||||
fn kbd_getcodes(&self) -> Option<Vec<(usize,usize), U16>> {
|
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 {
|
for r in 0..KBD_ROWS {
|
||||||
let cols: u16 = self.kbd_getrow(r as u8);
|
let cols: u16 = self.kbd_getrow(r as u8);
|
||||||
for c in 0..KBD_COLS {
|
for c in 0..KBD_COLS {
|
||||||
if (cols & (1 << c)) != 0 {
|
if (cols & (1 << c)) != 0 {
|
||||||
|
info!("KBD: kbd_getcodes() pushing r{} c{}", r, c);
|
||||||
keys.push( (r, c) ).unwrap();
|
keys.push( (r, c) ).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if keys.len() > 0 {
|
if keys.len() > 0 {
|
||||||
|
for &(r, c) in keys.iter() {
|
||||||
|
info!("KBD: verified r{} c{}", r, c);
|
||||||
|
}
|
||||||
Some(keys)
|
Some(keys)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
@ -340,15 +344,16 @@ mod implementation {
|
||||||
|
|
||||||
// if there's keys pressed, continue to increment the debounce counter
|
// if there's keys pressed, continue to increment the debounce counter
|
||||||
if let Some(code) = &self.lastcode {
|
if let Some(code) = &self.lastcode {
|
||||||
for (row, col) in code.iter() {
|
for &(row, col) in code.iter() {
|
||||||
if self.debounce[*row][*col] < self.threshold {
|
info!("Debouncing row{} col{}", row, col);
|
||||||
self.debounce[*row][*col] += increment;
|
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
|
// now check if we've passed the debounce threshold, and report a keydown
|
||||||
if self.debounce[*row][*col] >= self.threshold {
|
if self.debounce[row][col] >= self.threshold {
|
||||||
keydowns.push((*row,*col)).expect("KBD hw: probably ran out of space to track keydowns");
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue