add some documentation

This commit is contained in:
bunnie 2024-11-05 19:40:04 +08:00
parent 5935406f89
commit 9d850a068f
2 changed files with 7 additions and 0 deletions

View file

@ -16,6 +16,7 @@ impl Keyboard {
Ok(Keyboard { conn })
}
/// Listeners get passed the full content of the key press on each key hit.
pub fn register_listener(&self, server_name: &str, action_opcode: usize) {
let kr =
KeyboardRegistration { server_name: String::from(server_name), listener_op_id: action_opcode };
@ -24,6 +25,9 @@ impl Keyboard {
.expect("couldn't register listener");
}
/// Observers get notified if a key is hit, but the actual keypress is always null.
/// This is useful for hardware services that need to do e.g. screen wakeup on key hit
/// but has no need to know the user's actually keystroke contents.
pub fn register_observer(&self, server_name: &str, action_opcode: usize) {
let kr =
KeyboardRegistration { server_name: String::from(server_name), listener_op_id: action_opcode };

View file

@ -139,6 +139,8 @@ fn main() {
.expect("couldn't map UDMA global control");
let udma_global = GlobalConfig::new(udma_global_csr.as_mut_ptr() as *mut u32);
// -------------------- begin timer workaround code
// This code should go away with NTO as we have a proper, private ticktimer unit.
let mut pio_ss = xous_pio::PioSharedState::new();
// map and enable the interrupt for the PIO system timer
let irq18_page = xous::syscall::map_memory(
@ -185,6 +187,7 @@ fn main() {
ptimer.irq_csr.wfo(utra::irqarray18::EV_ENABLE_PIOIRQ0_DUPE, 1);
log::info!("Quantum timer setup!");
}
// -------------------- end timer workaround code
// start keyboard emulator service
hw::keyboard::start_keyboard_service();