[][src]Trait embedded_nrf24l01::Configuration

pub trait Configuration {
    type Inner: Device;
    fn device(&mut self) -> &mut Self::Inner;

    fn flush_rx(&mut self) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn flush_tx(&mut self) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn get_frequency(&mut self) -> Result<u8, <Self::Inner as Device>::Error> { ... }
fn set_frequency(
        &mut self,
        freq_offset: u8
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_rf(
        &mut self,
        rate: &DataRate,
        power: u8
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_crc(
        &mut self,
        mode: CrcMode
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_interrupt_mask(
        &mut self,
        data_ready_rx: bool,
        data_sent_tx: bool,
        max_retransmits_tx: bool
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_pipes_rx_enable(
        &mut self,
        bools: &[bool; 6]
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_rx_addr(
        &mut self,
        pipe_no: usize,
        addr: &[u8]
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_tx_addr(
        &mut self,
        addr: &[u8]
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_auto_retransmit(
        &mut self,
        delay: u8,
        count: u8
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn get_auto_ack(
        &mut self
    ) -> Result<[bool; 6], <Self::Inner as Device>::Error> { ... }
fn set_auto_ack(
        &mut self,
        bools: &[bool; 6]
    ) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn get_address_width(
        &mut self
    ) -> Result<u8, <Self::Inner as Device>::Error> { ... }
fn get_interrupts(
        &mut self
    ) -> Result<(bool, bool, bool), <Self::Inner as Device>::Error> { ... }
fn clear_interrupts(&mut self) -> Result<(), <Self::Inner as Device>::Error> { ... }
fn set_pipes_rx_lengths(
        &mut self,
        lengths: &[Option<u8>; 6]
    ) -> Result<(), <Self::Inner as Device>::Error> { ... } }

Configuration methods

These seem to work in all modes

Associated Types

type Inner: Device

Underlying trait Device

Loading content...

Required methods

fn device(&mut self) -> &mut Self::Inner

Get a mutable reference to the underlying device

Loading content...

Provided methods

fn flush_rx(&mut self) -> Result<(), <Self::Inner as Device>::Error>

Flush RX queue

Discards all received packets that have not yet been read from the RX FIFO

fn flush_tx(&mut self) -> Result<(), <Self::Inner as Device>::Error>

Flush TX queue, discarding any unsent packets

fn get_frequency(&mut self) -> Result<u8, <Self::Inner as Device>::Error>

Get frequency offset (channel)

fn set_frequency(
    &mut self,
    freq_offset: u8
) -> Result<(), <Self::Inner as Device>::Error>

Set frequency offset (channel)

fn set_rf(
    &mut self,
    rate: &DataRate,
    power: u8
) -> Result<(), <Self::Inner as Device>::Error>

power: 0: -18 dBm, 3: 0 dBm

fn set_crc(
    &mut self,
    mode: CrcMode
) -> Result<(), <Self::Inner as Device>::Error>

Set CRC mode

fn set_interrupt_mask(
    &mut self,
    data_ready_rx: bool,
    data_sent_tx: bool,
    max_retransmits_tx: bool
) -> Result<(), <Self::Inner as Device>::Error>

Sets the interrupt mask

When an interrupt mask is set to true, the interrupt is masked and will not fire on the IRQ pin. When set to false, it will trigger the IRQ pin.

fn set_pipes_rx_enable(
    &mut self,
    bools: &[bool; 6]
) -> Result<(), <Self::Inner as Device>::Error>

Configure which RX pipes to enable

fn set_rx_addr(
    &mut self,
    pipe_no: usize,
    addr: &[u8]
) -> Result<(), <Self::Inner as Device>::Error>

Set address addr of pipe number pipe_no

fn set_tx_addr(
    &mut self,
    addr: &[u8]
) -> Result<(), <Self::Inner as Device>::Error>

Set address of the TX pipe

fn set_auto_retransmit(
    &mut self,
    delay: u8,
    count: u8
) -> Result<(), <Self::Inner as Device>::Error>

Configure auto-retransmit

To disable, call as set_auto_retransmit(0, 0).

fn get_auto_ack(&mut self) -> Result<[bool; 6], <Self::Inner as Device>::Error>

Obtain auto-acknowledgment configuration for all pipes

fn set_auto_ack(
    &mut self,
    bools: &[bool; 6]
) -> Result<(), <Self::Inner as Device>::Error>

Configure auto-acknowledgment for all RX pipes

TODO: handle switching tx/rx modes when auto-retransmit is enabled

fn get_address_width(&mut self) -> Result<u8, <Self::Inner as Device>::Error>

Get address width configuration

fn get_interrupts(
    &mut self
) -> Result<(bool, bool, bool), <Self::Inner as Device>::Error>

Obtain interrupt pending status as (RX_DR, TX_DR, MAX_RT) where RX_DR indicates new data in the RX FIFO, TX_DR indicates that a packet has been sent, and MAX_RT indicates maximum retransmissions without auto-ack.

fn clear_interrupts(&mut self) -> Result<(), <Self::Inner as Device>::Error>

Clear all interrupts

fn set_pipes_rx_lengths(
    &mut self,
    lengths: &[Option<u8>; 6]
) -> Result<(), <Self::Inner as Device>::Error>

bools

  • None: Dynamic payload length
  • Some(len): Static payload length len
Loading content...

Implementors

impl<D: Device> Configuration for RxMode<D>[src]

type Inner = D

impl<D: Device> Configuration for StandbyMode<D>[src]

type Inner = D

impl<D: Device> Configuration for TxMode<D>[src]

type Inner = D

Loading content...