[][src]Trait embedded_nrf24l01::Device

pub trait Device {
    type Error;
    fn ce_enable(&mut self);
fn ce_disable(&mut self);
fn send_command<C: Command>(
        &mut self,
        command: &C
    ) -> Result<(Status, C::Response), Self::Error>;
fn write_register<R: Register>(
        &mut self,
        register: R
    ) -> Result<Status, Self::Error>;
fn read_register<R: Register>(&mut self) -> Result<(Status, R), Self::Error>;
fn update_config<F, R>(&mut self, f: F) -> Result<R, Self::Error>
    where
        F: FnOnce(&mut Config) -> R
; fn with_ce_disabled<F, R>(&mut self, f: F) -> R
    where
        F: FnOnce(&mut Self) -> R
, { ... }
fn update_register<Reg, F, R>(&mut self, f: F) -> Result<R, Self::Error>
    where
        Reg: Register + PartialEq + Clone,
        F: FnOnce(&mut Reg) -> R
, { ... } }

Trait that hides all the GPIO/SPI type parameters for use by the operation modes

Associated Types

type Error

Error from the SPI implementation

Loading content...

Required methods

fn ce_enable(&mut self)

Set CE pin high

fn ce_disable(&mut self)

Set CE pin low

fn send_command<C: Command>(
    &mut self,
    command: &C
) -> Result<(Status, C::Response), Self::Error>

Send a command via SPI

fn write_register<R: Register>(
    &mut self,
    register: R
) -> Result<Status, Self::Error>

Send W_REGISTER command

fn read_register<R: Register>(&mut self) -> Result<(Status, R), Self::Error>

Send R_REGISTER command

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.

Loading content...

Provided methods

fn with_ce_disabled<F, R>(&mut self, f: F) -> R where
    F: FnOnce(&mut Self) -> R, 

Helper; the receiving during RX and sending during TX require CE to be low.

fn update_register<Reg, F, R>(&mut self, f: F) -> Result<R, Self::Error> where
    Reg: Register + PartialEq + Clone,
    F: FnOnce(&mut Reg) -> R, 

Read, and modify a register, and write it back if it has been changed.

Loading content...

Implementors

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>[src]

type Error = Error<SPIE>

Loading content...