mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
rebuild and prep for testing on hardware
This commit is contained in:
parent
8786b6db7b
commit
da7ace04d4
8 changed files with 38 additions and 14 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1085,6 +1085,7 @@ name = "rkyv-test-client"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"com",
|
||||
"keyboard",
|
||||
"log",
|
||||
"log-server",
|
||||
"rkyv-test-server",
|
||||
|
|
|
|||
|
|
@ -1328,10 +1328,10 @@ register to disable individual events.]]></description>
|
|||
<register>
|
||||
<name>GIT_GITREV</name>
|
||||
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
|
||||
``2a2abe5e``, so this value is 707444318, which should be enough to check out
|
||||
``8561717c``, so this value is 2237755772, which should be enough to check out
|
||||
the exact git version used to build this firmware.]]></description>
|
||||
<addressOffset>0x0014</addressOffset>
|
||||
<resetValue>0x2a2abe5e</resetValue>
|
||||
<resetValue>0x8561717c</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -1348,7 +1348,7 @@ the exact git version used to build this firmware.]]></description>
|
|||
is ``1``, then the repository this was built from has one additional commit
|
||||
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
|
||||
<addressOffset>0x0018</addressOffset>
|
||||
<resetValue>0x0e</resetValue>
|
||||
<resetValue>0x0f</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -3056,7 +3056,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED1</name>
|
||||
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
|
||||
<addressOffset>0x0000</addressOffset>
|
||||
<resetValue>0x4e903012</resetValue>
|
||||
<resetValue>0x62e0ffce</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -3071,7 +3071,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED0</name>
|
||||
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
|
||||
<addressOffset>0x0004</addressOffset>
|
||||
<resetValue>0x26a75168</resetValue>
|
||||
<resetValue>0x629a6ab2</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ pub struct RowCol {
|
|||
pub r: u8,
|
||||
pub c: u8,
|
||||
}
|
||||
/// RowColVec is implemented here instead of using heapless::Vec because we can't
|
||||
/// derive the rkyv traits on heapless::Vec. By making a janky vector type here
|
||||
/// our IPC doesn't rely on dangerous serialization techniques like casting to
|
||||
/// raw u8 slices which rely on the implicit shape of packed structures...
|
||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)]
|
||||
pub struct RowColVec {
|
||||
storage: [Option<RowCol>; MAX_KEYS],
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ pub struct Keyboard {
|
|||
raw_cb_sid: Option<xous::SID>,
|
||||
}
|
||||
impl Keyboard {
|
||||
pub fn new(xns: xous_names::XousNames) -> Result<Self, xous::Error> {
|
||||
pub fn new(xns: &xous_names::XousNames) -> Result<Self, xous::Error> {
|
||||
let conn = xns.request_connection_blocking(api::SERVER_NAME_KBD).expect("Can't connect to KBD");
|
||||
Ok(Keyboard {
|
||||
conn,
|
||||
|
|
|
|||
|
|
@ -874,8 +874,15 @@ fn xmain() -> ! {
|
|||
// send rawstates on to rawstate listeners
|
||||
send_rawstates(&mut raw_conns, &rawstates);
|
||||
|
||||
// TODO: refactor this Vec usage into an array (the Vec is from a previous implementation)
|
||||
// for now, just copy the array over, inefficiently
|
||||
// GROSS: we copy our IPC-compatible RowColVec type into a heapless::Vec for further processing
|
||||
// this code can probably be cleaned up and improved quite a bit to reduce CPU time.
|
||||
// We don't use heapless::Vec for the IPC because we can't serialize the object with a trait natively
|
||||
// which leaves us with ugly/dangerous slice-of-u8 cast techniques and/or inefficient serialization
|
||||
// methods that rely on effectively a substantially similar intermediate array-based implementation.
|
||||
// We retain the use of the "Vec" type here because the Vec type has some nice functions like iterators,
|
||||
// and push(), len() etc. which doesn't really make sense to re-implement. But, maybe someone much
|
||||
// more clever than I could do extend RowColVec to have these feature and get rid of this ugly copy
|
||||
// step and make the rest of this routine operate natively on RowColVec types....
|
||||
let mut keyups_core: Vec<RowCol, U16> = Vec::new();
|
||||
let mut keydowns_core: Vec<RowCol, U16> = Vec::new();
|
||||
for i in 0..rawstates.keyups.len() {
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ xous = {path = "../../xous-rs"}
|
|||
com = {path = "../com"}
|
||||
xous-names = {path="../xous-names"}
|
||||
|
||||
keyboard = {path="../keyboard"}
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
|
|
|||
|
|
@ -19,6 +19,14 @@ fn handle_battstats(bs: com::BattStats) {
|
|||
// 2. use an Atomic type to transfer primitive data types from the handler thread to the main thread
|
||||
}
|
||||
|
||||
fn handle_keyevents(keys: [char; 4]) {
|
||||
for &k in keys.iter() {
|
||||
if k != '\u{0000}' {
|
||||
log::info!("KEYEVENT: {}", k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[xous::xous_main]
|
||||
fn rkyv_test_client() -> ! {
|
||||
log_server::init_wait().unwrap();
|
||||
|
|
@ -40,9 +48,11 @@ fn rkyv_test_client() -> ! {
|
|||
let mut message_string = xous::String::<64>::new();
|
||||
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
let mut com = com::Com::new(xns).unwrap();
|
||||
let mut com = com::Com::new(&xns).unwrap();
|
||||
com.hook_batt_stats(handle_battstats).unwrap();
|
||||
|
||||
let mut kbd = keyboard::Keyboard::new(&xns).unwrap();
|
||||
kbd.hook_keyboard_events(handle_keyevents).unwrap();
|
||||
loop {
|
||||
log::info!("2 + {} = {}", idx, rkyv_test_server::add(2, idx).unwrap());
|
||||
ticktimer.sleep_ms(500).ok();
|
||||
|
|
|
|||
|
|
@ -1328,10 +1328,10 @@ register to disable individual events.]]></description>
|
|||
<register>
|
||||
<name>GIT_GITREV</name>
|
||||
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
|
||||
``2a2abe5e``, so this value is 707444318, which should be enough to check out
|
||||
``8561717c``, so this value is 2237755772, which should be enough to check out
|
||||
the exact git version used to build this firmware.]]></description>
|
||||
<addressOffset>0x0014</addressOffset>
|
||||
<resetValue>0x2a2abe5e</resetValue>
|
||||
<resetValue>0x8561717c</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -1348,7 +1348,7 @@ the exact git version used to build this firmware.]]></description>
|
|||
is ``1``, then the repository this was built from has one additional commit
|
||||
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
|
||||
<addressOffset>0x0018</addressOffset>
|
||||
<resetValue>0x0e</resetValue>
|
||||
<resetValue>0x0f</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -3056,7 +3056,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED1</name>
|
||||
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
|
||||
<addressOffset>0x0000</addressOffset>
|
||||
<resetValue>0x4e903012</resetValue>
|
||||
<resetValue>0x62e0ffce</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -3071,7 +3071,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED0</name>
|
||||
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
|
||||
<addressOffset>0x0004</addressOffset>
|
||||
<resetValue>0x26a75168</resetValue>
|
||||
<resetValue>0x629a6ab2</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
|
|||
Loading…
Reference in a new issue