[][src]Struct radio_sx127x::Sx127x

pub struct Sx127x<Base, CommsError, PinError, Config> { /* fields omitted */ }

Sx127x device object

Operating functions are implemented as traits from the radio package

Methods

impl<Base, CommsError, PinError> Sx127x<Base, CommsError, PinError, LoRaConfig> where
    Base: Sx127xBase<CommsError, PinError>, 
[src]

pub fn configure(
    &mut self,
    config: &LoRaConfig
) -> Result<(), Error<CommsError, PinError>>
[src]

Configure the radio in lora mode with the provided configuration

impl<Spi, CommsError, Output, Input, PinError, Delay> Sx127x<SpiWrapper<Spi, CommsError, Output, Input, PinError, Delay>, CommsError, PinError, ()> where
    Spi: Transfer<u8, Error = CommsError> + Write<u8, Error = CommsError>,
    Output: OutputPin<Error = PinError>,
    Input: InputPin<Error = PinError>,
    Delay: DelayMs<u32>, 
[src]

pub fn spi(
    spi: Spi,
    cs: Output,
    busy: Input,
    sdn: Output,
    delay: Delay,
    settings: Settings
) -> Result<Self, Error<CommsError, PinError>>
[src]

Create an Sx127x with the provided SPI implementation and pins

impl<Base, CommsError, PinError> Sx127x<Base, CommsError, PinError, ()> where
    Base: Base<CommsError, PinError>, 
[src]

pub fn new(
    hal: Base,
    settings: Settings
) -> Result<Self, Error<CommsError, PinError>>
[src]

Create a new radio instance over an arbitrary base::Base implementation

pub fn lora(
    self,
    lora_config: LoRaConfig
) -> Result<Sx127x<Base, CommsError, PinError, LoRaConfig>, Error<CommsError, PinError>>
[src]

Configure the modem into LoRa mode

impl<Base, CommsError, PinError, Config> Sx127x<Base, CommsError, PinError, Config> where
    Base: Base<CommsError, PinError>, 
[src]

pub fn read_reg<R>(&mut self, reg: R) -> Result<u8, Error<CommsError, PinError>> where
    R: Copy + Clone + Into<u8>, 
[src]

Read a u8 value from the specified register

pub fn write_reg<R>(
    &mut self,
    reg: R,
    value: u8
) -> Result<(), Error<CommsError, PinError>> where
    R: Copy + Clone + Into<u8>, 
[src]

Write a u8 value to the specified register

pub fn update_reg<R>(
    &mut self,
    reg: R,
    mask: u8,
    value: u8
) -> Result<u8, Error<CommsError, PinError>> where
    R: Copy + Clone + Into<u8>, 
[src]

Update the specified register with the provided (value & mask)

impl<Base, CommsError, PinError, Config> Sx127x<Base, CommsError, PinError, Config> where
    Base: Base<CommsError, PinError>, 
[src]

pub fn silicon_version(&mut self) -> Result<u8, Error<CommsError, PinError>>[src]

Fetch device silicon version

Trait Implementations

impl<Base, CommsError, PinError> Transmit for Sx127x<Base, CommsError, PinError, LoRaConfig> where
    Base: Sx127xBase<CommsError, PinError>, 
[src]

type Error = Error<CommsError, PinError>

Radio error

fn start_transmit(&mut self, data: &[u8]) -> Result<(), Self::Error>[src]

Start sending a packet

fn check_transmit(&mut self) -> Result<bool, Error<CommsError, PinError>>[src]

Check for transmission completion This method should be polled (or checked following and interrupt) to indicate sending has completed

impl<Base, CommsError, PinError> Receive for Sx127x<Base, CommsError, PinError, LoRaConfig> where
    Base: Sx127xBase<CommsError, PinError>, 
[src]

type Info = Info

Packet received info

type Error = Error<CommsError, PinError>

Radio error

fn check_receive(&mut self, restart: bool) -> Result<bool, Self::Error>[src]

Check receive state

This returns true if a boolean indicating whether a packet has been received. The restart option specifies whether transient timeout or CRC errors should be internally handled (returning Ok(false)) or passed back to the caller as errors.

fn get_received(
    &mut self,
    info: &mut Self::Info,
    data: &mut [u8]
) -> Result<usize, Self::Error>
[src]

Fetch a received message

This copies data into the provided slice, updates the provided information object, and returns the number of bytes received on success

impl<Base, CommsError, PinError, Config> State for Sx127x<Base, CommsError, PinError, Config> where
    Base: Base<CommsError, PinError>, 
[src]

type State = State

Channel information

type Error = Error<CommsError, PinError>

Radio error type

fn get_state(&mut self) -> Result<Self::State, Self::Error>[src]

Fetch device state

fn set_state(&mut self, state: Self::State) -> Result<(), Self::Error>[src]

Set device state

impl<Base, CommsError, PinError> Channel for Sx127x<Base, CommsError, PinError, LoRaConfig> where
    Base: Sx127xBase<CommsError, PinError>, 
[src]

type Channel = Channel

Channel information

type Error = Error<CommsError, PinError>

Radio error type

fn set_channel(
    &mut self,
    channel: &Channel
) -> Result<(), Error<CommsError, PinError>>
[src]

Set the LoRa mode channel for future receive or transmit operations

impl<Base, CommsError, PinError> Power for Sx127x<Base, CommsError, PinError, LoRaConfig> where
    Base: Sx127xBase<CommsError, PinError>, 
[src]

type Error = Error<CommsError, PinError>

Radio error type

fn set_power(&mut self, power: i8) -> Result<(), Error<CommsError, PinError>>[src]

Set LoRa mode transmit power

impl<Base, CommsError, PinError> Rssi for Sx127x<Base, CommsError, PinError, LoRaConfig> where
    Base: Sx127xBase<CommsError, PinError>, 
[src]

type Error = Error<CommsError, PinError>

Radio error

fn poll_rssi(&mut self) -> Result<i16, Error<CommsError, PinError>>[src]

Poll for the current channel RSSI This should only be called in receive mode

impl<Base, CommsError, PinError> Interrupts for Sx127x<Base, CommsError, PinError, LoRaConfig> where
    Base: Sx127xBase<CommsError, PinError>, 
[src]

type Irq = Irq

Interrupt object

type Error = Error<CommsError, PinError>

Radio error

fn get_interrupts(&mut self, clear: bool) -> Result<Self::Irq, Self::Error>[src]

Fetch pending LoRa mode interrupts from the device If the clear option is set, this will also clear any pending flags

Auto Trait Implementations

impl<Base, CommsError, PinError, Config> Send for Sx127x<Base, CommsError, PinError, Config> where
    Base: Send,
    CommsError: Send,
    Config: Send,
    PinError: Send

impl<Base, CommsError, PinError, Config> Sync for Sx127x<Base, CommsError, PinError, Config> where
    Base: Sync,
    CommsError: Sync,
    Config: Sync,
    PinError: Sync

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

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

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