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
37369596
Commit
37369596
authored
Feb 12, 2015
by
zeroday
Browse files
Merge pull request #204 from nodemcu/dev
comment out ws2812 temporary. remove node.led, node.key
parents
18886ea6
856b8553
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/include/user_config.h
View file @
37369596
...
@@ -7,7 +7,9 @@
...
@@ -7,7 +7,9 @@
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMCU 0.9.5"
#define NODE_VERSION "NodeMCU 0.9.5"
#define BUILD_DATE "build 20150127"
#define BUILD_DATE "build 20150212"
// #define DEVKIT_VERSION_0_9 1 // define this only if you use NodeMCU devkit v0.9
// #define FLASH_512K
// #define FLASH_512K
// #define FLASH_1M
// #define FLASH_1M
...
@@ -50,6 +52,7 @@
...
@@ -50,6 +52,7 @@
#define BUILD_SPIFFS 1
#define BUILD_SPIFFS 1
#define LUA_USE_MODULES
#define LUA_USE_MODULES
#ifdef LUA_USE_MODULES
#ifdef LUA_USE_MODULES
#define LUA_USE_MODULES_NODE
#define LUA_USE_MODULES_NODE
#define LUA_USE_MODULES_FILE
#define LUA_USE_MODULES_FILE
...
@@ -65,9 +68,15 @@
...
@@ -65,9 +68,15 @@
#define LUA_USE_MODULES_OW
#define LUA_USE_MODULES_OW
#define LUA_USE_MODULES_BIT
#define LUA_USE_MODULES_BIT
#define LUA_USE_MODULES_MQTT
#define LUA_USE_MODULES_MQTT
#define LUA_USE_MODULES_WS2812
//
#define LUA_USE_MODULES_WS2812
// TODO: put this device specific module to device driver section.
#endif
/* LUA_USE_MODULES */
#endif
/* LUA_USE_MODULES */
// TODO: put device specific module to device driver section.
#ifdef LUA_USE_DEVICE_DRIVER
#define LUA_USE_DEVICE_WS2812
#endif
/* LUA_USE_DEVICE_DRIVER */
// #define LUA_NUMBER_INTEGRAL
// #define LUA_NUMBER_INTEGRAL
#define LUA_OPTRAM
#define LUA_OPTRAM
...
@@ -78,6 +87,8 @@
...
@@ -78,6 +87,8 @@
#endif
/* LUA_OPTRAM */
#endif
/* LUA_OPTRAM */
#define READLINE_INTERVAL 80
#define READLINE_INTERVAL 80
#ifdef DEVKIT_VERSION_0_9
#define KEY_SHORT_MS 200
#define KEY_SHORT_MS 200
#define KEY_LONG_MS 3000
#define KEY_LONG_MS 3000
#define KEY_SHORT_COUNT (KEY_SHORT_MS / READLINE_INTERVAL)
#define KEY_SHORT_COUNT (KEY_SHORT_MS / READLINE_INTERVAL)
...
@@ -85,5 +96,6 @@
...
@@ -85,5 +96,6 @@
#define LED_HIGH_COUNT_DEFAULT 10
#define LED_HIGH_COUNT_DEFAULT 10
#define LED_LOW_COUNT_DEFAULT 0
#define LED_LOW_COUNT_DEFAULT 0
#endif
#endif
/* __USER_CONFIG_H__ */
#endif
/* __USER_CONFIG_H__ */
app/lua/lua.c
View file @
37369596
...
@@ -30,10 +30,13 @@ lua_Load gLoad;
...
@@ -30,10 +30,13 @@ lua_Load gLoad;
static
const
char
*
progname
=
LUA_PROGNAME
;
static
const
char
*
progname
=
LUA_PROGNAME
;
#ifdef DEVKIT_VERSION_0_9
static
int
key_press_count
=
0
;
static
int
key_press_count
=
0
;
int
led_high_count
=
LED_HIGH_COUNT_DEFAULT
;
int
led_high_count
=
LED_HIGH_COUNT_DEFAULT
;
int
led_low_count
=
LED_LOW_COUNT_DEFAULT
;
int
led_low_count
=
LED_LOW_COUNT_DEFAULT
;
static
int
led_count
=
0
;
static
int
led_count
=
0
;
#endif
#if 0
#if 0
static void lstop (lua_State *L, lua_Debug *ar) {
static void lstop (lua_State *L, lua_Debug *ar) {
(void)ar; /* unused arg. */
(void)ar; /* unused arg. */
...
@@ -541,6 +544,7 @@ void dojob(lua_Load *load){
...
@@ -541,6 +544,7 @@ void dojob(lua_Load *load){
// NODE_DBG("dojob() is called with firstline.\n");
// NODE_DBG("dojob() is called with firstline.\n");
}
}
#ifdef DEVKIT_VERSION_0_9
extern
void
key_long_press
(
void
*
arg
);
extern
void
key_long_press
(
void
*
arg
);
extern
void
key_short_press
(
void
*
arg
);
extern
void
key_short_press
(
void
*
arg
);
static
bool
key_short_pressed
=
false
;
static
bool
key_short_pressed
=
false
;
...
@@ -579,6 +583,7 @@ void update_key_led(){
...
@@ -579,6 +583,7 @@ void update_key_led(){
}
}
}
}
}
}
#endif
#ifndef uart_putc
#ifndef uart_putc
#define uart_putc uart0_putc
#define uart_putc uart0_putc
...
@@ -590,7 +595,9 @@ extern uint16_t need_len;
...
@@ -590,7 +595,9 @@ extern uint16_t need_len;
extern
int16_t
end_char
;
extern
int16_t
end_char
;
void
readline
(
lua_Load
*
load
){
void
readline
(
lua_Load
*
load
){
// NODE_DBG("readline() is called.\n");
// NODE_DBG("readline() is called.\n");
#ifdef DEVKIT_VERSION_0_9
update_key_led
();
update_key_led
();
#endif
char
ch
;
char
ch
;
while
(
uart_getc
(
&
ch
))
while
(
uart_getc
(
&
ch
))
{
{
...
...
app/modules/node.c
View file @
37369596
...
@@ -124,6 +124,9 @@ static int node_heap( lua_State* L )
...
@@ -124,6 +124,9 @@ static int node_heap( lua_State* L )
return
1
;
return
1
;
}
}
static
lua_State
*
gL
=
NULL
;
#ifdef DEVKIT_VERSION_0_9
extern
int
led_high_count
;
// this is defined in lua.c
extern
int
led_high_count
;
// this is defined in lua.c
extern
int
led_low_count
;
extern
int
led_low_count
;
// Lua: led(low, high)
// Lua: led(low, high)
...
@@ -155,7 +158,6 @@ static int node_led( lua_State* L )
...
@@ -155,7 +158,6 @@ static int node_led( lua_State* L )
static
int
long_key_ref
=
LUA_NOREF
;
static
int
long_key_ref
=
LUA_NOREF
;
static
int
short_key_ref
=
LUA_NOREF
;
static
int
short_key_ref
=
LUA_NOREF
;
static
lua_State
*
gL
=
NULL
;
void
default_long_press
(
void
*
arg
){
void
default_long_press
(
void
*
arg
){
if
(
led_high_count
==
12
&&
led_low_count
==
12
){
if
(
led_high_count
==
12
&&
led_low_count
==
12
){
...
@@ -228,6 +230,7 @@ static int node_key( lua_State* L )
...
@@ -228,6 +230,7 @@ static int node_key( lua_State* L )
return
0
;
return
0
;
}
}
#endif
extern
lua_Load
gLoad
;
extern
lua_Load
gLoad
;
extern
os_timer_t
lua_timer
;
extern
os_timer_t
lua_timer
;
...
@@ -320,8 +323,10 @@ const LUA_REG_TYPE node_map[] =
...
@@ -320,8 +323,10 @@ const LUA_REG_TYPE node_map[] =
{
LSTRKEY
(
"flashid"
),
LFUNCVAL
(
node_flashid
)
},
{
LSTRKEY
(
"flashid"
),
LFUNCVAL
(
node_flashid
)
},
{
LSTRKEY
(
"flashsize"
),
LFUNCVAL
(
node_flashsize
)
},
{
LSTRKEY
(
"flashsize"
),
LFUNCVAL
(
node_flashsize
)
},
{
LSTRKEY
(
"heap"
),
LFUNCVAL
(
node_heap
)
},
{
LSTRKEY
(
"heap"
),
LFUNCVAL
(
node_heap
)
},
#ifdef DEVKIT_VERSION_0_9
{
LSTRKEY
(
"key"
),
LFUNCVAL
(
node_key
)
},
{
LSTRKEY
(
"key"
),
LFUNCVAL
(
node_key
)
},
{
LSTRKEY
(
"led"
),
LFUNCVAL
(
node_led
)
},
{
LSTRKEY
(
"led"
),
LFUNCVAL
(
node_led
)
},
#endif
{
LSTRKEY
(
"input"
),
LFUNCVAL
(
node_input
)
},
{
LSTRKEY
(
"input"
),
LFUNCVAL
(
node_input
)
},
{
LSTRKEY
(
"output"
),
LFUNCVAL
(
node_output
)
},
{
LSTRKEY
(
"output"
),
LFUNCVAL
(
node_output
)
},
{
LSTRKEY
(
"readvdd33"
),
LFUNCVAL
(
node_readvdd33
)
},
{
LSTRKEY
(
"readvdd33"
),
LFUNCVAL
(
node_readvdd33
)
},
...
...
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