Skip to main content

Module command

Module command 

Source
Expand description

The SX126x command set: opcodes and the bytes each command sends.

A command is an opcode followed by its parameters, multi-byte values most significant byte first, framed by NSS in a single SPI transaction, as chapter 10 of the SX1261/2 datasheet describes. Command holds the bytes of one command without allocating, and the builders here fill it from typed parameters. A command that answers comes as a Query: the bytes to send, then how many bytes to read back while NSS stays low. WriteRegister and WriteBuffer send a header built here, then their data, in the same transaction.

Modules§

opcode
The opcodes of Tables 11-1 to 11-5.

Structs§

Command
The bytes of one command.
Query
A command that the chip answers in the same transaction.

Constants§

CALIBRATE_ALL
The calibration parameter that recalibrates every block, from Table 13-18.
MAX_LEN
The longest command the builders produce, in bytes.
NOP
The byte a host sends while it clocks an answer back.

Functions§

calibrate
Calibrate: recalibrates blocks of the chip, from Table 13-18.
calibrate_image
CalibrateImage: calibrates image rejection over a band.
clear_device_errors
ClearDeviceErrors: clears every recorded error.
clear_irq_status
ClearIrqStatus: clears interrupts.
get_device_errors
GetDeviceErrors: reads the recorded errors.
get_irq_status
GetIrqStatus: reads the pending interrupts.
get_packet_status
GetPacketStatus: reads the signal levels of the last packet.
get_packet_type
GetPacketType: reads the selected modem.
get_rssi_inst
GetRssiInst: reads the instantaneous RSSI while receiving.
get_rx_buffer_status
GetRxBufferStatus: reads where the last payload sits.
get_stats
GetStats: reads the packet counters.
get_status
GetStatus: reads the status byte.
read_buffer
ReadBuffer: reads the data buffer.
read_register
ReadRegister: reads consecutive registers.
reset_stats
ResetStats: zeroes the packet counters, an opcode and six zero bytes.
set_buffer_base_address
SetBufferBaseAddress: sets where transmit and receive data start in the buffer.
set_cad
SetCad: starts channel activity detection.
set_cad_params
SetCadParams: configures channel activity detection, from Table 13-71.
set_dio2_as_rf_switch
SetDIO2AsRfSwitchCtrl: lets DIO2 drive an RF switch, high in TX.
set_dio3_as_tcxo
SetDIO3AsTcxoCtrl: powers a TCXO from DIO3.
set_dio_irq_params
SetDioIrqParams: enables interrupts and routes them to the DIO lines.
set_fs
SetFs: puts the chip in frequency synthesis mode.
set_lora_modulation_params
SetModulationParams, for LoRa.
set_lora_packet_params
SetPacketParams, for LoRa.
set_lora_symbol_timeout
SetLoRaSymbNumTimeout: sets how many symbols confirm a detected packet.
set_pa_config
SetPaConfig: configures the power amplifier.
set_packet_type
SetPacketType: selects the modem, the first command of any configuration.
set_regulator_mode
SetRegulatorMode: selects the LDO or the DC-DC converter.
set_rf_frequency
SetRfFrequency: tunes the synthesizer.
set_rx
SetRx: starts receiving.
set_rx_duty_cycle
SetRxDutyCycle: alternates the chip between listening and sleeping.
set_rx_tx_fallback_mode
SetRxTxFallbackMode: chooses the mode the chip returns to after a packet.
set_sleep
SetSleep: puts the chip to sleep, from Table 13-2.
set_standby
SetStandby: puts the chip in a standby mode.
set_tx
SetTx: starts a transmission.
set_tx_continuous_wave
SetTxContinuousWave: transmits an unmodulated carrier, a test command.
set_tx_infinite_preamble
SetTxInfinitePreamble: transmits preamble symbols without end, a test command.
set_tx_params
SetTxParams: sets the output power and the ramp time.
stop_timer_on_preamble
StopTimerOnPreamble: chooses what stops the receive timeout.
write_buffer
The header of WriteBuffer; the payload follows in the same transaction.
write_register
The header of WriteRegister; the register bytes follow in the same transaction.