Skip to main content

Module radios

Module radios 

Source
Expand description

The C ABI for LoRa radio chips.

These functions wrap [pamoja_radios] for callers that drive a radio through the flat C boundary: the bytes of each Semtech SX126x command, the chip’s answers decoded, the amplifier settings a regional power ceiling allows, and the silence a duty-cycle limit forces after each transmission. A caller with its own SPI access sends each command in one transaction, once BUSY is low, and reads a query’s answer in the same transaction.

The SX1276 family is driven through registers rather than commands, so for it these give the register addresses, the values the settings put in them, and the decoded readings.

A command is at most ten bytes, so it crosses by value as PamojaSx126xCommand and costs no allocation. The duty-cycle guard keeps state between calls, so it is a handle.

Structs§

PamojaRadioDutyCycle
An opaque handle to a duty-cycle guard.
PamojaSx126xCommand
The bytes of one SX126x command, in the order the chip receives them.
PamojaSx126xPacketStatus
The signal levels of the last LoRa packet received, in hundredths of a decibel.
PamojaSx126xQuery
A command the chip answers in the same SPI transaction.
PamojaSx126xRxBufferStatus
Where a received payload sits in the data buffer.
PamojaSx126xStatus
A decoded SX126x status byte.
PamojaSx126xTxPower
The amplifier configuration and power setting that produce an output power, from Table 13-21 of the SX1261/2 datasheet.
PamojaSx127xHighBwOptimize
The writes of the SX127x 500 kHz sensitivity erratum.
PamojaSx127xModem
The LoRa modem registers of an SX127x for a link.
PamojaSx127xModemStatus
The live state of an SX127x LoRa modem, from RegModemStat.
PamojaSx127xPacketStatus
The signal levels of a packet an SX127x received, in hundredths of a decibel.
PamojaSx127xSpuriousReception
The receive settings of the SX127x spurious reception erratum.
PamojaSx127xTxPower
The amplifier settings of an SX127x: RegPaConfig, RegPaDac, and RegOcp.

Enums§

PamojaSx126xChipMode
The mode an SX126x reports in its status byte.
PamojaSx126xCommandStatus
How the last command went, as an SX126x reports it in its status byte.

Constants§

PAMOJA_SX126X_COMMAND_MAX
The most bytes one SX126x command takes, opcode included.
PAMOJA_SX126X_ERROR_ADC_CALIBRATION
The device error bit for a failed ADC calibration.
PAMOJA_SX126X_ERROR_IMAGE_CALIBRATION
The device error bit for a failed image calibration.
PAMOJA_SX126X_ERROR_PA_RAMP
The device error bit for a power amplifier that failed to ramp.
PAMOJA_SX126X_ERROR_PLL_CALIBRATION
The device error bit for a failed PLL calibration.
PAMOJA_SX126X_ERROR_PLL_LOCK
The device error bit for a PLL that failed to lock.
PAMOJA_SX126X_ERROR_RC13M_CALIBRATION
The device error bit for a failed RC13M calibration.
PAMOJA_SX126X_ERROR_RC64K_CALIBRATION
The device error bit for a failed RC64k calibration.
PAMOJA_SX126X_ERROR_XOSC_START
The device error bit for a crystal oscillator that failed to start.
PAMOJA_SX126X_IRQ_ALL
Every IRQ bit the chip defines.
PAMOJA_SX126X_IRQ_CAD_DETECTED
The IRQ bit raised when channel activity detection heard LoRa.
PAMOJA_SX126X_IRQ_CAD_DONE
The IRQ bit raised when channel activity detection has finished.
PAMOJA_SX126X_IRQ_CRC_ERROR
The IRQ bit raised when a packet failed its CRC.
PAMOJA_SX126X_IRQ_HEADER_ERROR
The IRQ bit raised when a LoRa header failed its CRC.
PAMOJA_SX126X_IRQ_HEADER_VALID
The IRQ bit raised when a valid LoRa header has been received.
PAMOJA_SX126X_IRQ_LR_FHSS_HOP
The IRQ bit raised at each long-range FHSS hop.
PAMOJA_SX126X_IRQ_PREAMBLE_DETECTED
The IRQ bit raised when a preamble has been detected.
PAMOJA_SX126X_IRQ_RX_DONE
The IRQ bit raised when a packet has been received.
PAMOJA_SX126X_IRQ_SYNC_WORD_VALID
The IRQ bit raised when a valid (G)FSK sync word has been detected.
PAMOJA_SX126X_IRQ_TIMEOUT
The IRQ bit raised when a transmission or reception timed out.
PAMOJA_SX126X_IRQ_TX_DONE
The IRQ bit raised when a packet has been sent.
PAMOJA_SX126X_REGISTER_LORA_SYNC_WORD
The register that holds the most significant byte of the LoRa sync word.
PAMOJA_SX126X_RX_CONTINUOUS
The receive timeout word that keeps an SX126x listening until another command stops it.
PAMOJA_SX126X_SYNC_WORD_PRIVATE
The LoRa sync word of a private network, and the chip’s reset value.
PAMOJA_SX126X_SYNC_WORD_PUBLIC
The LoRa sync word of a public network such as LoRaWAN.
PAMOJA_SX127X_DIO0_CAD_DONE
RegDioMapping1 with DIO0 signaling CadDone.
PAMOJA_SX127X_DIO0_RX_DONE
RegDioMapping1 with DIO0 signaling RxDone.
PAMOJA_SX127X_DIO0_TX_DONE
RegDioMapping1 with DIO0 signaling TxDone.
PAMOJA_SX127X_IMAGE_CAL_RUNNING
The RegImageCal bit set while a calibration runs.
PAMOJA_SX127X_IMAGE_CAL_START
The RegImageCal bit that starts a calibration.
PAMOJA_SX127X_IRQ_ALL
The SX127x interrupt flag: every interrupt, which writing back clears.
PAMOJA_SX127X_IRQ_CAD_DETECTED
The SX127x interrupt flag: channel activity detection heard a LoRa signal.
PAMOJA_SX127X_IRQ_CAD_DONE
The SX127x interrupt flag: channel activity detection finished.
PAMOJA_SX127X_IRQ_FHSS_CHANGE_CHANNEL
The SX127x interrupt flag: frequency hopping moved to the next channel.
PAMOJA_SX127X_IRQ_PAYLOAD_CRC_ERROR
The SX127x interrupt flag: the payload failed its CRC.
PAMOJA_SX127X_IRQ_RX_DONE
The SX127x interrupt flag: a packet has been received.
PAMOJA_SX127X_IRQ_RX_TIMEOUT
The SX127x interrupt flag: a single reception timed out.
PAMOJA_SX127X_IRQ_TX_DONE
The SX127x interrupt flag: the payload has been transmitted.
PAMOJA_SX127X_IRQ_VALID_HEADER
The SX127x interrupt flag: a valid header was received.
PAMOJA_SX127X_LNA_BOOSTED
RegLna with maximum gain and the high frequency LNA boost.
PAMOJA_SX127X_MODE_CAD
The SX127x operating mode code for channel activity detection.
PAMOJA_SX127X_MODE_FS_RX
The SX127x operating mode code for frequency synthesis for receive.
PAMOJA_SX127X_MODE_FS_TX
The SX127x operating mode code for frequency synthesis for transmit.
PAMOJA_SX127X_MODE_RX_CONTINUOUS
The SX127x operating mode code for receive packet after packet.
PAMOJA_SX127X_MODE_RX_SINGLE
The SX127x operating mode code for receive one packet or time out.
PAMOJA_SX127X_MODE_SLEEP
The SX127x operating mode code for sleep, the only mode that may switch between LoRa and FSK.
PAMOJA_SX127X_MODE_STANDBY
The SX127x operating mode code for standby.
PAMOJA_SX127X_MODE_TX
The SX127x operating mode code for transmit one packet.
PAMOJA_SX127X_PA_DAC_DEFAULT
RegPaDac at its reset value.
PAMOJA_SX127X_PA_DAC_HIGH_POWER
RegPaDac with the +20 dBm setting on PA_BOOST.
PAMOJA_SX127X_REG_DETECTION_THRESHOLD
The SX127x register RegDetectionThreshold, the LoRa detection threshold.
PAMOJA_SX127X_REG_DETECT_OPTIMIZE
The SX127x register RegDetectOptimize: the automatic IF and detection optimization.
PAMOJA_SX127X_REG_DIO_MAPPING_1
The SX127x register RegDioMapping1, the events DIO0 to DIO3 signal.
PAMOJA_SX127X_REG_DIO_MAPPING_2
The SX127x register RegDioMapping2, the events DIO4 and DIO5 signal.
PAMOJA_SX127X_REG_FIFO
The SX127x register RegFifo, the LoRa data buffer read or written at RegFifoAddrPtr.
PAMOJA_SX127X_REG_FIFO_ADDR_PTR
The SX127x register RegFifoAddrPtr, where the next RegFifo access lands.
PAMOJA_SX127X_REG_FIFO_RX_BASE_ADDR
The SX127x register RegFifoRxBaseAddr, where received payloads start.
PAMOJA_SX127X_REG_FIFO_RX_CURRENT_ADDR
The SX127x register RegFifoRxCurrentAddr, where the last packet starts.
PAMOJA_SX127X_REG_FIFO_TX_BASE_ADDR
The SX127x register RegFifoTxBaseAddr, where a transmitted payload starts.
PAMOJA_SX127X_REG_FRF_LSB
The SX127x register RegFrfLsb, the low byte of the carrier word.
PAMOJA_SX127X_REG_FRF_MID
The SX127x register RegFrfMid, the middle byte of the carrier word.
PAMOJA_SX127X_REG_FRF_MSB
The SX127x register RegFrfMsb, the top byte of the carrier word.
PAMOJA_SX127X_REG_HIGH_BW_OPTIMIZE_1
The SX127x register RegHighBwOptimize1, which the 500 kHz erratum sets.
PAMOJA_SX127X_REG_HIGH_BW_OPTIMIZE_2
The SX127x register RegHighBwOptimize2, which the 500 kHz erratum sets.
PAMOJA_SX127X_REG_HOP_CHANNEL
The SX127x register RegHopChannel, the PLL lock and the CRC the header announced.
PAMOJA_SX127X_REG_IF_FREQ_1
The SX127x register RegIfFreq1, which the spurious reception erratum clears.
PAMOJA_SX127X_REG_IF_FREQ_2
The SX127x register RegIfFreq2, which the spurious reception erratum sets.
PAMOJA_SX127X_REG_IMAGE_CAL
The SX127x register RegImageCal, at the address of RegInvertIQ2 on the FSK page.
PAMOJA_SX127X_REG_INVERT_IQ
The SX127x register RegInvertIQ, the IQ polarity of each path.
PAMOJA_SX127X_REG_INVERT_IQ_2
The SX127x register RegInvertIQ2, which completes an IQ inversion.
PAMOJA_SX127X_REG_IRQ_FLAGS
The SX127x register RegIrqFlags, the interrupts raised.
PAMOJA_SX127X_REG_IRQ_FLAGS_MASK
The SX127x register RegIrqFlagsMask, the interrupts masked off.
PAMOJA_SX127X_REG_LNA
The SX127x register RegLna, the LNA gain and current.
PAMOJA_SX127X_REG_MAX_PAYLOAD_LENGTH
The SX127x register RegMaxPayloadLength, the longest payload accepted.
PAMOJA_SX127X_REG_MODEM_CONFIG_1
The SX127x register RegModemConfig1: bandwidth, coding rate, and header mode.
PAMOJA_SX127X_REG_MODEM_CONFIG_2
The SX127x register RegModemConfig2: spreading factor, CRC, and the timeout’s top bits.
PAMOJA_SX127X_REG_MODEM_CONFIG_3
The SX127x register RegModemConfig3: low data rate optimization and the AGC.
PAMOJA_SX127X_REG_MODEM_STAT
The SX127x register RegModemStat, the live state of the modem.
PAMOJA_SX127X_REG_OCP
The SX127x register RegOcp, the amplifier current limit.
PAMOJA_SX127X_REG_OP_MODE
The SX127x register RegOpMode: LoRa or FSK, the register page, and the operating mode.
PAMOJA_SX127X_REG_PAYLOAD_LENGTH
The SX127x register RegPayloadLength, the payload length to send.
PAMOJA_SX127X_REG_PA_CONFIG
The SX127x register RegPaConfig: the amplifier output, its maximum, and the power.
PAMOJA_SX127X_REG_PA_DAC
The SX127x register RegPaDac, the +20 dBm setting of PA_BOOST.
PAMOJA_SX127X_REG_PA_RAMP
The SX127x register RegPaRamp, the amplifier ramp time.
PAMOJA_SX127X_REG_PKT_RSSI_VALUE
The SX127x register RegPktRssiValue, the RSSI of the last packet.
PAMOJA_SX127X_REG_PKT_SNR_VALUE
The SX127x register RegPktSnrValue, the SNR of the last packet.
PAMOJA_SX127X_REG_PREAMBLE_LSB
The SX127x register RegPreambleLsb, the low byte of the preamble length.
PAMOJA_SX127X_REG_PREAMBLE_MSB
The SX127x register RegPreambleMsb, the high byte of the preamble length.
PAMOJA_SX127X_REG_RSSI_VALUE
The SX127x register RegRssiValue, the RSSI heard right now.
PAMOJA_SX127X_REG_RSSI_WIDEBAND
The SX127x register RegRssiWideband, a wideband RSSI sample.
PAMOJA_SX127X_REG_RX_NB_BYTES
The SX127x register RegRxNbBytes, the payload length of the last packet.
PAMOJA_SX127X_REG_SYMB_TIMEOUT_LSB
The SX127x register RegSymbTimeoutLsb, the low byte of the symbol timeout.
PAMOJA_SX127X_REG_SYNC_WORD
The SX127x register RegSyncWord, the LoRa sync word.
PAMOJA_SX127X_REG_TCXO
The SX127x register RegTcxo, a crystal or a TCXO on XTA.
PAMOJA_SX127X_REG_VERSION
The SX127x register RegVersion, the silicon revision.
PAMOJA_SX127X_SYNC_WORD_PRIVATE
The private sync word, and the chip’s reset value.
PAMOJA_SX127X_SYNC_WORD_PUBLIC
The sync word the datasheet reserves for LoRaWAN.
PAMOJA_SX127X_TCXO_INPUT_ON
RegTcxo for a module clocked by a TCXO.
PAMOJA_SX127X_VERSION
The RegVersion value of an SX1276, SX1277, SX1278, or SX1279.
PAMOJA_SX127X_WRITE
The bit of an SX127x address byte that makes an access a write.

Functions§

pamoja_radio_duty_cycle_earliest_us⚠
Returns the earliest time the next transmission may start.
pamoja_radio_duty_cycle_free⚠
Releases a duty-cycle guard handle.
pamoja_radio_duty_cycle_new
Creates a duty-cycle guard, ready to transmit at once.
pamoja_radio_duty_cycle_ready⚠
Reports whether a transmission may start now.
pamoja_radio_duty_cycle_transmitted⚠
Records a transmission and the silence it owes.
pamoja_radio_duty_cycle_wait_us⚠
Returns how long the radio must still stay silent.
pamoja_sx126x_calibrate_image
CalibrateImage over a band.
pamoja_sx126x_clear_irq_status
ClearIrqStatus for a set of interrupts.
pamoja_sx126x_device_errors_from_bytes
Decodes a GetDeviceErrors answer.
pamoja_sx126x_frequency_word
Returns the word SetRfFrequency takes for a frequency.
pamoja_sx126x_get_device_errors
GetDeviceErrors, answered by the two device error bytes.
pamoja_sx126x_get_irq_status
GetIrqStatus, answered by the two IRQ bytes.
pamoja_sx126x_get_packet_status
GetPacketStatus, answered by the three LoRa signal level bytes.
pamoja_sx126x_get_rssi_inst
GetRssiInst, answered by the instantaneous RSSI byte.
pamoja_sx126x_get_rx_buffer_status
GetRxBufferStatus, answered by the payload length and its offset.
pamoja_sx126x_get_status
GetStatus, answered by the status byte.
pamoja_sx126x_image_calibration
Returns the two CalibrateImage codes that cover a band.
pamoja_sx126x_irq_from_bytes
Decodes a GetIrqStatus answer.
pamoja_sx126x_llcc68_supports
Reports whether an LLCC68 supports a link’s spreading factor at its bandwidth.
pamoja_sx126x_packet_status_from_bytes
Decodes a LoRa GetPacketStatus answer.
pamoja_sx126x_ramp_time_us
Returns the shortest amplifier ramp time the chip offers that lasts at least a duration.
pamoja_sx126x_read_buffer
ReadBuffer for a run of the data buffer.
pamoja_sx126x_read_register
ReadRegister for consecutive registers.
pamoja_sx126x_rssi_inst_centi_dbm
Decodes a GetRssiInst answer.
pamoja_sx126x_rx_buffer_status_from_bytes
Decodes a GetRxBufferStatus answer.
pamoja_sx126x_set_dio_irq_params
SetDioIrqParams: which interrupts are enabled and which DIO line each raises.
pamoja_sx126x_set_lora_modulation_params⚠
SetModulationParams for a LoRa link.
pamoja_sx126x_set_lora_packet_params
SetPacketParams for a LoRa link and a payload.
pamoja_sx126x_set_pa_config
SetPaConfig for a power setting.
pamoja_sx126x_set_packet_type_lora
SetPacketType for LoRa.
pamoja_sx126x_set_rf_frequency
SetRfFrequency for a carrier frequency.
pamoja_sx126x_set_rx
SetRx with a timeout.
pamoja_sx126x_set_rx_continuous
SetRx in continuous mode, receiving packet after packet until another command.
pamoja_sx126x_set_sleep
SetSleep, without an RTC wake-up.
pamoja_sx126x_set_standby
SetStandby into STDBY_RC.
pamoja_sx126x_set_tx
SetTx with a timeout.
pamoja_sx126x_set_tx_params
SetTxParams for a power setting and a ramp time.
pamoja_sx126x_status_from_byte
Decodes a status byte.
pamoja_sx126x_timeout_steps
Returns the 24-bit timeout word SetTx and SetRx take for a duration.
pamoja_sx126x_tx_power_for_output
Chooses the amplifier settings for an output power.
pamoja_sx126x_tx_power_under_ceiling
Chooses the amplifier settings that keep a link’s EIRP at or under a ceiling.
pamoja_sx126x_write_buffer_header
The start of a WriteBuffer transaction; the payload follows it in the same transaction.
pamoja_sx126x_write_register_header
The start of a WriteRegister transaction; the register values follow it in the same transaction.
pamoja_sx127x_automatic_if
Returns RegDetectOptimize with AutomaticIFOn set or clear.
pamoja_sx127x_frequency_from_word
Returns the frequency an SX127x RegFrf word selects.
pamoja_sx127x_frequency_word
Returns the 24-bit RegFrf word an SX127x takes for a frequency.
pamoja_sx127x_fsk_op_mode
Returns the RegOpMode value for an FSK operating mode, which image calibration needs.
pamoja_sx127x_high_bw_optimize⚠
Returns the writes of the 500 kHz sensitivity erratum for a link at a carrier.
pamoja_sx127x_image_cal_start
Returns RegImageCal to start a calibration.
pamoja_sx127x_invert_iq
Returns RegInvertIQ for the IQ polarity of each path.
pamoja_sx127x_invert_iq_2
Returns RegInvertIQ2 for the path in use.
pamoja_sx127x_lora_op_mode
Returns the RegOpMode value for a LoRa operating mode.
pamoja_sx127x_mode_from_op_mode
Returns the operating mode a RegOpMode value holds.
pamoja_sx127x_modem⚠
Returns the LoRa modem registers for a link at a carrier.
pamoja_sx127x_modem_status_from_byte
Decodes RegModemStat.
pamoja_sx127x_ocp_register
Returns RegOcp for a current limit.
pamoja_sx127x_packet_status_from_bytes
Decodes RegPktSnrValue and RegPktRssiValue.
pamoja_sx127x_read_address
Returns the SX127x address byte that reads a register.
pamoja_sx127x_rssi_centi_dbm
Decodes RegRssiValue.
pamoja_sx127x_spurious_reception⚠
Returns the receive settings of the spurious reception erratum for a link.
pamoja_sx127x_symbol_timeout
Returns the SX127x single reception timeout for a duration, in the link’s symbols.
pamoja_sx127x_tx_power_for_output
Returns the SX127x amplifier settings for an output power.
pamoja_sx127x_tx_power_under_ceiling
Returns the SX127x amplifier settings that keep a link’s EIRP at or under a ceiling.
pamoja_sx127x_write_address
Returns the SX127x address byte that writes a register.