Struct R2

Source
#[repr(C)]
pub struct R2(/* private fields */);
Expand description

Represents the response to the SEND_STATUS command in SPI mode.

Implementations§

Source§

impl R2

Source

pub const fn bits(&self) -> u16

Gets the bit value for R2.

Source

pub const fn out_of_range(&self) -> bool

Getter for out_of_range field of R2.

An out-of-range access was attempted.

Source

pub fn set_out_of_range(&mut self, val: bool)

Setter for out_of_range field of R2.

An out-of-range access was attempted.

Source

pub const fn erase_param(&self) -> bool

Getter for erase_param field of R2.

An invalid sector for erase.

Source

pub fn set_erase_param(&mut self, val: bool)

Setter for erase_param field of R2.

An invalid sector for erase.

Source

pub const fn wp_violation(&self) -> bool

Getter for wp_violation field of R2.

An attempt was made to write to a write-protected block.

Source

pub fn set_wp_violation(&mut self, val: bool)

Setter for wp_violation field of R2.

An attempt was made to write to a write-protected block.

Source

pub const fn card_ecc_failed(&self) -> bool

Getter for card_ecc_failed field of R2.

Internal card ECC failed to correct data error.

Source

pub fn set_card_ecc_failed(&mut self, val: bool)

Setter for card_ecc_failed field of R2.

Internal card ECC failed to correct data error.

Source

pub const fn cc_error(&self) -> bool

Getter for cc_error field of R2.

Internal card control error.

Source

pub fn set_cc_error(&mut self, val: bool)

Setter for cc_error field of R2.

Internal card control error.

Source

pub const fn error(&self) -> bool

Getter for error field of R2.

A general or unknown error occurred.

Source

pub fn set_error(&mut self, val: bool)

Setter for error field of R2.

A general or unknown error occurred.

Source

pub const fn lock_failed(&self) -> bool

Getter for lock_failed field of R2.

Card lock/unlock failed, or write-protect erase skip

Source

pub fn set_lock_failed(&mut self, val: bool)

Setter for lock_failed field of R2.

Card lock/unlock failed, or write-protect erase skip

Source

pub const fn card_locked(&self) -> bool

Getter for card_locked field of R2.

SD card is locked.

Source

pub fn set_card_locked(&mut self, val: bool)

Setter for card_locked field of R2.

SD card is locked.

Source§

impl R2

Source

pub const fn response_type(&self) -> ResponseType

Gets the response type for the R2.

Source

pub const fn response_mode(&self) -> ResponseMode

Gets the response mode for the R2.

Source§

impl R2

Source

pub const LEN: usize = 2usize

Represents the byte length of the R2.

Source

pub const DEFAULT: u16 = 0u16

Represents the default value of the R2.

Source

pub const fn new() -> Self

Creates a new R2.

Source

pub const fn r1(&self) -> Result<R1>

Gets the R1 portion of the R2 response.

Source

pub fn set_r1(&mut self, r1: R1)

Sets the R1 portion of the R2 response.

Source

pub const fn with_r1(self, r1: R1) -> Self

Builder function that sets the R1 portion of the R2 response.

Source

pub const fn try_from_bits(val: u16) -> Result<Self>

Attempts to convert a u16 into a R2.

Source

pub const fn bytes(&self) -> [u8; 2]

Converts the R2 into a byte array.

Source

pub const fn try_from_bytes(val: &[u8]) -> Result<Self>

Attempts to convert a byte slice into a R2.

Trait Implementations§

Source§

impl Clone for R2

Source§

fn clone(&self) -> R2

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for R2

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for R2

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<R2> for [u8; 2]

Source§

fn from(val: R2) -> Self

Converts to this type from the input type.
Source§

impl From<R2> for Response

Source§

fn from(val: R2) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for R2

Source§

fn eq(&self, other: &R2) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&[u8]> for R2

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(val: &[u8]) -> Result<Self>

Performs the conversion.
Source§

impl<const N: usize> TryFrom<&[u8; N]> for R2

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(val: &[u8; N]) -> Result<Self>

Performs the conversion.
Source§

impl<const N: usize> TryFrom<[u8; N]> for R2

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(val: [u8; N]) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Response> for R2

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(val: Response) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<u16> for R2

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(val: u16) -> Result<Self>

Performs the conversion.
Source§

impl Copy for R2

Source§

impl Eq for R2

Source§

impl StructuralPartialEq for R2

Auto Trait Implementations§

§

impl Freeze for R2

§

impl RefUnwindSafe for R2

§

impl Send for R2

§

impl Sync for R2

§

impl Unpin for R2

§

impl UnwindSafe for R2

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.