From 9d850a068f8be5dd0a78ab2494e7e1ceaf4afc9a Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 5 Nov 2024 19:40:04 +0800 Subject: [PATCH] add some documentation --- services/cram-hal-service/src/keyboard.rs | 4 ++++ services/cram-hal-service/src/main.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/services/cram-hal-service/src/keyboard.rs b/services/cram-hal-service/src/keyboard.rs index 587e8f595..593268a7e 100644 --- a/services/cram-hal-service/src/keyboard.rs +++ b/services/cram-hal-service/src/keyboard.rs @@ -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 }; diff --git a/services/cram-hal-service/src/main.rs b/services/cram-hal-service/src/main.rs index b7872009d..6975e7712 100644 --- a/services/cram-hal-service/src/main.rs +++ b/services/cram-hal-service/src/main.rs @@ -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();