Struct mfrc522::Mfrc522

source ·
pub struct Mfrc522<COMM: Interface, S: State> { /* private fields */ }
Expand description

MFRC522 driver

Implementations§

source§

impl<COMM: Interface> Mfrc522<COMM, Uninitialized>

source

pub fn new(comm: COMM) -> Self

Create a new MFRC522 driver from the communication interface.

source§

impl<COMM: Interface, S: State> Mfrc522<COMM, S>

source

pub fn release(self) -> COMM

Release the underlying communication channel

source§

impl<E, COMM: Interface<Error = E>> Mfrc522<COMM, Uninitialized>

source

pub fn init(self) -> Result<Mfrc522<COMM, Initialized>, Error<E>>

Initialize the MFRC522.

This needs to be called before you can do any other operation.

source§

impl<E, COMM: Interface<Error = E>> Mfrc522<COMM, Initialized>

source

pub fn reqa(&mut self) -> Result<AtqA, Error<E>>

Sends a REQuest type A to nearby PICCs

source

pub fn wupa(&mut self) -> Result<AtqA, Error<E>>

Sends a Wake UP type A to nearby PICCs

source

pub fn hlta(&mut self) -> Result<(), Error<E>>

Sends command to enter HALT state

source

pub fn select(&mut self, atqa: &AtqA) -> Result<Uid, Error<E>>

Selects a PICC in the READY state

source

pub fn stop_crypto1(&mut self) -> Result<(), Error<E>>

Switch off the MIFARE Crypto1 unit. Must be done after communication with an authenticated PICC

source

pub fn mf_authenticate( &mut self, uid: &Uid, block: u8, key: &MifareKey ) -> Result<(), Error<E>>

source

pub fn mf_read(&mut self, block: u8) -> Result<[u8; 16], Error<E>>

source

pub fn mf_write(&mut self, block: u8, data: [u8; 16]) -> Result<(), Error<E>>

source

pub fn version(&mut self) -> Result<u8, Error<E>>

Returns the version reported by the MFRC522

source

pub fn new_card_present(&mut self) -> Result<AtqA, Error<E>>

Auto Trait Implementations§

§

impl<COMM, S> RefUnwindSafe for Mfrc522<COMM, S>
where COMM: RefUnwindSafe, S: RefUnwindSafe,

§

impl<COMM, S> Send for Mfrc522<COMM, S>
where COMM: Send, S: Send,

§

impl<COMM, S> Sync for Mfrc522<COMM, S>
where COMM: Sync, S: Sync,

§

impl<COMM, S> Unpin for Mfrc522<COMM, S>
where COMM: Unpin, S: Unpin,

§

impl<COMM, S> UnwindSafe for Mfrc522<COMM, S>
where COMM: UnwindSafe, S: UnwindSafe,

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> 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>,

§

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>,

§

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.