Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
ad3f267d
Commit
ad3f267d
authored
Feb 26, 2016
by
philip
Browse files
Fix review comments
parent
72d8c737
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/gpio.c
View file @
ad3f267d
...
@@ -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
]);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment