pub struct NRF24L01<E: Debug, CE: OutputPin<Error = E>, CSN: OutputPin<Error = E>, SPI: SpiTransfer<u8>> { /* private fields */ }Expand description
Driver for the nRF24L01+
Never deal with this directly. Instead, you store one of the following types:
where D: Device
Implementations§
Source§impl<E: Debug, CE: OutputPin<Error = E>, CSN: OutputPin<Error = E>, SPI: SpiTransfer<u8, Error = SPIE>, SPIE: Debug> NRF24L01<E, CE, CSN, SPI>
impl<E: Debug, CE: OutputPin<Error = E>, CSN: OutputPin<Error = E>, SPI: SpiTransfer<u8, Error = SPIE>, SPIE: Debug> NRF24L01<E, CE, CSN, SPI>
Sourcepub fn new(ce: CE, csn: CSN, spi: SPI) -> Result<StandbyMode<Self>, Error<SPIE>>
pub fn new(ce: CE, csn: CSN, spi: SPI) -> Result<StandbyMode<Self>, Error<SPIE>>
Construct a new driver instance.
Sourcepub fn is_connected(&mut self) -> Result<bool, Error<SPIE>>
pub fn is_connected(&mut self) -> Result<bool, Error<SPIE>>
Reads and validates content of the SETUP_AW register.
Trait Implementations§
Source§impl<E: Debug, CE: OutputPin<Error = E>, CSN: OutputPin<Error = E>, SPI: SpiTransfer<u8, Error = SPIE>, SPIE: Debug> Debug for NRF24L01<E, CE, CSN, SPI>
impl<E: Debug, CE: OutputPin<Error = E>, CSN: OutputPin<Error = E>, SPI: SpiTransfer<u8, Error = SPIE>, SPIE: Debug> Debug for NRF24L01<E, CE, CSN, SPI>
Source§impl<E: Debug, CE: OutputPin<Error = E>, CSN: OutputPin<Error = E>, SPI: SpiTransfer<u8, Error = SPIE>, SPIE: Debug> Device for NRF24L01<E, CE, CSN, SPI>
impl<E: Debug, CE: OutputPin<Error = E>, CSN: OutputPin<Error = E>, SPI: SpiTransfer<u8, Error = SPIE>, SPIE: Debug> Device for NRF24L01<E, CE, CSN, SPI>
Source§fn ce_disable(&mut self)
fn ce_disable(&mut self)
Set CE pin low
Source§fn send_command<C: Command>(
&mut self,
command: &C,
) -> Result<(Status, C::Response), Self::Error>
fn send_command<C: Command>( &mut self, command: &C, ) -> Result<(Status, C::Response), Self::Error>
Send a command via SPI
Source§fn write_register<R: Register>(
&mut self,
register: R,
) -> Result<Status, Self::Error>
fn write_register<R: Register>( &mut self, register: R, ) -> Result<Status, Self::Error>
Send
W_REGISTER commandSource§fn read_register<R: Register>(&mut self) -> Result<(Status, R), Self::Error>
fn read_register<R: Register>(&mut self) -> Result<(Status, R), Self::Error>
Send
R_REGISTER commandSource§fn update_config<F, R>(&mut self, f: F) -> Result<R, Self::Error>where
F: FnOnce(&mut Config) -> R,
fn update_config<F, R>(&mut self, f: F) -> Result<R, Self::Error>where
F: FnOnce(&mut Config) -> R,
Modify the (cached)
CONFIG register and write if it has changed.Source§fn with_ce_disabled<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
fn with_ce_disabled<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
Helper; the receiving during RX and sending during TX require
CE
to be low.Auto Trait Implementations§
impl<E, CE, CSN, SPI> Freeze for NRF24L01<E, CE, CSN, SPI>
impl<E, CE, CSN, SPI> RefUnwindSafe for NRF24L01<E, CE, CSN, SPI>
impl<E, CE, CSN, SPI> Send for NRF24L01<E, CE, CSN, SPI>
impl<E, CE, CSN, SPI> Sync for NRF24L01<E, CE, CSN, SPI>
impl<E, CE, CSN, SPI> Unpin for NRF24L01<E, CE, CSN, SPI>
impl<E, CE, CSN, SPI> UnwindSafe for NRF24L01<E, CE, CSN, SPI>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more