|
|
@@ -38,6 +38,19 @@ SX126xResetGPIO = pins.setup(pio.P0_13,0)
|
|
|
SX126xTXENGPIO = pins.setup(pio.P0_27,1)
|
|
|
SX126xRXENGPIO = pins.setup(pio.P0_28,0)
|
|
|
|
|
|
+function setTransmitMode()
|
|
|
+ sys.wait(100)
|
|
|
+ SX126xTXENGPIO(1)
|
|
|
+ SX126xRXENGPIO(0)
|
|
|
+ sys.wait(100)
|
|
|
+end
|
|
|
+
|
|
|
+function setReceiveMode()
|
|
|
+ sys.wait(100)
|
|
|
+ SX126xTXENGPIO(0)
|
|
|
+ SX126xRXENGPIO(1)
|
|
|
+ sys.wait(100)
|
|
|
+end
|
|
|
-- local getGpio19Fnc = pins.setup(pio.P0_24)
|
|
|
-- sys.timerLoopStart(function()
|
|
|
-- log.info("testGpioSingle.getGpio19Fnc",getGpio19Fnc())
|
|
|
@@ -456,7 +469,30 @@ function sentString(strData)
|
|
|
-- RadioSend(hexStr,string.format("%02X", #hexStr/2),"00")
|
|
|
end
|
|
|
|
|
|
+function SX126xSetRx(timeout)
|
|
|
+ OperatingMode = sx126x_reg.RadioOperatingModes_t.MODE_RX
|
|
|
+ local buf = {"00","00","00"}
|
|
|
+ SX126xWriteCommand( sx126x_reg.RadioCommands.RADIO_SET_RX, buf);
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+function RadioRx(timeout)
|
|
|
+ pins.setup(pio.P0_27,0)
|
|
|
+ pins.setup(pio.P0_28,1)
|
|
|
+ sys.wait(1000)
|
|
|
+ SX126xSetDioIrqParams( "02", sx126x_reg.RadioIrqMasks_t.IRQ_RADIO_ALL, sx126x_reg.RadioIrqMasks_t.IRQ_RADIO_NONE, sx126x_reg.RadioIrqMasks_t.IRQ_RADIO_NONE )
|
|
|
+ SX126xSetRx(0)
|
|
|
+end
|
|
|
|
|
|
+function SX126xClearIrqStatus()
|
|
|
+ local buf = {"FF","FF"}
|
|
|
+ SX126xWriteCommand( sx126x_reg.RadioCommands.RADIO_CLR_IRQSTATUS, buf);
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+function RadioClearIrqStatus()
|
|
|
+ SX126xClearIrqStatus()
|
|
|
+end
|
|
|
|
|
|
-- sys.taskInit(function ()
|
|
|
-- sys.wait(5000)
|