firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
1use eepy_serial::{Event, SerialCommand};
2use crate::{Error, HostApp, Serial};
3
4impl Serial<HostApp> {
5 pub fn set_touch_enabled(&mut self, enabled: bool) -> Result<(), Error> {
6 let cmd = if enabled { SerialCommand::EnableTouch } else { SerialCommand::DisableTouch };
7 self.write(cmd, &[])
8 }
9
10 pub fn next_event(&mut self) -> Result<Option<Event>, Error> {
11 self.write(SerialCommand::NextEvent, &[])?;
12 let mut event_buf = [0u8; 32];
13 self.port.read(&mut event_buf)?;
14 Ok(postcard::from_bytes(&event_buf)?)
15 }
16}