Commit ad3f267d authored by philip's avatar philip
Browse files

Fix review comments

parent 72d8c737
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "user_interface.h" #include "user_interface.h"
#include "c_types.h" #include "c_types.h"
#include "c_string.h" #include "c_string.h"
#include "gpio.h"
#define PULLUP PLATFORM_GPIO_PULLUP #define PULLUP PLATFORM_GPIO_PULLUP
#define FLOAT PLATFORM_GPIO_FLOAT #define FLOAT PLATFORM_GPIO_FLOAT
...@@ -17,6 +18,12 @@ ...@@ -17,6 +18,12 @@
#define LOW PLATFORM_GPIO_LOW #define LOW PLATFORM_GPIO_LOW
#ifdef GPIO_INTERRUPT_ENABLE #ifdef GPIO_INTERRUPT_ENABLE
// We also know that the non-level interrupt types are < LOLEVEL, and that
// HILEVEL is > LOLEVEL. Since this is burned into the hardware it is not
// going to change.
#define INTERRUPT_TYPE_IS_LEVEL(x) ((x) >= GPIO_PIN_INTR_LOLEVEL)
static int gpio_cb_ref[GPIO_PIN_NUM]; static int gpio_cb_ref[GPIO_PIN_NUM];
// This task is scheduled by the ISR and is used // This task is scheduled by the ISR and is used
...@@ -34,7 +41,7 @@ static void gpio_intr_callback_task (task_param_t param, uint8 priority) ...@@ -34,7 +41,7 @@ static void gpio_intr_callback_task (task_param_t param, uint8 priority)
lua_State *L = lua_getstate(); lua_State *L = lua_getstate();
NODE_DBG("Calling: %08x\n", gpio_cb_ref[pin]); NODE_DBG("Calling: %08x\n", gpio_cb_ref[pin]);
// //
if (pin_int_type[pin] < 4) { if (!INTERRUPT_TYPE_IS_LEVEL(pin_int_type[pin])) {
// Edge triggered -- re-enable the interrupt // Edge triggered -- re-enable the interrupt
platform_gpio_intr_init(pin, pin_int_type[pin]); platform_gpio_intr_init(pin, pin_int_type[pin]);
} }
...@@ -44,7 +51,7 @@ static void gpio_intr_callback_task (task_param_t param, uint8 priority) ...@@ -44,7 +51,7 @@ static void gpio_intr_callback_task (task_param_t param, uint8 priority)
lua_pushinteger(L, level); lua_pushinteger(L, level);
lua_call(L, 1, 0); lua_call(L, 1, 0);
if (pin_int_type[pin] >= 4) { if (INTERRUPT_TYPE_IS_LEVEL(pin_int_type[pin])) {
// Level triggered -- re-enable the callback // Level triggered -- re-enable the callback
platform_gpio_intr_init(pin, pin_int_type[pin]); platform_gpio_intr_init(pin, pin_int_type[pin]);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment