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