Skip to main content

Chain

Enum Chain 

Source
pub enum Chain {
    A,
    B,
}
Expand description

Which of the two transmit chains a packet goes out on.

Variants§

§

A

The first chain.

§

B

The second chain.

Implementations§

Source§

impl Chain

Source

pub const fn buffer(&self) -> u16

Where this chain keeps the payload it is about to send.

§Returns

The address the first payload byte is written to.

§Examples
use pamoja_radios::sx1302::tx::Chain;

assert_eq!(Chain::A.buffer(), 0x5300);
assert_eq!(Chain::B.buffer(), 0x5500);
Source

pub const fn base(&self) -> u16

The block of registers that belong to this chain.

§Returns

The base address the chain’s registers are offsets from.

Source

pub const fn write_buffer(&self) -> Register

The control that hands this chain’s buffer to the host to write.

§Returns

The register, set before the payload is written and cleared after it.

Source

pub const fn status(&self) -> Register

Where the chain reports what it is doing.

§Returns

The register TxStatus::of reads.

Source

pub const fn trigger(&self, trigger: Trigger) -> Register

The bit that starts a send of this kind.

§Arguments
  • trigger - what the send waits for.
§Returns

The register, which is cleared and then set to arm it.

§Examples
use pamoja_radios::sx1302::tx::{Chain, Trigger};

// All three share a byte and differ only in which bit they are.
let immediate = Chain::A.trigger(Trigger::Immediate);
let gps = Chain::A.trigger(Trigger::OnGps);
assert_eq!(immediate.address, gps.address);
assert_eq!((immediate.offset, gps.offset), (0, 2));
Source

pub const fn timer_byte(&self, index: u8) -> Register

One of the four bytes a timed send is programmed across.

The bytes run backward: the least significant sits at the highest address. So index zero is the first byte trigger_bytes hands back, and each one after it is written an address lower.

§Arguments
  • index - which byte, from zero to three. Anything higher is clamped to three.
§Returns

The register that byte is written to.

§Examples
use pamoja_radios::sx1302::tx::{trigger_bytes, Chain};

let bytes = trigger_bytes(0x1234_5678);
// The least significant byte goes to the highest of the four addresses.
assert_eq!(bytes[0], 0x78);
assert!(Chain::A.timer_byte(0).address > Chain::A.timer_byte(3).address);
Source

pub const fn start_delay_msb(&self) -> Register

The high byte of the delay the chain starts early by.

§Returns

The register the first of start_delay_bytes is written to.

Source

pub const fn start_delay_lsb(&self) -> Register

The low byte of that delay.

§Returns

The register the second of start_delay_bytes is written to.

Source

pub const fn modulation_type(&self) -> Register

Which modulator the chain runs.

§Returns

The register that takes MODULATION_LORA or MODULATION_FSK.

Source

pub const fn if_source(&self) -> Register

Where the modulator takes its samples from.

§Returns

The register that takes IF_SOURCE_LORA or IF_SOURCE_FSK. This is what parts LoRa from an unmodulated carrier, since both name the same modulator.

Source

pub const fn agc_bandwidth(&self) -> Register

The bandwidth the gain control works the transmission out against.

§Returns

The register that takes what bandwidth_value gives.

Source

pub const fn power(&self) -> Register

The power the chain transmits at.

§Returns

The register that takes what Gain::power_value gives, which is the amplifier and the power index together rather than a number of decibels.

Source

pub const fn digital_gain(&self) -> Register

The digital gain applied before the front end.

§Returns

The register.

Source

pub const fn offset_i(&self) -> Register

The calibrated offset of the in-phase channel.

§Returns

The register.

Source

pub const fn offset_q(&self) -> Register

The calibrated offset of the quadrature channel.

§Returns

The register.

Source

pub const fn frequency_byte(&self, index: u8) -> Register

One byte of the carrier the chain transmits on, most significant first.

§Arguments
  • index - which byte, 0 to 2. Anything higher is taken as 2.
§Returns

The register that byte of frequency_value is written to.

Source

pub const fn deviation_msb(&self) -> Register

The high bits of the frequency deviation, which is four bits rather than eight.

§Returns

The register.

Source

pub const fn deviation_lsb(&self) -> Register

The low bits of it.

§Returns

The register.

Source

pub const fn bandwidth(&self) -> Register

The bandwidth the modulator runs at.

§Returns

The register, which shares a byte with the spreading factor.

Source

pub const fn spreading_factor(&self) -> Register

The spreading factor it runs at.

§Returns

The register, which is the factor itself rather than an index.

Source

pub const fn header_control(&self) -> Register

Whether the header carries the low data rate setting.

§Returns

The register, which the reference leaves at zero.

Source

pub const fn ppm_offset(&self) -> Register

Whether low data rate optimization is on.

§Returns

The register. A symbol longer than sixteen milliseconds needs it, and the airtime assumes it, so the two have to agree.

Source

pub const fn coding_rate(&self) -> Register

The coding rate it runs at.

§Returns

The register, which takes the denominator less four.

Source

pub const fn fine_sync(&self) -> Register

Whether the fine synchronization the two lowest spreading factors need is on.

§Returns

The register.

Source

pub const fn modem_enable(&self) -> Register

Whether the modulator runs at all.

§Returns

The register.

Source

pub const fn cad_rx_tx(&self) -> Register

Which of listening, transmitting and channel activity detection the modem does.

§Returns

The register, which takes CAD_RX_TX_TRANSMIT for a send.

Source

pub const fn implicit_header(&self) -> Register

Whether the packet goes out without a header.

§Returns

The register.

Source

pub const fn crc_enable(&self) -> Register

Whether the packet carries a physical layer checksum.

§Returns

The register. A LoRaWAN downlink goes out without one.

Source

pub const fn payload_length(&self) -> Register

How many bytes the packet carries.

§Returns

The register.

Source

pub const fn modem_start(&self) -> Register

The bit that starts the modulator once it is configured.

§Returns

The register.

Source

pub const fn preamble_lsb(&self) -> Register

The low bits of the preamble length, in symbols.

§Returns

The register.

Source

pub const fn preamble_msb(&self) -> Register

The high bits of it.

§Returns

The register.

Source

pub const fn chirp_lowpass(&self) -> Register

How hard the chirp is filtered, which the start delay is worked from.

§Returns

The register.

Source

pub const fn continuous_chirp(&self) -> Register

Whether the chirp runs continuously.

§Returns

The register.

Source

pub const fn chirp_invert(&self) -> Register

Whether the chirp sweeps downward, which a LoRaWAN downlink does.

§Returns

The register.

Source

pub const fn continuous(&self) -> Register

Whether the chain transmits continuously rather than one packet.

§Returns

The register.

Source

pub const fn sync_peak1(&self) -> Register

Where the first sync symbol goes, which says which network the packet belongs to.

§Returns

The register. It powers up holding the private position, as the receive side does.

Source

pub const fn sync_peak2(&self) -> Register

Where the second one goes.

§Returns

The register.

Trait Implementations§

Source§

impl Clone for Chain

Source§

fn clone(&self) -> Chain

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Chain

Source§

impl Debug for Chain

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Chain

Source§

impl PartialEq for Chain

Source§

fn eq(&self, other: &Chain) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Chain

Auto Trait Implementations§

§

impl Freeze for Chain

§

impl RefUnwindSafe for Chain

§

impl Send for Chain

§

impl Sync for Chain

§

impl Unpin for Chain

§

impl UnsafeUnpin for Chain

§

impl UnwindSafe for Chain

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.