Skip to content

Commit 62a882c

Browse files
committed
touchscreen: Allow turning touch on and off
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 7267f46 commit 62a882c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

framework_lib/src/touchscreen.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ pub trait TouchScreen {
130130

131131
Some(())
132132
}
133+
134+
fn enable_touch(&self, enable: bool) -> Option<()> {
135+
self.send_message(0x38, 0, vec![0, !enable as u8])?;
136+
Some(())
137+
}
133138
}
134139

135140
pub fn print_touchscreen_fw_ver() -> Option<()> {
@@ -140,3 +145,12 @@ pub fn print_touchscreen_fw_ver() -> Option<()> {
140145

141146
device.check_fw_version()
142147
}
148+
149+
pub fn enable_touch(enable: bool) -> Option<()> {
150+
#[cfg(target_os = "windows")]
151+
let device = touchscreen_win::NativeWinTouchScreen::open_device()?;
152+
#[cfg(not(target_os = "windows"))]
153+
let device = HidapiTouchScreen::open_device()?;
154+
155+
device.enable_touch(enable)
156+
}

0 commit comments

Comments
 (0)