rsiot/components/cmp_linux_spi_master/
error.rs1use crate::{components::shared_tasks, components_config::master_device, executor::ComponentError};
2
3use super::COMPONENT_NAME;
4
5#[allow(missing_docs)]
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error("CmpOutput: {0}")]
9 CmpOutput(ComponentError),
10
11 #[error("FnOutput: {0}")]
12 FnInput(anyhow::Error),
13
14 #[error("FnOutput: {0}")]
15 FnOutput(anyhow::Error),
16
17 #[error("TokioTaskJoin: {0}")]
18 TokioTaskJoin(#[from] tokio::task::JoinError),
19
20 #[error("TokioSyncMpsc")]
21 TokioSyncMpsc,
22
23 #[error(transparent)]
24 TaskMpscToMsgBus(shared_tasks::mpsc_to_msgbus::Error),
25
26 #[error(transparent)]
27 TaskFilter(shared_tasks::filter_identical_data::Error),
28
29 #[error(transparent)]
30 TaskMsgbusToBroadcast(shared_tasks::msgbus_to_broadcast::Error),
31
32 #[error(transparent)]
33 DeviceError(#[from] master_device::Error),
34
35 #[error("{COMPONENT_NAME} | CS number {cs} not availbalve; amount of configured CS: {max_cs}")]
36 CsNotAvailable { cs: u8, max_cs: u8 },
37
38 #[error("{COMPONENT_NAME} | GpioSetup: {0}")]
39 GpioSetup(linux_embedded_hal::gpio_cdev::Error),
40
41 #[error("{COMPONENT_NAME} | GpioPinSet: {0}")]
42 GpioPinSet(linux_embedded_hal::gpio_cdev::Error),
43
44 #[error("{COMPONENT_NAME} | SpidevConfigure: {0}")]
45 SpidevConfigure(std::io::Error),
46
47 #[error("{COMPONENT_NAME} | SpidevOpen: {0}")]
48 SpidevOpen(std::io::Error),
49
50 #[error("{COMPONENT_NAME} | SpidevTransfer: {0}")]
51 SpidevTransfer(std::io::Error),
52}
53
54impl From<Error> for ComponentError {
55 fn from(value: Error) -> Self {
56 ComponentError::Execution(value.to_string())
57 }
58}