[−][src]Struct sx127x_lora::LoRa
Provides high-level access to Semtech SX1276/77/78/79 based boards connected to a Raspberry Pi
Fields
explicit_header: bool
mode: RadioMode
Methods
impl<SPI, CS, RESET, DELAY, E> LoRa<SPI, CS, RESET, DELAY> where
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin,
RESET: OutputPin,
DELAY: DelayMs<u8>,
[src]
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin,
RESET: OutputPin,
DELAY: DelayMs<u8>,
pub fn new(
spi: SPI,
cs: CS,
reset: RESET,
frequency: i64,
delay: DELAY
) -> Result<Self, Error<E, CS::Error, RESET::Error>>
[src]
spi: SPI,
cs: CS,
reset: RESET,
frequency: i64,
delay: DELAY
) -> Result<Self, Error<E, CS::Error, RESET::Error>>
Builds and returns a new instance of the radio. Only one instance of the radio should exist at a time. This also preforms a hardware reset of the module and then puts it in standby.
pub fn transmit_payload_busy(
&mut self,
buffer: [u8; 255],
payload_size: usize
) -> Result<usize, Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
buffer: [u8; 255],
payload_size: usize
) -> Result<usize, Error<E, CS::Error, RESET::Error>>
Transmits up to 255 bytes of data. To avoid the use of an allocator, this takes a fixed 255 u8 array and a payload size and returns the number of bytes sent if successful.
pub fn set_dio0_tx_done(
&mut self
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<(), Error<E, CS::Error, RESET::Error>>
pub fn transmit_payload(
&mut self,
buffer: [u8; 255],
payload_size: usize
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
buffer: [u8; 255],
payload_size: usize
) -> Result<(), Error<E, CS::Error, RESET::Error>>
pub fn poll_irq(
&mut self,
timeout_ms: Option<i32>
) -> Result<usize, Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
timeout_ms: Option<i32>
) -> Result<usize, Error<E, CS::Error, RESET::Error>>
Blocks the current thread, returning the size of a packet if one is received or an error is the
task timed out. The timeout can be supplied with None to make it poll indefinitely or
with Some(timeout_in_mill_seconds)
pub fn read_packet(
&mut self
) -> Result<[u8; 255], Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<[u8; 255], Error<E, CS::Error, RESET::Error>>
Returns the contents of the fifo as a fixed 255 u8 array. This should only be called is there is a new packet ready to be read.
pub fn transmitting(
&mut self
) -> Result<bool, Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<bool, Error<E, CS::Error, RESET::Error>>
Returns true if the radio is currently transmitting a packet.
pub fn clear_irq(&mut self) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
Clears the radio's IRQ registers.
pub fn set_tx_power(
&mut self,
level: i32,
output_pin: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
level: i32,
output_pin: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the transmit power and pin. Levels can range from 0-14 when the output
pin = 0(RFO), and form 0-20 when output pin = 1(PaBoost). Power is in dB.
Default value is 17
.
pub fn set_ocp(
&mut self,
ma: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
ma: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the over current protection on the radio(mA).
pub fn set_mode(
&mut self,
mode: RadioMode
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
mode: RadioMode
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the state of the radio. Default mode after initiation is Standby
.
pub fn set_frequency(
&mut self,
freq: i64
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
freq: i64
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the frequency of the radio. Values are in megahertz. I.E. 915 MHz must be used for North America. Check regulation for your area.
pub fn set_spreading_factor(
&mut self,
sf: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
sf: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the spreading factor of the radio. Supported values are between 6 and 12.
If a spreading factor of 6 is set, implicit header mode must be used to transmit
and receive packets. Default value is 7
.
pub fn set_signal_bandwidth(
&mut self,
sbw: i64
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
sbw: i64
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the signal bandwidth of the radio. Supported values are: 7800 Hz
, 10400 Hz
,
15600 Hz
, 20800 Hz
, 31250 Hz
,41700 Hz
,62500 Hz
,125000 Hz
and 250000 Hz
Default value is 125000 Hz
pub fn set_coding_rate_4(
&mut self,
denominator: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
denominator: u8
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the coding rate of the radio with the numerator fixed at 4. Supported values
are between 5
and 8
, these correspond to coding rates of 4/5
and 4/8
.
Default value is 5
.
pub fn set_preamble_length(
&mut self,
length: i64
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
length: i64
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Sets the preamble length of the radio. Values are between 6 and 65535.
Default value is 8
.
pub fn set_crc(
&mut self,
value: bool
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
value: bool
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Enables are disables the radio's CRC check. Default value is false
.
pub fn set_invert_iq(
&mut self,
value: bool
) -> Result<(), Error<E, CS::Error, RESET::Error>>
[src]
&mut self,
value: bool
) -> Result<(), Error<E, CS::Error, RESET::Error>>
Inverts the radio's IQ signals. Default value is false
.
pub fn get_spreading_factor(
&mut self
) -> Result<u8, Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<u8, Error<E, CS::Error, RESET::Error>>
Returns the spreading factor of the radio.
pub fn get_signal_bandwidth(
&mut self
) -> Result<i64, Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<i64, Error<E, CS::Error, RESET::Error>>
Returns the signal bandwidth of the radio.
pub fn get_packet_rssi(
&mut self
) -> Result<i32, Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<i32, Error<E, CS::Error, RESET::Error>>
Returns the RSSI of the last received packet.
pub fn get_packet_snr(
&mut self
) -> Result<f64, Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<f64, Error<E, CS::Error, RESET::Error>>
Returns the signal to noise radio of the the last received packet.
pub fn get_packet_frequency_error(
&mut self
) -> Result<i64, Error<E, CS::Error, RESET::Error>>
[src]
&mut self
) -> Result<i64, Error<E, CS::Error, RESET::Error>>
Returns the frequency error of the last received packet in Hz.
Auto Trait Implementations
impl<SPI, CS, RESET, DELAY> Send for LoRa<SPI, CS, RESET, DELAY> where
CS: Send,
DELAY: Send,
RESET: Send,
SPI: Send,
CS: Send,
DELAY: Send,
RESET: Send,
SPI: Send,
impl<SPI, CS, RESET, DELAY> Sync for LoRa<SPI, CS, RESET, DELAY> where
CS: Sync,
DELAY: Sync,
RESET: Sync,
SPI: Sync,
CS: Sync,
DELAY: Sync,
RESET: Sync,
SPI: Sync,
impl<SPI, CS, RESET, DELAY> Unpin for LoRa<SPI, CS, RESET, DELAY> where
CS: Unpin,
DELAY: Unpin,
RESET: Unpin,
SPI: Unpin,
CS: Unpin,
DELAY: Unpin,
RESET: Unpin,
SPI: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,