[][src]Struct radio_sx127x::Sx127x

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

Sx127x device object

Operating functions are implemented as traits from the radio package

Methods

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

pub fn fsk_configure(
    &mut self,
    config: &FskConfig,
    channel: &FskChannel
) -> Result<(), Error<CommsError, PinError>>
[src]

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

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

Configure the radio in lora mode with the provided configuration and channel

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,
    config: &Config
) -> 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,
    config: &Config
) -> Result<Self, Error<CommsError, PinError>>
[src]

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

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

(re)apply device configuration

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

Fetch device silicon version

impl<Base, CommsError, PinError> Sx127x<Base, CommsError, PinError> 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)

Trait Implementations

impl<Base, CommsError, PinError> DelayMs<u32> for Sx127x<Base, CommsError, PinError> where
    Base: Base<CommsError, PinError>, 
[src]

impl<Base, CommsError, PinError> Transmit for Sx127x<Base, CommsError, PinError> where
    Base: Base<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> Power for Sx127x<Base, CommsError, PinError> where
    Base: Base<CommsError, PinError>, 
[src]

type Error = Error<CommsError, PinError>

Radio error type

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

Set transmit power (using the existing PaConfig)

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

type Info = PacketInfo

Packet received info

type Error = Error<CommsError, PinError>

Radio error

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

Start receive mode

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> State for Sx127x<Base, CommsError, PinError> 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> where
    Base: Base<CommsError, PinError>, 
[src]

type Channel = Channel

Channel information

type Error = Error<CommsError, PinError>

Radio error type

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

Set the LoRa mode channel for future receive or transmit operations

impl<Base, CommsError, PinError> Rssi for Sx127x<Base, CommsError, PinError> where
    Base: Base<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> where
    Base: Base<CommsError, PinError>, 
[src]

type Irq = Interrupts

Interrupt object

type Error = Error<CommsError, PinError>

Radio error

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

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

Auto Trait Implementations

impl<Base, CommsError, PinError> Unpin for Sx127x<Base, CommsError, PinError> where
    Base: Unpin,
    CommsError: Unpin,
    PinError: Unpin

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

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

impl<Base, CommsError, PinError> UnwindSafe for Sx127x<Base, CommsError, PinError> where
    Base: UnwindSafe,
    CommsError: UnwindSafe,
    PinError: UnwindSafe

impl<Base, CommsError, PinError> RefUnwindSafe for Sx127x<Base, CommsError, PinError> where
    Base: RefUnwindSafe,
    CommsError: RefUnwindSafe,
    PinError: RefUnwindSafe

Blanket Implementations

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

impl<T, E> BlockingTransmit<E> for T where
    E: Debug,
    T: Transmit<Error = E> + Power<Error = E> + DelayMs<u32>, 
[src]

impl<T, I, E> BlockingReceive<I, E> for T where
    E: Debug,
    I: Debug,
    T: Receive<Info = I, Error = E> + DelayMs<u32>, 
[src]