Trait embedded_nrf24l01::Device
[−]
[src]
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
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>
&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>
&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,
F: FnOnce(&mut Config) -> R,
Modify the (cached) CONFIG
register and write if it has changed.
Provided Methods
fn with_ce_disabled<F, R>(&mut self, f: F) -> R where
F: FnOnce(&mut Self) -> R,
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,
Reg: Register + PartialEq + Clone,
F: FnOnce(&mut Reg) -> R,
Read, and modify a register, and write it back if it has been changed.