Struct radio_sx128x::Sx128x

source ·
pub struct Sx128x<Base> { /* private fields */ }
Expand description

Sx128x device object

Implementations§

source§

impl<Spi, BusyPin, ReadyPin, SdnPin, PinError, Delay> Sx128x<Base<Spi, BusyPin, ReadyPin, SdnPin, Delay>>
where Spi: SpiDevice, <Spi as ErrorType>::Error: Debug, BusyPin: InputPin<Error = PinError>, ReadyPin: InputPin<Error = PinError>, SdnPin: OutputPin<Error = PinError>, PinError: Debug, Delay: DelayNs,

source

pub fn spi( spi: Spi, busy: BusyPin, ready: ReadyPin, sdn: SdnPin, delay: Delay, config: &Config ) -> Result<Self, Error<<Spi as ErrorType>::Error, PinError>>

Create an Sx128x with the provided Spi implementation and pins

source§

impl<Hal> Sx128x<Hal>
where Hal: Hal, <Hal as Hal>::CommsError: Debug + 'static, <Hal as Hal>::PinError: Debug + 'static,

source

pub fn new( hal: Hal, config: &Config ) -> Result<Self, Error<<Hal as Hal>::CommsError, <Hal as Hal>::PinError>>

Create a new Sx128x instance over a generic Hal implementation

source

pub fn reset(&mut self) -> Result<(), <Hal as HalError>::E>

source

pub fn configure(&mut self, config: &Config) -> Result<(), <Hal as HalError>::E>

source

pub fn firmware_version(&mut self) -> Result<u16, <Hal as HalError>::E>

source

pub fn set_frequency(&mut self, f: u32) -> Result<(), <Hal as HalError>::E>

source

pub fn set_irq_mask(&mut self, irq: Irq) -> Result<(), <Hal as HalError>::E>

Set IRQ mask

source

pub fn set_irq_dio_mask( &mut self, irq: Irq, dio1: DioMask, dio2: DioMask, dio3: DioMask ) -> Result<(), <Hal as HalError>::E>

Set the IRQ and DIO masks

source

pub fn calibrate( &mut self, c: CalibrationParams ) -> Result<(), <Hal as HalError>::E>

source

pub fn set_syncword( &mut self, index: u8, value: &[u8] ) -> Result<(), <Hal as HalError>::E>

Set the sychronization mode for a given index (1-3). This is 5-bytes for GFSK mode and 4-bytes for FLRC and BLE modes.

Trait Implementations§

source§

impl<Hal> Busy for Sx128x<Hal>
where Hal: Hal,

radio::Busy implementation for the SX128x

source§

fn is_busy(&mut self) -> Result<bool, Self::Error>

Fetch device state

§

type Error = <Hal as HalError>::E

Radio error type
source§

impl<Hal> Channel for Sx128x<Hal>
where Hal: Hal,

radio::Channel implementation for the SX128x

§

type Channel = Channel

Channel consists of an operating frequency and packet mode

source§

fn set_channel(&mut self, ch: &Self::Channel) -> Result<(), Self::Error>

Set operating channel

§

type Error = <Hal as HalError>::E

Radio error type
source§

impl<Hal> DelayNs for Sx128x<Hal>
where Hal: Hal,

source§

fn delay_ns(&mut self, t: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

impl<Hal> Interrupts for Sx128x<Hal>
where Hal: Hal,

radio::Interrupts implementation for the SX128x

source§

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

Fetch (and optionally clear) current interrupts

§

type Irq = Irq

Interrupt object
§

type Error = <Hal as HalError>::E

Radio error
source§

impl<Hal> Power for Sx128x<Hal>
where Hal: Hal,

radio::Power implementation for the SX128x

source§

fn set_power(&mut self, power: i8) -> Result<(), <Hal as HalError>::E>

Set TX power in dBm

§

type Error = <Hal as HalError>::E

Radio error type
source§

impl<Hal> Receive for Sx128x<Hal>
where Hal: Hal,

radio::Receive implementation for the SX128x

§

type Info = PacketInfo

Receive info structure

§

type Error = <Hal as HalError>::E

RF Error object

source§

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

Start radio in receive mode

source§

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

Check for a received packet

source§

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

Fetch a received packet

source§

impl<Hal> Rssi for Sx128x<Hal>
where Hal: Hal,

radio::Rssi implementation for the SX128x

source§

fn poll_rssi(&mut self) -> Result<i16, <Hal as HalError>::E>

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

§

type Error = <Hal as HalError>::E

Radio error
source§

impl<Hal> State for Sx128x<Hal>
where Hal: Hal,

radio::State implementation for the SX128x

source§

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

Fetch device state

source§

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

Set device state

§

type State = State

Radio state
§

type Error = <Hal as HalError>::E

Radio error type
source§

impl<Hal> Transmit for Sx128x<Hal>
where Hal: Hal,

radio::Transmit implementation for the SX128x

source§

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

Start transmitting a packet

source§

fn check_transmit(&mut self) -> Result<bool, Self::Error>

Check for transmit completion

§

type Error = <Hal as HalError>::E

Radio error

Auto Trait Implementations§

§

impl<Base> Freeze for Sx128x<Base>
where Base: Freeze,

§

impl<Base> RefUnwindSafe for Sx128x<Base>
where Base: RefUnwindSafe,

§

impl<Base> Send for Sx128x<Base>
where Base: Send,

§

impl<Base> Sync for Sx128x<Base>
where Base: Sync,

§

impl<Base> Unpin for Sx128x<Base>
where Base: Unpin,

§

impl<Base> UnwindSafe for Sx128x<Base>
where Base: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T, S, E> BlockingSetState<S, E> for T
where T: State<State = S, Error = E> + DelayNs, S: Debug + PartialEq + Copy, E: Debug,

source§

fn set_state_checked( &mut self, state: S, options: BlockingOptions ) -> Result<(), BlockingError<E>>

source§

impl<T, E> BlockingTransmit<E> for T
where T: Transmit<Error = E> + DelayNs, E: Debug,

source§

fn do_transmit( &mut self, data: &[u8], tx_options: BlockingOptions ) -> Result<(), BlockingError<E>>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.