firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

at a3ff1f4e4e2aaec4a4c1ec5def91c21d36dc12f7 50 lines 1.1 kB view raw
1use core::mem::MaybeUninit; 2use crate::{syscall, SafeOption}; 3use crate::input_common::Event; 4use crate::syscall::SyscallNumber; 5 6#[repr(usize)] 7#[derive(Copy, Clone, Debug, Eq, PartialEq, strum::FromRepr)] 8#[cfg_attr(feature = "defmt", derive(defmt::Format))] 9pub enum InputSyscall { 10 NextEvent = 0, 11 SetTouchEnabled = 1, 12 HasEvent = 2, 13} 14 15pub fn next_event() -> Option<Event> { 16 let mut event: MaybeUninit<SafeOption<Event>> = MaybeUninit::uninit(); 17 18 unsafe { 19 syscall!( 20 SyscallNumber::Input, 21 in InputSyscall::NextEvent, 22 in event.as_mut_ptr(), 23 ); 24 25 event.assume_init().into() 26 } 27} 28 29pub fn set_touch_enabled(enabled: bool) { 30 unsafe { 31 syscall!( 32 SyscallNumber::Input, 33 in InputSyscall::SetTouchEnabled, 34 in enabled, 35 ); 36 } 37} 38 39pub fn has_event() -> bool { 40 let mut has_event: usize; 41 42 unsafe { 43 syscall!( 44 SyscallNumber::Input, 45 out has_event in InputSyscall::HasEvent, 46 ); 47 } 48 49 has_event != 0 50}