firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
1#![no_std]
2
3pub mod header;
4pub mod syscall;
5pub mod misc;
6pub mod image;
7pub mod input;
8pub mod usb;
9pub mod exec;
10
11pub use tp370pgh01::IMAGE_BYTES;
12
13/// FFI-safe version of the standard `Option` type.
14///
15/// Convert to/from a standard `Option` using `.into()`.
16#[repr(C)]
17#[derive(Copy, Clone, Debug, Eq, PartialEq)]
18#[cfg_attr(feature = "defmt", derive(defmt::Format))]
19pub enum SafeOption<T> {
20 None,
21 Some(T),
22}
23
24impl<T> From<Option<T>> for SafeOption<T> {
25 fn from(value: Option<T>) -> Self {
26 match value {
27 None => SafeOption::None,
28 Some(v) => SafeOption::Some(v),
29 }
30 }
31}
32
33impl<T> From<SafeOption<T>> for Option<T> {
34 fn from(value: SafeOption<T>) -> Self {
35 match value {
36 SafeOption::None => None,
37 SafeOption::Some(v) => Some(v),
38 }
39 }
40}