pub struct NRF24L01<E: Debug, CE: OutputPin<Error = E>, SPI: SpiDevice<u8>> {
pub spi: SPI,
/* private fields */
}
Expand description
Driver for the nRF24L01+
Never deal with this directly. Instead, you store one of the following types:
where D:
Device
Fields§
§spi: SPI
核心对象spi
Implementations§
Source§impl<E: Debug, CE: OutputPin<Error = E>, SPI: SpiDevice<u8, Error = SPIE>, SPIE: Debug> NRF24L01<E, CE, SPI>
impl<E: Debug, CE: OutputPin<Error = E>, SPI: SpiDevice<u8, Error = SPIE>, SPIE: Debug> NRF24L01<E, CE, SPI>
Sourcepub async fn new(ce: CE, spi: SPI) -> Result<StandbyMode<Self>, Error<SPIE>>
pub async fn new(ce: CE, spi: SPI) -> Result<StandbyMode<Self>, Error<SPIE>>
Construct a new driver instance.
Sourcepub async fn is_connected(&mut self) -> Result<bool, Error<SPIE>>
pub async 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>, SPI: SpiDevice<u8, Error = SPIE>, SPIE: Debug> Debug for NRF24L01<E, CE, SPI>
impl<E: Debug, CE: OutputPin<Error = E>, SPI: SpiDevice<u8, Error = SPIE>, SPIE: Debug> Debug for NRF24L01<E, CE, SPI>
Source§impl<E: Debug, CE: OutputPin<Error = E>, SPI: SpiDevice<u8, Error = SPIE>, SPIE: Debug> Device for NRF24L01<E, CE, SPI>
impl<E: Debug, CE: OutputPin<Error = E>, SPI: SpiDevice<u8, Error = SPIE>, SPIE: Debug> Device for NRF24L01<E, CE, SPI>
Source§fn ce_disable(&mut self)
fn ce_disable(&mut self)
Set CE pin low
Source§async fn send_command<C: Command>(
&mut self,
command: &C,
) -> Result<(Status, C::Response), Self::Error>
async fn send_command<C: Command>( &mut self, command: &C, ) -> Result<(Status, C::Response), Self::Error>
Send a command via SPI
Source§async fn write_register<R: Register>(
&mut self,
register: R,
) -> Result<Status, Self::Error>
async fn write_register<R: Register>( &mut self, register: R, ) -> Result<Status, Self::Error>
Send
W_REGISTER
commandSource§async fn read_register<R: Register>(
&mut self,
) -> Result<(Status, R), Self::Error>
async fn read_register<R: Register>( &mut self, ) -> Result<(Status, R), Self::Error>
Send
R_REGISTER
commandSource§async fn update_config<F, R>(&mut self, f: F) -> Result<R, Self::Error>where
F: FnOnce(&mut Config) -> R,
async 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, SPI> Freeze for NRF24L01<E, CE, SPI>
impl<E, CE, SPI> RefUnwindSafe for NRF24L01<E, CE, SPI>where
CE: RefUnwindSafe,
SPI: RefUnwindSafe,
impl<E, CE, SPI> Send for NRF24L01<E, CE, SPI>
impl<E, CE, SPI> Sync for NRF24L01<E, CE, SPI>
impl<E, CE, SPI> Unpin for NRF24L01<E, CE, SPI>
impl<E, CE, SPI> UnwindSafe for NRF24L01<E, CE, SPI>where
CE: UnwindSafe,
SPI: UnwindSafe,
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