Merge pull request #204 from nodemcu/dev

comment out ws2812 temporary. remove node.led, node.key
This commit is contained in:
zeroday 2015-02-12 11:07:57 +08:00
commit 3736959665
3 changed files with 27 additions and 3 deletions

View File

@ -7,7 +7,9 @@
#define NODE_VERSION_INTERNAL 0U
#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_1M
@ -50,6 +52,7 @@
#define BUILD_SPIFFS 1
#define LUA_USE_MODULES
#ifdef LUA_USE_MODULES
#define LUA_USE_MODULES_NODE
#define LUA_USE_MODULES_FILE
@ -65,9 +68,15 @@
#define LUA_USE_MODULES_OW
#define LUA_USE_MODULES_BIT
#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 */
// 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_OPTRAM
@ -78,6 +87,8 @@
#endif /* LUA_OPTRAM */
#define READLINE_INTERVAL 80
#ifdef DEVKIT_VERSION_0_9
#define KEY_SHORT_MS 200
#define KEY_LONG_MS 3000
#define KEY_SHORT_COUNT (KEY_SHORT_MS / READLINE_INTERVAL)
@ -85,5 +96,6 @@
#define LED_HIGH_COUNT_DEFAULT 10
#define LED_LOW_COUNT_DEFAULT 0
#endif
#endif /* __USER_CONFIG_H__ */

View File

@ -30,10 +30,13 @@ lua_Load gLoad;
static const char *progname = LUA_PROGNAME;
#ifdef DEVKIT_VERSION_0_9
static int key_press_count = 0;
int led_high_count = LED_HIGH_COUNT_DEFAULT;
int led_low_count = LED_LOW_COUNT_DEFAULT;
static int led_count = 0;
#endif
#if 0
static void lstop (lua_State *L, lua_Debug *ar) {
(void)ar; /* unused arg. */
@ -541,6 +544,7 @@ void dojob(lua_Load *load){
// NODE_DBG("dojob() is called with firstline.\n");
}
#ifdef DEVKIT_VERSION_0_9
extern void key_long_press(void *arg);
extern void key_short_press(void *arg);
static bool key_short_pressed = false;
@ -579,6 +583,7 @@ void update_key_led(){
}
}
}
#endif
#ifndef uart_putc
#define uart_putc uart0_putc
@ -590,7 +595,9 @@ extern uint16_t need_len;
extern int16_t end_char;
void readline(lua_Load *load){
// NODE_DBG("readline() is called.\n");
#ifdef DEVKIT_VERSION_0_9
update_key_led();
#endif
char ch;
while (uart_getc(&ch))
{

View File

@ -124,6 +124,9 @@ static int node_heap( lua_State* L )
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_low_count;
// Lua: led(low, high)
@ -155,7 +158,6 @@ static int node_led( lua_State* L )
static int long_key_ref = LUA_NOREF;
static int short_key_ref = LUA_NOREF;
static lua_State *gL = NULL;
void default_long_press(void *arg){
if(led_high_count == 12 && led_low_count == 12){
@ -228,6 +230,7 @@ static int node_key( lua_State* L )
return 0;
}
#endif
extern lua_Load gLoad;
extern os_timer_t lua_timer;
@ -320,8 +323,10 @@ const LUA_REG_TYPE node_map[] =
{ LSTRKEY( "flashid" ), LFUNCVAL( node_flashid ) },
{ LSTRKEY( "flashsize" ), LFUNCVAL( node_flashsize) },
{ LSTRKEY( "heap" ), LFUNCVAL( node_heap ) },
#ifdef DEVKIT_VERSION_0_9
{ LSTRKEY( "key" ), LFUNCVAL( node_key ) },
{ LSTRKEY( "led" ), LFUNCVAL( node_led ) },
#endif
{ LSTRKEY( "input" ), LFUNCVAL( node_input ) },
{ LSTRKEY( "output" ), LFUNCVAL( node_output ) },
{ LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) },