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§
- Pamoja
Radio Duty Cycle - An opaque handle to a duty-cycle guard.
- Pamoja
Sx126x Command - The bytes of one SX126x command, in the order the chip receives them.
- Pamoja
Sx126x Packet Status - The signal levels of the last LoRa packet received, in hundredths of a decibel.
- Pamoja
Sx126x Query - A command the chip answers in the same SPI transaction.
- Pamoja
Sx126x RxBuffer Status - Where a received payload sits in the data buffer.
- Pamoja
Sx126x Status - A decoded SX126x status byte.
- Pamoja
Sx126x TxPower - The amplifier configuration and power setting that produce an output power, from Table 13-21 of the SX1261/2 datasheet.
- Pamoja
Sx127x High BwOptimize - The writes of the SX127x 500 kHz sensitivity erratum.
- Pamoja
Sx127x Modem - The LoRa modem registers of an SX127x for a link.
- Pamoja
Sx127x Modem Status - The live state of an SX127x LoRa modem, from RegModemStat.
- Pamoja
Sx127x Packet Status - The signal levels of a packet an SX127x received, in hundredths of a decibel.
- Pamoja
Sx127x Spurious Reception - The receive settings of the SX127x spurious reception erratum.
- Pamoja
Sx127x TxPower - The amplifier settings of an SX127x: RegPaConfig, RegPaDac, and RegOcp.
Enums§
- Pamoja
Sx126x Chip Mode - The mode an SX126x reports in its status byte.
- Pamoja
Sx126x Command Status - 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.