use core::fmt::Debug;
use embedded_storage_async::nor_flash::{NorFlashError, NorFlashErrorKind};
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Debug, Clone, Copy)]
pub enum Error<SpiError> {
Spi(SpiError),
Value,
OutOfBounds,
NotAligned,
Busy,
}
impl<SpiError: Debug> NorFlashError for Error<SpiError> {
fn kind(&self) -> NorFlashErrorKind {
match self {
Error::Spi(_) => NorFlashErrorKind::Other,
Error::Value => NorFlashErrorKind::Other,
Error::OutOfBounds => NorFlashErrorKind::OutOfBounds,
Error::NotAligned => NorFlashErrorKind::NotAligned,
Error::Busy => NorFlashErrorKind::Other,
}
}
}