ft6336u_driver/ft6336u/error.rs
1//! Error types for the FT6336U driver.
2//!
3//! This module defines the error types that can occur during
4//! communication with the touch controller.
5
6/// Errors that can occur during FT6336U operations
7///
8/// # Examples
9///
10/// ```rust
11/// use ft6336u_driver::Error;
12///
13/// // The error type is generic over the I2C error type
14/// let err: Error<()> = Error::InvalidData;
15/// ```
16#[derive(Debug)]
17pub enum Error<E> {
18 /// I2C communication error
19 I2c(E),
20 /// Invalid data received from device
21 InvalidData,
22}
23
24impl<E> From<E> for Error<E> {
25 fn from(e: E) -> Self {
26 Self::I2c(e)
27 }
28}