Struct rfm69::Rfm69[][src]

pub struct Rfm69<T, S, D> { /* fields omitted */ }

Main struct to interact with RFM69 chip.

Implementations

impl<T, S, D, Ecs, Espi> Rfm69<T, S, D> where
    T: OutputPin<Error = Ecs>,
    S: Transfer<u8, Error = Espi>,
    S: Write<u8, Error = Espi>,
    D: DelayMs<u8>, 
[src]

pub fn new(spi: S, cs: T, delay: D) -> Self[src]

Creates a new instance with everything set to default values after restart.

pub fn read_all_regs(&mut self) -> Result<[u8; 79], Error<Ecs, Espi>>[src]

Reads content of all registers that are available.

pub fn mode(&mut self, mode: Mode) -> Result<(), Error<Ecs, Espi>>[src]

Sets the mode in corresponding register RegOpMode (0x01).

pub fn modulation(
    &mut self,
    modulation: Modulation
) -> Result<(), Error<Ecs, Espi>>
[src]

Sets the modulation in corresponding register RegDataModul (0x02).

pub fn bit_rate(&mut self, bit_rate: f32) -> Result<(), Error<Ecs, Espi>>[src]

Computes the bitrate, according to Fosc / bit_rate and stores it in RegBitrateMsb (0x03), RegBitrateLsb (0x04).

pub fn fdev(&mut self, fdev: f32) -> Result<(), Error<Ecs, Espi>>[src]

Computes the frequency deviation, according to fdev / Fstep and stores it in RegFdevMsb (0x05), RegFdevLsb (0x06).

pub fn frequency(&mut self, frequency: f32) -> Result<(), Error<Ecs, Espi>>[src]

Computes the radio frequency, according to frequency / Fstep and stores it in RegFrfMsb (0x07), RegFrfMid (0x08), RegFrfLsb (0x09).

pub fn dio_mapping(
    &mut self,
    mapping: DioMapping
) -> Result<(), Error<Ecs, Espi>>
[src]

Stores DIO mapping for different RFM69 modes. For DIO behavior between modes please refer to the corresponding table in RFM69 datasheet.

pub fn clear_dio(&mut self, pin: DioPin) -> Result<(), Error<Ecs, Espi>>[src]

Clears stored DIO mapping for specified pin.

pub fn preamble(&mut self, reg: u16) -> Result<(), Error<Ecs, Espi>>[src]

Sets preamble length in corresponding registers RegPreambleMsb (0x2C), RegPreambleLsb (0x2D).

pub fn sync(&mut self, sync: &[u8]) -> Result<(), Error<Ecs, Espi>>[src]

Sets sync config and sync words in RegSyncConfig (0x2E), RegSyncValue1-8(0x2F-0x36). Maximal sync length is 8, pass empty buffer to clear the sync flag.

pub fn packet(
    &mut self,
    packet_config: PacketConfig
) -> Result<(), Error<Ecs, Espi>>
[src]

Sets packet settings in corresponding registers RegPacketConfig1 (0x37), RegPayloadLength (0x38), RegPacketConfig2 (0x3D).

pub fn node_address(&mut self, a: u8) -> Result<(), Error<Ecs, Espi>>[src]

Sets node address in corresponding register RegNodeAdrs (0x39).

pub fn broadcast_address(&mut self, a: u8) -> Result<(), Error<Ecs, Espi>>[src]

Sets broadcast address in corresponding register RegBroadcastAdrs (0x3A).

pub fn fifo_mode(&mut self, mode: FifoMode) -> Result<(), Error<Ecs, Espi>>[src]

Sets FIFO mode in corresponding register RegFifoThresh (0x3C).

pub fn aes(&mut self, key: &[u8]) -> Result<(), Error<Ecs, Espi>>[src]

Sets AES encryption in corresponding registers RegPacketConfig2 (0x3D), RegAesKey1-16 (0x3E-0x4D). The key must be 16 bytes long, pass empty buffer to disable the AES encryption.

pub fn rssi(&self) -> f32[src]

Last RSSI value that was computed during receive.

pub fn recv(&mut self, buffer: &mut [u8]) -> Result<(), Error<Ecs, Espi>>[src]

Receive bytes from another RFM69. This call blocks until there are any bytes available. This can be combined with DIO interrupt for PayloadReady, calling recv immediately after the interrupt should not block.

pub fn recv_large(
    &mut self,
    buffer: &mut [u8]
) -> Result<usize, Error<Ecs, Espi>>
[src]

Receive bytes from another RFM69. This call blocks until there are any bytes available. This can be combined with DIO interrupt for SyncAddressMatch, calling recv_large immediately after the interrupt will not block waiting for packets. It will still block until all data are received. This function is designed to receive packets larger than the FIFO size by reading data from the FIFO as soon as it is available. This can only be used with Variable(255) packet format and node address and CRC filtering disabled. Returns BufferTooSmall and discards the packet if the received length byte is larger than the buffer size.

Note

This function does not detect FIFO overruns.

pub fn send(&mut self, buffer: &[u8]) -> Result<(), Error<Ecs, Espi>>[src]

Send bytes to another RFM69. This can block until all data are send.

pub fn send_large(&mut self, buffer: &[u8]) -> Result<(), Error<Ecs, Espi>>[src]

Send bytes to another RFM69. This will block until all data are send. This function is designed to send packets larger than the FIFO size by writing data as soon as the FIFO is not full anymore. Immediately returns PacketTooLarge if the buffer is longer than 255 bytes.

Note

This function does not detect FIFO underruns.

pub fn is_sync_address_match(&mut self) -> Result<bool, Error<Ecs, Espi>>[src]

Check if IRQ flag SyncAddressMatch is set.

pub fn is_fifo_empty(&mut self) -> Result<bool, Error<Ecs, Espi>>[src]

Check if IRQ flag FifoNotEmpty is cleared.

pub fn is_fifo_full(&mut self) -> Result<bool, Error<Ecs, Espi>>[src]

Check if IRQ flag FifoFull is set.

pub fn is_packet_ready(&mut self) -> Result<bool, Error<Ecs, Espi>>[src]

Check if IRQ flag PacketReady is set.

pub fn lna(&mut self, lna: LnaConfig) -> Result<(), Error<Ecs, Espi>>[src]

Configure LNA in corresponding register RegLna (0x18).

pub fn rssi_threshold(&mut self, threshold: u8) -> Result<(), Error<Ecs, Espi>>[src]

Configure RSSI Threshold in corresponding register RegRssiThresh (0x29).

pub fn sensitivity_boost(
    &mut self,
    boost: SensitivityBoost
) -> Result<(), Error<Ecs, Espi>>
[src]

Configure Sensitivity Boost in corresponding register RegTestLna (0x58).

pub fn pa13_dbm1(&mut self, pa13: Pa13dBm1) -> Result<(), Error<Ecs, Espi>>[src]

Configure Pa13 dBm 1 in corresponding register RegTestPa1 (0x5A).

pub fn pa13_dbm2(&mut self, pa13: Pa13dBm2) -> Result<(), Error<Ecs, Espi>>[src]

Configure Pa13 dBm 2 in corresponding register RegTestPa2 (0x5C).

pub fn continuous_dagc(
    &mut self,
    cdagc: ContinuousDagc
) -> Result<(), Error<Ecs, Espi>>
[src]

Configure Continuous Dagc in corresponding register RegTestDagc (0x6F).

pub fn rx_bw<RxBwT>(
    &mut self,
    rx_bw: RxBw<RxBwT>
) -> Result<(), Error<Ecs, Espi>> where
    RxBwT: RxBwFreq
[src]

Configure Rx Bandwidth in corresponding register RegRxBw (0x19).

pub fn rx_afc_bw<RxBwT>(
    &mut self,
    rx_bw: RxBw<RxBwT>
) -> Result<(), Error<Ecs, Espi>> where
    RxBwT: RxBwFreq
[src]

Configure Rx AFC Bandwidth in corresponding register RegAfcBw (0x1A).

pub fn write(&mut self, reg: Registers, val: u8) -> Result<(), Error<Ecs, Espi>>[src]

Direct write to RFM69 registers.

pub fn write_many(
    &mut self,
    reg: Registers,
    data: &[u8]
) -> Result<(), Error<Ecs, Espi>>
[src]

Direct write to RFM69 registers.

pub fn read(&mut self, reg: Registers) -> Result<u8, Error<Ecs, Espi>>[src]

Direct read from RFM69 registers.

pub fn read_many(
    &mut self,
    reg: Registers,
    buffer: &mut [u8]
) -> Result<(), Error<Ecs, Espi>>
[src]

Direct read from RFM69 registers.

Auto Trait Implementations

impl<T, S, D> RefUnwindSafe for Rfm69<T, S, D> where
    D: RefUnwindSafe,
    S: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<T, S, D> Send for Rfm69<T, S, D> where
    D: Send,
    S: Send,
    T: Send
[src]

impl<T, S, D> Sync for Rfm69<T, S, D> where
    D: Sync,
    S: Sync,
    T: Sync
[src]

impl<T, S, D> Unpin for Rfm69<T, S, D> where
    D: Unpin,
    S: Unpin,
    T: Unpin
[src]

impl<T, S, D> UnwindSafe for Rfm69<T, S, D> where
    D: UnwindSafe,
    S: UnwindSafe,
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.