Package: jetson-SX126X
jetson-SX126XSemtech SX126X LoRa driver for Jetson TX2.This library is ported and modified frommicropySX126Xby ehong-tl.Constructors (Similar for SX1261 and SX1268)classsx1262.SX1262(cs, irq, rst, gpio, device='/dev/spidev3.0', baudrate=2000000)Create and initialize SX1262 object.The parameters are:cs : NSS pinirq : DIO1 pinrst : RESET pingpio : BUSY pindevice : spidev device pathbaudrate : SPI bus baud rateMethods (Similar for SX1261 and SX1268)GeneralSX1262.setFrequency(freq)Set frequency in MHz.Return: Status (Refer toConstantsStatus dictionary)SX1262.setOutputPower(power)Set TX power in dBm.Return: StatusSX1262.setBlockingCallback(blocking, callback=None)Set TX/RX blocking mode and interrupt callback.If blocking = True, TX/RX is set to blocking mode and callback function will be ignored.If blocking = False, TX/RX is set to non blocking mode and callback function will be triggered with events argument upon TX/RX events.If callback = None, events callback function will be disabled.SX1262.getRSSI()Get RX RSSI in dBm.Return: RSSI valueSX1262.getTimeOnAir(len)Get RX time on air according to message length, len = message length.Return: Time on air valueSX1262.send(data)Send message, data type must be bytes or bytearray.Return: Payload length, statusSX1262.recv(len=0, timeout_en=False, timeout_ms=0)Read RX message.len = Message length, if 0, default to SX126X_MAX_PACKET_LENGTHtimeout_en = Enable RX timeout, if False, function blocking indefinitely until message received (Only in blocking mode)timeout_ms = RX timeout in ms, 0 means timeout = 100 LoRa symbols length for LoRa or timeout = 500% expected time-on-air for FSK  (Only in blocking mode)Return: Payload, statusLoRaSX1262.begin(freq=434.0, bw=125.0, sf=9, cr=7, syncWord=0x12, power=14, currentLimit=60.0preambleLength=8, implicit=False, implicitLen=0xFF, crcOn=True, txIq=False, rxIq=False,tcxoVoltage=1.6, useRegulatorLDO=False, blocking=True)This method is used to set LoRa configuration.The parameters are:freq : Frequency in MHzbw : Bandwidth in kHzsf : Spreading factor, 5 to 12cr : Coding rate, 5 to 8syncWord : Sync word, private = 0x12, public = 0x34power : TX power in dBmcurrentLimit : Current limit in mApreambleLength : Preamble lengthimplicit : Implicit or explicit header, implicit = TrueimplicitLen : Implicit header payload lengthcrcOn : CRC on or offtxIq : TX invert IQrxIq : RX invert IQtcxoVoltage : TCXO input voltage in VuseRegulatorLDO : Use LDO regulator = True, use DC-DC regulator = Falseblocking : Blocking TX/RX = True, non blocking TX/RX = FalseReturn: StatusSX1262.setBandwidth(bw)Set LoRa bandwidth in kHz.Return: StatusSX1262.setCodingRate(cr)Set LoRa coding rate, 5 to 8.Return: StatusSX1262.setPreambleLength(preambleLength)Set LoRa preamble length.Return: StatusSX1262.setSpreadingFactor(sf)Set LoRa spreading factor, 5 to 12.Return: StatusSX1262.setSyncWord(syncWord, [controlBits])Set LoRa sync word, private = 0x12, public = 0x34.Optional parameter controlBits, default value is 0x44.e.g. syncWord = 0xAB, controlBits = 0xCD -> SX126x 2 bytes sync word = 0xACBDe.g. syncWord = 0x12, controlBits = 0x44 -> SX126x 2 bytes sync word = 0x1424Return: StatusSX1262.explicitHeader()Enable LoRa explicit header mode.Return: StatusSX1262.implicitHeader(implicitLen)Enable LoRa implicit header mode with implicit length parameter.Return: StatusSX1262.forceLDRO(enable)Force enable Low Data Rate Optimization.Return: StatusSX1262.autoLDRO()Enable auto Low Data Rate Optimization.Return: StatusSX1262.setCRC(crcOn)Set LoRa CRC mode.Return: StatusSX1262.setTxIq(txIq)Set LoRa TX invert IQ mode.SX1262.setRxIq(rxIq)Set LoRa RX invert IQ mode.SX1262.getSNR()Get LoRa RX SNR in dB.Return: SNR valueFSKSX1262.beginFSK(freq=434.0, br=48.0, freqDev=50.0, rxBw=156.2, power=14, currentLimit=60.0,preambleLength=16, dataShaping=0.5, syncWord=[0x2D, 0x01], syncBitsLength=16,addrFilter=SX1262.ADDR_FILT_OFF, addr=0x00, crcLength=2, crcInitial=0x1D0F, crcPolynomial=0x1021,crcInverted=True, whiteningOn=True, whiteningInitial=0x0100,fixedPacketLength=False, packetLength=0xFF, preambleDetectorLength=SX1262.PREAMBLE_DETECT_16,tcxoVoltage=1.6, useRegulatorLDO=False,blocking=True)This method is used to set FSK configuration.The parameters are:freq : Frequency in MHzbr : Bit rate in kbpsfreqDev : Frequency deviation in kHzrxBW : RX bandwidth in kHzpower : TX power in dBmcurrentLimit : Current limit in mApreambleLength : Preamble lengthdataShaping : Time-bandwidth product of the Gaussian filter to be used for shapingsyncWord : Sync wordsyncBitsLength : Sync word length in bitaddrFilter : Address filtering, refer toConstantsFSK address filteringaddr : Address for address filteringcrcLength : CRC length, 0, 1 or 2crcInitial: CRC initial valuecrcPolynomial : Polynomial for CRC calculationcrcInverted : Invert CRC byteswhiteningOn : Enable whiteningwhiteningInitial : Initial value used for whitening LFSRfixedPacketLength : Enable fixed packet length modepacketLength : Packet length in bytes (fixed packet length mode) or maximum packet length in bytes (variable packet length mode)preambleDetectorLength : Minimum preamble detection length, refer toConstantsFSK preamble detector lengthtcxoVoltage : TCXO input voltage in VuseRegulatorLDO : Use LDO regulator = True, use DC-DC regulator = Falseblocking : Blocking TX/RX = True, non blocking TX/RX = FalseReturn: StatusSX1262.setBitRate(br)Set FSK bit rate in kbps.Return: StatusSX1262.setFrequencyDeviation(freqDev)Set FSK frequency deviation in kHz.Return: StatusSX1262.setRxBandwidth(rxBw)Set FSK RX bandwidth in kHz.Return: StatusSX1262.setDataShaping(dataShaping)Set FSK time-bandwidth product of the Gaussian filter to be used for shaping.Return: StatusSX1262.setSyncBits(syncWord, bitsLen)Set FSK sync word and sync bits length.syncWord = Sync word in listbitsLen = Sync word bit lengthReturn: StatusSX1262.setPreambleLength(preambleLength)Set FSK preamble length.Return: StatusSX1262.setPreambleDetectorLength(preambleDetectorLength)Set minimum preamble detection length, refer toConstantsFSK preamble detector length.SX1262.setNodeAddress(addr)Activate address filtering on node address addr.Return: StatusSX1262.setBroadcastAddress(addr)Activate address filtering on node and broadcast address addr.Return: StatusSX1262.disableAddressFiltering()Disable address filtering.Return: StatusSX1262.setCRC(len, initial=0x1D0F, polynomial=0x1021, inverted=True)Set FSK CRC.len = CRC length, 0, 1 or 2initial = CRC initialpolynomial = Polynomial used for CRC calculationinverted = Enable CRC bytes inversionReturn: StatusSX1262.setWhitening(enabled, initial=0x0100)Set FSK whitening.initial = Initial value for whitening LFSRReturn: StatusSX1262.fixedPacketLengthMode(len)Set FSK fixed packet length mode.len = Packet length in bytesReturn: StatusSX1262.variablePacketLengthMode(maxLen)Set FSK variable packet length mode.maxLen = Max packet length in bytesReturn: StatusConstants (Similar for SX1261 and SX1268)Events: SX1262.TX_DONE, SX1262.RX_DONEFSK address filter: SX1262.ADDR_FILT_OFF, SX1262.ADDR_FILT_NODE, SX1262.ADDR_FILT_NODE_BROADFSK preamble detector length: SX1262.PREAMBLE_DETECT_OFF, SX1262.PREAMBLE_DETECT_X -> X = 8, 16, 24, 32Status dictionary: SX1262.STATUS