Ver Fonte

解决读取不到loar busy和dio脚的中断问题

xuxinyi há 3 meses atrás
pai
commit
b60f2c2692
1 ficheiros alterados com 36 adições e 1 exclusões
  1. 36 1
      drv_periph/sx126x_driver.lua

+ 36 - 1
drv_periph/sx126x_driver.lua

@@ -18,7 +18,7 @@ require "sx126x_reg"
 -- TODU: 驱动文件要分开。我把redio.c的函数放到了驱动里面了,为了方便调试。
 
 pmd.ldoset(2,pmd.LDO_VMMC)
-
+pmd.ldoset(2,pmd.LDO_VLCD)
 local SX126x = json.encode(sx126x_reg.SX126x_t)
 local SX126xCopy,result,errinfo = json.decode(SX126x)
 SX126x = nil
@@ -38,6 +38,41 @@ SX126xResetGPIO = pins.setup(pio.P0_13,0)
 SX126xTXENGPIO = pins.setup(pio.P0_27,1)
 SX126xRXENGPIO = pins.setup(pio.P0_28,0)
 
+-- local getGpio19Fnc = pins.setup(pio.P0_24)
+-- sys.timerLoopStart(function()
+--     log.info("testGpioSingle.getGpio19Fnc",getGpio19Fnc())
+-- end,1000)
+
+
+function gpio13IntFnc(msg)
+    log.info("testGpioSingle.gpio24IntFnc",msg,getGpio13Fnc())
+    --上升沿中断
+    if msg==cpu.INT_GPIO_POSEDGE then
+    --下降沿中断
+    else
+    end
+end
+pio.pin.setdebounce(0xffffffff)
+--GPIO13配置为中断,可通过getGpio13Fnc()获取输入电平,产生中断时,自动执行gpio13IntFnc函数
+getGpio13Fnc = pins.setup(pio.P0_24,gpio13IntFnc)
+
+
+
+
+
+
+function gpio4IntFnc(msg)
+    log.info("testGpioSingle.gpio4IntFnc",msg,getGpio4Fnc())
+    --上升沿中断
+    if msg==cpu.INT_GPIO_POSEDGE then
+    --下降沿中断
+    else
+    end
+end
+
+--GPIO13配置为中断,可通过getGpio13Fnc()获取输入电平,产生中断时,自动执行gpio13IntFnc函数
+getGpio4Fnc = pins.setup(pio.P0_4,gpio4IntFnc)
+
 OperatingMode = sx126x_reg.RadioStandbyModes_t.STDBY_RC