Browse Source

fix:GPIO中断回调的最大中断号由conf里的配置决定

alienwalker 2 years ago
parent
commit
444e001bc5
2 changed files with 5 additions and 2 deletions
  1. 1 1
      luat/include/luat_gpio_legacy.h
  2. 4 1
      luat/modules/luat_lib_gpio.c

+ 1 - 1
luat/include/luat_gpio_legacy.h

@@ -44,6 +44,6 @@ typedef struct luat_gpio
 
 int luat_gpio_setup(luat_gpio_t* gpio);
 void luat_gpio_mode(int pin, int mode, int pull, int initOutput);
-
+int luat_gpio_irq_default(int pin, void* args);
 
 #endif

+ 4 - 1
luat/modules/luat_lib_gpio.c

@@ -117,8 +117,11 @@ static LUAT_RT_RET_TYPE l_gpio_debounce_mode1_cb(LUAT_RT_CB_PARAM) {
 
 int luat_gpio_irq_default(int pin, void* args) {
     rtos_msg_t msg = {0};
-
+#ifdef LUAT_GPIO_PIN_MAX
+    if (pin < 0 || pin >= LUAT_GPIO_PIN_MAX) {
+#else
     if (pin < 0 || pin >= Luat_GPIO_MAX_ID) {
+#endif
         return 0;
     }