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

Configure Feed

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

1#![no_std] 2 3#[cfg(all(target_os = "none", target_arch = "arm"))] 4pub mod header; 5#[cfg(all(target_os = "none", target_arch = "arm"))] 6pub mod syscall; 7#[cfg(all(target_os = "none", target_arch = "arm"))] 8pub mod misc; 9#[cfg(all(target_os = "none", target_arch = "arm"))] 10pub mod image; 11#[cfg(all(target_os = "none", target_arch = "arm"))] 12pub mod input; 13#[cfg(all(target_os = "none", target_arch = "arm"))] 14pub mod usb; 15#[cfg(all(target_os = "none", target_arch = "arm"))] 16pub mod exec; 17#[cfg(all(target_os = "none", target_arch = "arm"))] 18pub mod critical_section; 19#[cfg(all(target_os = "none", target_arch = "arm"))] 20pub mod flash; 21pub mod input_common; 22 23 24#[cfg(feature = "critical-section-impl")] 25#[cfg(all(target_os = "none", target_arch = "arm"))] 26mod critical_section_impl; 27 28pub use tp370pgh01::IMAGE_BYTES; 29 30/// FFI-safe version of the standard `Option` type. 31/// 32/// Convert to/from a standard `Option` using `.into()`. 33#[repr(C)] 34#[derive(Copy, Clone, Debug, Eq, PartialEq)] 35#[cfg_attr(feature = "defmt", derive(defmt::Format))] 36pub enum SafeOption<T> { 37 None, 38 Some(T), 39} 40 41impl<T> From<Option<T>> for SafeOption<T> { 42 fn from(value: Option<T>) -> Self { 43 match value { 44 None => SafeOption::None, 45 Some(v) => SafeOption::Some(v), 46 } 47 } 48} 49 50impl<T> From<SafeOption<T>> for Option<T> { 51 fn from(value: SafeOption<T>) -> Self { 52 match value { 53 SafeOption::None => None, 54 SafeOption::Some(v) => Some(v), 55 } 56 } 57} 58 59#[repr(C)] 60#[derive(Copy, Clone, Debug, Eq, PartialEq)] 61#[cfg_attr(feature = "defmt", derive(defmt::Format))] 62pub enum SafeResult<T, E> { 63 Ok(T), 64 Err(E), 65} 66 67impl<T, E> From<SafeResult<T, E>> for Result<T, E> { 68 fn from(value: SafeResult<T, E>) -> Self { 69 match value { 70 SafeResult::Ok(v) => Ok(v), 71 SafeResult::Err(e) => Err(e), 72 } 73 } 74} 75 76impl<T, E> From<Result<T, E>> for SafeResult<T, E> { 77 fn from(value: Result<T, E>) -> Self { 78 match value { 79 Ok(v) => SafeResult::Ok(v), 80 Err(e) => SafeResult::Err(e), 81 } 82 } 83}