sdmmc_spi/response.rs
1/// R1 response bitset.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub struct R1Response(pub u8);
4
5impl R1Response {
6 /// In ready state.
7 pub const READY_STATE: R1Response = R1Response(0x00);
8 /// In idle state.
9 pub const IN_IDLE_STATE: R1Response = R1Response(0x01);
10 /// In idle state and illegal command.
11 pub const IN_IDLE_AND_ILLEGAL: R1Response = R1Response(0x01 | 0x04);
12 /// Invalid mask.
13 const INVALID_MASK: u8 = 0x80;
14
15 /// Check if R1 response is valid.
16 pub fn is_valid(&self) -> bool {
17 (self.0 & Self::INVALID_MASK) == 0x00
18 }
19}