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
b773290b
Commit
b773290b
authored
Dec 13, 2015
by
TerryE
Committed by
Johny Mattsson
Dec 16, 2015
Browse files
Major cleanup of module registration pass 2.
carrying on Johny's edits as per my comments on #810
parent
6b6456be
Changes
29
Hide whitespace changes
Inline
Side-by-side
app/modules/rtctime.c
View file @
b773290b
...
@@ -116,16 +116,18 @@ static int rtctime_dsleep_aligned (lua_State *L)
...
@@ -116,16 +116,18 @@ static int rtctime_dsleep_aligned (lua_State *L)
// Module function map
// Module function map
const
LUA_REG_TYPE
rtctime_map
[]
=
const
LUA_REG_TYPE
rtctime_map
[]
=
{
{
{
LSTRKEY
(
"set"
),
LFUNCVAL
(
rtctime_set
)
},
{
LSTRKEY
(
"set"
),
LFUNCVAL
(
rtctime_set
)
},
{
LSTRKEY
(
"get"
),
LFUNCVAL
(
rtctime_get
)
},
{
LSTRKEY
(
"get"
),
LFUNCVAL
(
rtctime_get
)
},
{
LSTRKEY
(
"dsleep"
),
LFUNCVAL
(
rtctime_dsleep
)
},
{
LSTRKEY
(
"dsleep"
),
LFUNCVAL
(
rtctime_dsleep
)
},
{
LSTRKEY
(
"dsleep_aligned"
),
LFUNCVAL
(
rtctime_dsleep_aligned
)
},
{
LSTRKEY
(
"dsleep_aligned"
),
LFUNCVAL
(
rtctime_dsleep_aligned
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
LUALIB_API
int
luaopen_rtctime
(
lua_State
*
L
)
LUALIB_API
int
luaopen_rtctime
(
lua_State
*
L
)
{
{
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/modules/sntp.c
View file @
b773290b
...
@@ -376,13 +376,15 @@ error:
...
@@ -376,13 +376,15 @@ error:
// Module function map
// Module function map
const
LUA_REG_TYPE
sntp_map
[]
=
const
LUA_REG_TYPE
sntp_map
[]
=
{
{
{
LSTRKEY
(
"sync"
),
LFUNCVAL
(
sntp_sync
)
},
{
LSTRKEY
(
"sync"
),
LFUNCVAL
(
sntp_sync
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
LUALIB_API
int
luaopen_sntp
(
lua_State
*
L
)
LUALIB_API
int
luaopen_sntp
(
lua_State
*
L
)
{
{
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/modules/spi.c
View file @
b773290b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
#include "lauxlib.h"
#include "lauxlib.h"
#include "platform.h"
#include "platform.h"
#include "auxmods.h"
#include "lrodefs.h"
#include "lrodefs.h"
#define SPI_HALFDUPLEX 0
#define SPI_HALFDUPLEX 0
...
@@ -307,27 +306,29 @@ static int spi_transaction( lua_State *L )
...
@@ -307,27 +306,29 @@ static int spi_transaction( lua_State *L )
// Module function map
// Module function map
const
LUA_REG_TYPE
spi_map
[]
=
const
LUA_REG_TYPE
spi_map
[]
=
{
{
{
LSTRKEY
(
"setup"
),
LFUNCVAL
(
spi_setup
)
},
{
LSTRKEY
(
"setup"
),
LFUNCVAL
(
spi_setup
)
},
{
LSTRKEY
(
"send"
),
LFUNCVAL
(
spi_send_recv
)
},
{
LSTRKEY
(
"send"
),
LFUNCVAL
(
spi_send_recv
)
},
{
LSTRKEY
(
"recv"
),
LFUNCVAL
(
spi_recv
)
},
{
LSTRKEY
(
"recv"
),
LFUNCVAL
(
spi_recv
)
},
{
LSTRKEY
(
"set_mosi"
),
LFUNCVAL
(
spi_set_mosi
)
},
{
LSTRKEY
(
"set_mosi"
),
LFUNCVAL
(
spi_set_mosi
)
},
{
LSTRKEY
(
"get_miso"
),
LFUNCVAL
(
spi_get_miso
)
},
{
LSTRKEY
(
"get_miso"
),
LFUNCVAL
(
spi_get_miso
)
},
{
LSTRKEY
(
"transaction"
),
LFUNCVAL
(
spi_transaction
)
},
{
LSTRKEY
(
"transaction"
),
LFUNCVAL
(
spi_transaction
)
},
{
LSTRKEY
(
"MASTER"
),
LNUMVAL
(
PLATFORM_SPI_MASTER
)
},
{
LSTRKEY
(
"MASTER"
),
LNUMVAL
(
PLATFORM_SPI_MASTER
)
},
{
LSTRKEY
(
"SLAVE"
),
LNUMVAL
(
PLATFORM_SPI_SLAVE
)
},
{
LSTRKEY
(
"SLAVE"
),
LNUMVAL
(
PLATFORM_SPI_SLAVE
)
},
{
LSTRKEY
(
"CPHA_LOW"
),
LNUMVAL
(
PLATFORM_SPI_CPHA_LOW
)
},
{
LSTRKEY
(
"CPHA_LOW"
),
LNUMVAL
(
PLATFORM_SPI_CPHA_LOW
)
},
{
LSTRKEY
(
"CPHA_HIGH"
),
LNUMVAL
(
PLATFORM_SPI_CPHA_HIGH
)
},
{
LSTRKEY
(
"CPHA_HIGH"
),
LNUMVAL
(
PLATFORM_SPI_CPHA_HIGH
)
},
{
LSTRKEY
(
"CPOL_LOW"
),
LNUMVAL
(
PLATFORM_SPI_CPOL_LOW
)
},
{
LSTRKEY
(
"CPOL_LOW"
),
LNUMVAL
(
PLATFORM_SPI_CPOL_LOW
)
},
{
LSTRKEY
(
"CPOL_HIGH"
),
LNUMVAL
(
PLATFORM_SPI_CPOL_HIGH
)
},
{
LSTRKEY
(
"CPOL_HIGH"
),
LNUMVAL
(
PLATFORM_SPI_CPOL_HIGH
)
},
{
LSTRKEY
(
"DATABITS_8"
),
LNUMVAL
(
8
)
},
{
LSTRKEY
(
"DATABITS_8"
),
LNUMVAL
(
8
)
},
{
LSTRKEY
(
"HALFDUPLEX"
),
LNUMVAL
(
SPI_HALFDUPLEX
)
},
{
LSTRKEY
(
"HALFDUPLEX"
),
LNUMVAL
(
SPI_HALFDUPLEX
)
},
{
LSTRKEY
(
"FULLDUPLEX"
),
LNUMVAL
(
SPI_FULLDUPLEX
)
},
{
LSTRKEY
(
"FULLDUPLEX"
),
LNUMVAL
(
SPI_FULLDUPLEX
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
LUALIB_API
int
luaopen_spi
(
lua_State
*
L
)
LUALIB_API
int
luaopen_spi
(
lua_State
*
L
)
{
{
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/modules/tmr.c
View file @
b773290b
...
@@ -50,7 +50,6 @@ tmr.softwd(int)
...
@@ -50,7 +50,6 @@ tmr.softwd(int)
#include "lauxlib.h"
#include "lauxlib.h"
#include "platform.h"
#include "platform.h"
#include "auxmods.h"
#include "lrodefs.h"
#include "lrodefs.h"
#include "c_types.h"
#include "c_types.h"
...
@@ -308,21 +307,21 @@ static int tmr_softwd( lua_State* L ){
...
@@ -308,21 +307,21 @@ static int tmr_softwd( lua_State* L ){
// Module function map
// Module function map
const
LUA_REG_TYPE
tmr_map
[]
=
{
const
LUA_REG_TYPE
tmr_map
[]
=
{
{
LSTRKEY
(
"delay"
),
LFUNCVAL
(
tmr_delay
)
},
{
LSTRKEY
(
"delay"
),
LFUNCVAL
(
tmr_delay
)
},
{
LSTRKEY
(
"now"
),
LFUNCVAL
(
tmr_now
)
},
{
LSTRKEY
(
"now"
),
LFUNCVAL
(
tmr_now
)
},
{
LSTRKEY
(
"wdclr"
),
LFUNCVAL
(
tmr_wdclr
)
},
{
LSTRKEY
(
"wdclr"
),
LFUNCVAL
(
tmr_wdclr
)
},
{
LSTRKEY
(
"softwd"
),
LFUNCVAL
(
tmr_softwd
)
},
{
LSTRKEY
(
"softwd"
),
LFUNCVAL
(
tmr_softwd
)
},
{
LSTRKEY
(
"time"
),
LFUNCVAL
(
tmr_time
)
},
{
LSTRKEY
(
"time"
),
LFUNCVAL
(
tmr_time
)
},
{
LSTRKEY
(
"register"
),
LFUNCVAL
(
tmr_register
)
},
{
LSTRKEY
(
"register"
),
LFUNCVAL
(
tmr_register
)
},
{
LSTRKEY
(
"alarm"
),
LFUNCVAL
(
tmr_alarm
)
},
{
LSTRKEY
(
"alarm"
),
LFUNCVAL
(
tmr_alarm
)
},
{
LSTRKEY
(
"start"
),
LFUNCVAL
(
tmr_start
)
},
{
LSTRKEY
(
"start"
),
LFUNCVAL
(
tmr_start
)
},
{
LSTRKEY
(
"stop"
),
LFUNCVAL
(
tmr_stop
)
},
{
LSTRKEY
(
"stop"
),
LFUNCVAL
(
tmr_stop
)
},
{
LSTRKEY
(
"unregister"
),
LFUNCVAL
(
tmr_unregister
)
},
{
LSTRKEY
(
"unregister"
),
LFUNCVAL
(
tmr_unregister
)
},
{
LSTRKEY
(
"state"
),
LFUNCVAL
(
tmr_state
)
},
{
LSTRKEY
(
"state"
),
LFUNCVAL
(
tmr_state
)
},
{
LSTRKEY
(
"interval"
),
LFUNCVAL
(
tmr_interval
)
},
{
LSTRKEY
(
"interval"
),
LFUNCVAL
(
tmr_interval
)
},
{
LSTRKEY
(
"ALARM_SINGLE"
),
LNUMVAL
(
TIMER_MODE_SINGLE
)
},
{
LSTRKEY
(
"ALARM_SINGLE"
),
LNUMVAL
(
TIMER_MODE_SINGLE
)
},
{
LSTRKEY
(
"ALARM_SEMI"
),
LNUMVAL
(
TIMER_MODE_SEMI
)
},
{
LSTRKEY
(
"ALARM_SEMI"
),
LNUMVAL
(
TIMER_MODE_SEMI
)
},
{
LSTRKEY
(
"ALARM_AUTO"
),
LNUMVAL
(
TIMER_MODE_AUTO
)
},
{
LSTRKEY
(
"ALARM_AUTO"
),
LNUMVAL
(
TIMER_MODE_AUTO
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
...
@@ -338,6 +337,9 @@ LUALIB_API int luaopen_tmr( lua_State *L ){
...
@@ -338,6 +337,9 @@ LUALIB_API int luaopen_tmr( lua_State *L ){
ets_timer_setfn
(
&
rtc_timer
,
rtc_callback
,
NULL
);
ets_timer_setfn
(
&
rtc_timer
,
rtc_callback
,
NULL
);
ets_timer_arm_new
(
&
rtc_timer
,
1000
,
1
,
1
);
ets_timer_arm_new
(
&
rtc_timer
,
1000
,
1
,
1
);
return
0
;
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/modules/tsl2561.c
View file @
b773290b
...
@@ -100,35 +100,34 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_getchannels(lua_State* L) {
...
@@ -100,35 +100,34 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_getchannels(lua_State* L) {
return
3
;
return
3
;
}
}
const
LUA_REG_TYPE
tsl2561_map
[]
=
// Module function map
{
const
LUA_REG_TYPE
tsl2561_map
[]
=
{
{
LSTRKEY
(
"settiming"
),
LFUNCVAL
(
tsl2561_lua_settiming
)},
{
LSTRKEY
(
"settiming"
),
LFUNCVAL
(
tsl2561_lua_settiming
)},
{
LSTRKEY
(
"getlux"
),
LFUNCVAL
(
tsl2561_lua_calclux
)},
{
LSTRKEY
(
"getlux"
),
LFUNCVAL
(
tsl2561_lua_calclux
)},
{
LSTRKEY
(
"getrawchannels"
),
LFUNCVAL
(
tsl2561_lua_getchannels
)},
{
LSTRKEY
(
"getrawchannels"
),
LFUNCVAL
(
tsl2561_lua_getchannels
)},
{
LSTRKEY
(
"init"
),
LFUNCVAL
(
tsl2561_init
)},
{
LSTRKEY
(
"init"
),
LFUNCVAL
(
tsl2561_init
)},
{
LSTRKEY
(
"TSL2561_OK"
),
LNUMVAL
(
TSL2561_ERROR_OK
)},
{
LSTRKEY
(
"TSL2561_OK"
),
LNUMVAL
(
TSL2561_ERROR_OK
)},
{
LSTRKEY
(
"TSL2561_ERROR_I2CINIT"
),
LNUMVAL
(
TSL2561_ERROR_I2CINIT
)},
{
LSTRKEY
(
"TSL2561_ERROR_I2CINIT"
),
LNUMVAL
(
TSL2561_ERROR_I2CINIT
)},
{
LSTRKEY
(
"TSL2561_ERROR_I2CBUSY"
),
LNUMVAL
(
TSL2561_ERROR_I2CBUSY
)},
{
LSTRKEY
(
"TSL2561_ERROR_I2CBUSY"
),
LNUMVAL
(
TSL2561_ERROR_I2CBUSY
)},
{
LSTRKEY
(
"TSL2561_ERROR_NOINIT"
),
LNUMVAL
(
TSL2561_ERROR_NOINIT
)},
{
LSTRKEY
(
"TSL2561_ERROR_NOINIT"
),
LNUMVAL
(
TSL2561_ERROR_NOINIT
)},
{
LSTRKEY
(
"TSL2561_ERROR_LAST"
),
LNUMVAL
(
TSL2561_ERROR_LAST
)},
{
LSTRKEY
(
"TSL2561_ERROR_LAST"
),
LNUMVAL
(
TSL2561_ERROR_LAST
)},
{
LSTRKEY
(
"INTEGRATIONTIME_13MS"
),
LNUMVAL
(
TSL2561_INTEGRATIONTIME_13MS
)},
{
LSTRKEY
(
"INTEGRATIONTIME_13MS"
),
LNUMVAL
(
TSL2561_INTEGRATIONTIME_13MS
)},
{
LSTRKEY
(
"INTEGRATIONTIME_101MS"
),
LNUMVAL
(
TSL2561_INTEGRATIONTIME_101MS
)},
{
LSTRKEY
(
"INTEGRATIONTIME_101MS"
),
LNUMVAL
(
TSL2561_INTEGRATIONTIME_101MS
)},
{
LSTRKEY
(
"INTEGRATIONTIME_402MS"
),
LNUMVAL
(
TSL2561_INTEGRATIONTIME_402MS
)},
{
LSTRKEY
(
"INTEGRATIONTIME_402MS"
),
LNUMVAL
(
TSL2561_INTEGRATIONTIME_402MS
)},
{
LSTRKEY
(
"GAIN_1X"
),
LNUMVAL
(
TSL2561_GAIN_1X
)},
{
LSTRKEY
(
"GAIN_1X"
),
LNUMVAL
(
TSL2561_GAIN_1X
)},
{
LSTRKEY
(
"GAIN_16X"
),
LNUMVAL
(
TSL2561_GAIN_16X
)},
{
LSTRKEY
(
"GAIN_16X"
),
LNUMVAL
(
TSL2561_GAIN_16X
)},
{
LSTRKEY
(
"PACKAGE_CS"
),
LNUMVAL
(
TSL2561_PACKAGE_CS
)},
{
LSTRKEY
(
"PACKAGE_CS"
),
LNUMVAL
(
TSL2561_PACKAGE_CS
)},
{
LSTRKEY
(
"PACKAGE_T_FN_CL"
),
LNUMVAL
(
TSL2561_PACKAGE_T_FN_CL
)},
{
LSTRKEY
(
"PACKAGE_T_FN_CL"
),
LNUMVAL
(
TSL2561_PACKAGE_T_FN_CL
)},
{
LSTRKEY
(
"ADDRESS_GND"
),
LNUMVAL
(
TSL2561_ADDRESS_GND
)},
{
LSTRKEY
(
"ADDRESS_FLOAT"
),
LNUMVAL
(
TSL2561_ADDRESS_FLOAT
)},
{
LSTRKEY
(
"ADDRESS_GND"
),
LNUMVAL
(
TSL2561_ADDRESS_GND
)},
{
LSTRKEY
(
"ADDRESS_VDD"
),
LNUMVAL
(
TSL2561_ADDRESS_VDD
)},
{
LSTRKEY
(
"ADDRESS_FLOAT"
),
LNUMVAL
(
TSL2561_ADDRESS_FLOAT
)},
{
LSTRKEY
(
"ADDRESS_VDD"
),
LNUMVAL
(
TSL2561_ADDRESS_VDD
)},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
LUALIB_API
int
luaopen_tsl2561
(
lua_State
*
L
)
{
LUALIB_API
int
luaopen_tsl2561
(
lua_State
*
L
)
{
return
0
;
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/modules/u8g.c
View file @
b773290b
...
@@ -1025,92 +1025,92 @@ U8G_DISPLAY_TABLE_SPI
...
@@ -1025,92 +1025,92 @@ U8G_DISPLAY_TABLE_SPI
// Module function map
// Module function map
static
const
LUA_REG_TYPE
lu8g_display_map
[]
=
static
const
LUA_REG_TYPE
lu8g_display_map
[]
=
{
{
{
LSTRKEY
(
"begin"
),
LFUNCVAL
(
lu8g_begin
)
},
{
LSTRKEY
(
"begin"
),
LFUNCVAL
(
lu8g_begin
)
},
{
LSTRKEY
(
"drawBitmap"
),
LFUNCVAL
(
lu8g_drawBitmap
)
},
{
LSTRKEY
(
"drawBitmap"
),
LFUNCVAL
(
lu8g_drawBitmap
)
},
{
LSTRKEY
(
"drawBox"
),
LFUNCVAL
(
lu8g_drawBox
)
},
{
LSTRKEY
(
"drawBox"
),
LFUNCVAL
(
lu8g_drawBox
)
},
{
LSTRKEY
(
"drawCircle"
),
LFUNCVAL
(
lu8g_drawCircle
)
},
{
LSTRKEY
(
"drawCircle"
),
LFUNCVAL
(
lu8g_drawCircle
)
},
{
LSTRKEY
(
"drawDisc"
),
LFUNCVAL
(
lu8g_drawDisc
)
},
{
LSTRKEY
(
"drawDisc"
),
LFUNCVAL
(
lu8g_drawDisc
)
},
{
LSTRKEY
(
"drawEllipse"
),
LFUNCVAL
(
lu8g_drawEllipse
)
},
{
LSTRKEY
(
"drawEllipse"
),
LFUNCVAL
(
lu8g_drawEllipse
)
},
{
LSTRKEY
(
"drawFilledEllipse"
),
LFUNCVAL
(
lu8g_drawFilledEllipse
)
},
{
LSTRKEY
(
"drawFilledEllipse"
),
LFUNCVAL
(
lu8g_drawFilledEllipse
)
},
{
LSTRKEY
(
"drawFrame"
),
LFUNCVAL
(
lu8g_drawFrame
)
},
{
LSTRKEY
(
"drawFrame"
),
LFUNCVAL
(
lu8g_drawFrame
)
},
{
LSTRKEY
(
"drawHLine"
),
LFUNCVAL
(
lu8g_drawHLine
)
},
{
LSTRKEY
(
"drawHLine"
),
LFUNCVAL
(
lu8g_drawHLine
)
},
{
LSTRKEY
(
"drawLine"
),
LFUNCVAL
(
lu8g_drawLine
)
},
{
LSTRKEY
(
"drawLine"
),
LFUNCVAL
(
lu8g_drawLine
)
},
{
LSTRKEY
(
"drawPixel"
),
LFUNCVAL
(
lu8g_drawPixel
)
},
{
LSTRKEY
(
"drawPixel"
),
LFUNCVAL
(
lu8g_drawPixel
)
},
{
LSTRKEY
(
"drawRBox"
),
LFUNCVAL
(
lu8g_drawRBox
)
},
{
LSTRKEY
(
"drawRBox"
),
LFUNCVAL
(
lu8g_drawRBox
)
},
{
LSTRKEY
(
"drawRFrame"
),
LFUNCVAL
(
lu8g_drawRFrame
)
},
{
LSTRKEY
(
"drawRFrame"
),
LFUNCVAL
(
lu8g_drawRFrame
)
},
{
LSTRKEY
(
"drawStr"
),
LFUNCVAL
(
lu8g_drawStr
)
},
{
LSTRKEY
(
"drawStr"
),
LFUNCVAL
(
lu8g_drawStr
)
},
{
LSTRKEY
(
"drawStr90"
),
LFUNCVAL
(
lu8g_drawStr90
)
},
{
LSTRKEY
(
"drawStr90"
),
LFUNCVAL
(
lu8g_drawStr90
)
},
{
LSTRKEY
(
"drawStr180"
),
LFUNCVAL
(
lu8g_drawStr180
)
},
{
LSTRKEY
(
"drawStr180"
),
LFUNCVAL
(
lu8g_drawStr180
)
},
{
LSTRKEY
(
"drawStr270"
),
LFUNCVAL
(
lu8g_drawStr270
)
},
{
LSTRKEY
(
"drawStr270"
),
LFUNCVAL
(
lu8g_drawStr270
)
},
{
LSTRKEY
(
"drawTriangle"
),
LFUNCVAL
(
lu8g_drawTriangle
)
},
{
LSTRKEY
(
"drawTriangle"
),
LFUNCVAL
(
lu8g_drawTriangle
)
},
{
LSTRKEY
(
"drawVLine"
),
LFUNCVAL
(
lu8g_drawVLine
)
},
{
LSTRKEY
(
"drawVLine"
),
LFUNCVAL
(
lu8g_drawVLine
)
},
{
LSTRKEY
(
"drawXBM"
),
LFUNCVAL
(
lu8g_drawXBM
)
},
{
LSTRKEY
(
"drawXBM"
),
LFUNCVAL
(
lu8g_drawXBM
)
},
{
LSTRKEY
(
"firstPage"
),
LFUNCVAL
(
lu8g_firstPage
)
},
{
LSTRKEY
(
"firstPage"
),
LFUNCVAL
(
lu8g_firstPage
)
},
{
LSTRKEY
(
"getColorIndex"
),
LFUNCVAL
(
lu8g_getColorIndex
)
},
{
LSTRKEY
(
"getColorIndex"
),
LFUNCVAL
(
lu8g_getColorIndex
)
},
{
LSTRKEY
(
"getFontAscent"
),
LFUNCVAL
(
lu8g_getFontAscent
)
},
{
LSTRKEY
(
"getFontAscent"
),
LFUNCVAL
(
lu8g_getFontAscent
)
},
{
LSTRKEY
(
"getFontDescent"
),
LFUNCVAL
(
lu8g_getFontDescent
)
},
{
LSTRKEY
(
"getFontDescent"
),
LFUNCVAL
(
lu8g_getFontDescent
)
},
{
LSTRKEY
(
"getFontLineSpacing"
),
LFUNCVAL
(
lu8g_getFontLineSpacing
)
},
{
LSTRKEY
(
"getFontLineSpacing"
),
LFUNCVAL
(
lu8g_getFontLineSpacing
)
},
{
LSTRKEY
(
"getHeight"
),
LFUNCVAL
(
lu8g_getHeight
)
},
{
LSTRKEY
(
"getHeight"
),
LFUNCVAL
(
lu8g_getHeight
)
},
{
LSTRKEY
(
"getMode"
),
LFUNCVAL
(
lu8g_getMode
)
},
{
LSTRKEY
(
"getMode"
),
LFUNCVAL
(
lu8g_getMode
)
},
{
LSTRKEY
(
"getStrWidth"
),
LFUNCVAL
(
lu8g_getStrWidth
)
},
{
LSTRKEY
(
"getStrWidth"
),
LFUNCVAL
(
lu8g_getStrWidth
)
},
{
LSTRKEY
(
"getWidth"
),
LFUNCVAL
(
lu8g_getWidth
)
},
{
LSTRKEY
(
"getWidth"
),
LFUNCVAL
(
lu8g_getWidth
)
},
{
LSTRKEY
(
"nextPage"
),
LFUNCVAL
(
lu8g_nextPage
)
},
{
LSTRKEY
(
"nextPage"
),
LFUNCVAL
(
lu8g_nextPage
)
},
{
LSTRKEY
(
"setColorIndex"
),
LFUNCVAL
(
lu8g_setColorIndex
)
},
{
LSTRKEY
(
"setColorIndex"
),
LFUNCVAL
(
lu8g_setColorIndex
)
},
{
LSTRKEY
(
"setDefaultBackgroundColor"
),
LFUNCVAL
(
lu8g_setDefaultBackgroundColor
)
},
{
LSTRKEY
(
"setDefaultBackgroundColor"
),
LFUNCVAL
(
lu8g_setDefaultBackgroundColor
)
},
{
LSTRKEY
(
"setDefaultForegroundColor"
),
LFUNCVAL
(
lu8g_setDefaultForegroundColor
)
},
{
LSTRKEY
(
"setDefaultForegroundColor"
),
LFUNCVAL
(
lu8g_setDefaultForegroundColor
)
},
{
LSTRKEY
(
"setFont"
),
LFUNCVAL
(
lu8g_setFont
)
},
{
LSTRKEY
(
"setFont"
),
LFUNCVAL
(
lu8g_setFont
)
},
{
LSTRKEY
(
"setFontLineSpacingFactor"
),
LFUNCVAL
(
lu8g_setFontLineSpacingFactor
)
},
{
LSTRKEY
(
"setFontLineSpacingFactor"
),
LFUNCVAL
(
lu8g_setFontLineSpacingFactor
)
},
{
LSTRKEY
(
"setFontPosBaseline"
),
LFUNCVAL
(
lu8g_setFontPosBaseline
)
},
{
LSTRKEY
(
"setFontPosBaseline"
),
LFUNCVAL
(
lu8g_setFontPosBaseline
)
},
{
LSTRKEY
(
"setFontPosBottom"
),
LFUNCVAL
(
lu8g_setFontPosBottom
)
},
{
LSTRKEY
(
"setFontPosBottom"
),
LFUNCVAL
(
lu8g_setFontPosBottom
)
},
{
LSTRKEY
(
"setFontPosCenter"
),
LFUNCVAL
(
lu8g_setFontPosCenter
)
},
{
LSTRKEY
(
"setFontPosCenter"
),
LFUNCVAL
(
lu8g_setFontPosCenter
)
},
{
LSTRKEY
(
"setFontPosTop"
),
LFUNCVAL
(
lu8g_setFontPosTop
)
},
{
LSTRKEY
(
"setFontPosTop"
),
LFUNCVAL
(
lu8g_setFontPosTop
)
},
{
LSTRKEY
(
"setFontRefHeightAll"
),
LFUNCVAL
(
lu8g_setFontRefHeightAll
)
},
{
LSTRKEY
(
"setFontRefHeightAll"
),
LFUNCVAL
(
lu8g_setFontRefHeightAll
)
},
{
LSTRKEY
(
"setFontRefHeightExtendedText"
),
LFUNCVAL
(
lu8g_setFontRefHeightExtendedText
)
},
{
LSTRKEY
(
"setFontRefHeightExtendedText"
),
LFUNCVAL
(
lu8g_setFontRefHeightExtendedText
)
},
{
LSTRKEY
(
"setFontRefHeightText"
),
LFUNCVAL
(
lu8g_setFontRefHeightText
)
},
{
LSTRKEY
(
"setFontRefHeightText"
),
LFUNCVAL
(
lu8g_setFontRefHeightText
)
},
{
LSTRKEY
(
"setRot90"
),
LFUNCVAL
(
lu8g_setRot90
)
},
{
LSTRKEY
(
"setRot90"
),
LFUNCVAL
(
lu8g_setRot90
)
},
{
LSTRKEY
(
"setRot180"
),
LFUNCVAL
(
lu8g_setRot180
)
},
{
LSTRKEY
(
"setRot180"
),
LFUNCVAL
(
lu8g_setRot180
)
},
{
LSTRKEY
(
"setRot270"
),
LFUNCVAL
(
lu8g_setRot270
)
},
{
LSTRKEY
(
"setRot270"
),
LFUNCVAL
(
lu8g_setRot270
)
},
{
LSTRKEY
(
"setScale2x2"
),
LFUNCVAL
(
lu8g_setScale2x2
)
},
{
LSTRKEY
(
"setScale2x2"
),
LFUNCVAL
(
lu8g_setScale2x2
)
},
{
LSTRKEY
(
"sleepOff"
),
LFUNCVAL
(
lu8g_sleepOff
)
},
{
LSTRKEY
(
"sleepOff"
),
LFUNCVAL
(
lu8g_sleepOff
)
},
{
LSTRKEY
(
"sleepOn"
),
LFUNCVAL
(
lu8g_sleepOn
)
},
{
LSTRKEY
(
"sleepOn"
),
LFUNCVAL
(
lu8g_sleepOn
)
},
{
LSTRKEY
(
"undoRotation"
),
LFUNCVAL
(
lu8g_undoRotation
)
},
{
LSTRKEY
(
"undoRotation"
),
LFUNCVAL
(
lu8g_undoRotation
)
},
{
LSTRKEY
(
"undoScale"
),
LFUNCVAL
(
lu8g_undoScale
)
},
{
LSTRKEY
(
"undoScale"
),
LFUNCVAL
(
lu8g_undoScale
)
},
{
LSTRKEY
(
"__gc"
),
LFUNCVAL
(
lu8g_close_display
)
},
{
LSTRKEY
(
"__gc"
),
LFUNCVAL
(
lu8g_close_display
)
},
{
LSTRKEY
(
"__index"
),
LROVAL
(
lu8g_display_map
)
},
{
LSTRKEY
(
"__index"
),
LROVAL
(
lu8g_display_map
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
const
LUA_REG_TYPE
lu8g_map
[]
=
{
#undef U8G_DISPLAY_TABLE_ENTRY
#undef U8G_DISPLAY_TABLE_ENTRY
#define U8G_DISPLAY_TABLE_ENTRY(device) { LSTRKEY( #device ), LFUNCVAL ( lu8g_ ##device ) },
U8G_DISPLAY_TABLE_I2C
U8G_DISPLAY_TABLE_SPI
// Register fonts
#undef U8G_FONT_TABLE_ENTRY
#undef U8G_FONT_TABLE_ENTRY
#define U8G_FONT_TABLE_ENTRY(font) { LSTRKEY( #font ), LUDATA( (void *)(u8g_ ## font) ) },
U8G_FONT_TABLE
const
LUA_REG_TYPE
lu8g_map
[]
=
{
#define U8G_DISPLAY_TABLE_ENTRY(device) \
// Options for circle/ ellipse drawing
{ LSTRKEY( #device ), LFUNCVAL ( lu8g_ ##device ) },
{
LSTRKEY
(
"DRAW_UPPER_RIGHT"
),
LNUMVAL
(
U8G_DRAW_UPPER_RIGHT
)
},
U8G_DISPLAY_TABLE_I2C
{
LSTRKEY
(
"DRAW_UPPER_LEFT"
),
LNUMVAL
(
U8G_DRAW_UPPER_LEFT
)
},
U8G_DISPLAY_TABLE_SPI
{
LSTRKEY
(
"DRAW_LOWER_RIGHT"
),
LNUMVAL
(
U8G_DRAW_LOWER_RIGHT
)
},
// Register fonts
{
LSTRKEY
(
"DRAW_LOWER_LEFT"
),
LNUMVAL
(
U8G_DRAW_LOWER_LEFT
)
},
#define U8G_FONT_TABLE_ENTRY(font) \
{
LSTRKEY
(
"DRAW_ALL"
),
LNUMVAL
(
U8G_DRAW_ALL
)
},
{ LSTRKEY( #font ), LUDATA( (void *)(u8g_ ## font) ) },
U8G_FONT_TABLE
// Display modes
// Options for circle/ ellipse drawing
{
LSTRKEY
(
"MODE_BW"
),
LNUMVAL
(
U8G_MODE_BW
)
},
{
LSTRKEY
(
"DRAW_UPPER_RIGHT"
),
LNUMVAL
(
U8G_DRAW_UPPER_RIGHT
)
},
{
LSTRKEY
(
"MODE_GRAY2BIT"
),
LNUMVAL
(
U8G_MODE_GRAY2BIT
)
},
{
LSTRKEY
(
"DRAW_UPPER_LEFT"
),
LNUMVAL
(
U8G_DRAW_UPPER_LEFT
)
},
{
LSTRKEY
(
"DRAW_LOWER_RIGHT"
),
LNUMVAL
(
U8G_DRAW_LOWER_RIGHT
)
},
{
LSTRKEY
(
"__metatable"
),
LROVAL
(
lu8g_map
)
},
{
LSTRKEY
(
"DRAW_LOWER_LEFT"
),
LNUMVAL
(
U8G_DRAW_LOWER_LEFT
)
},
{
LNILKEY
,
LNILVAL
}
{
LSTRKEY
(
"DRAW_ALL"
),
LNUMVAL
(
U8G_DRAW_ALL
)
},
// Display modes
{
LSTRKEY
(
"MODE_BW"
),
LNUMVAL
(
U8G_MODE_BW
)
},
{
LSTRKEY
(
"MODE_GRAY2BIT"
),
LNUMVAL
(
U8G_MODE_GRAY2BIT
)
},
{
LSTRKEY
(
"__metatable"
),
LROVAL
(
lu8g_map
)
},
{
LNILKEY
,
LNILVAL
}
};
};
LUALIB_API
int
luaopen_u8g
(
lua_State
*
L
)
LUALIB_API
int
luaopen_u8g
(
lua_State
*
L
)
{
{
luaL_rometatable
(
L
,
"u8g.display"
,
(
void
*
)
lu8g_display_map
);
// create metatable
luaL_rometatable
(
L
,
"u8g.display"
,
(
void
*
)
lu8g_display_map
);
// create metatable
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/modules/uart.c
View file @
b773290b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
#include "lauxlib.h"
#include "lauxlib.h"
#include "platform.h"
#include "platform.h"
#include "auxmods.h"
#include "lrodefs.h"
#include "lrodefs.h"
#include "c_types.h"
#include "c_types.h"
...
@@ -156,16 +155,18 @@ static int uart_write( lua_State* L )
...
@@ -156,16 +155,18 @@ static int uart_write( lua_State* L )
}
}
// Module function map
// Module function map
const
LUA_REG_TYPE
uart_map
[]
=
const
LUA_REG_TYPE
uart_map
[]
=
{
{
{
LSTRKEY
(
"setup"
),
LFUNCVAL
(
uart_setup
)
},
{
LSTRKEY
(
"setup"
),
LFUNCVAL
(
uart_setup
)
},
{
LSTRKEY
(
"write"
),
LFUNCVAL
(
uart_write
)
},
{
LSTRKEY
(
"write"
),
LFUNCVAL
(
uart_write
)
},
{
LSTRKEY
(
"on"
),
LFUNCVAL
(
uart_on
)
},
{
LSTRKEY
(
"on"
),
LFUNCVAL
(
uart_on
)
},
{
LSTRKEY
(
"alt"
),
LFUNCVAL
(
uart_alt
)
},
{
LSTRKEY
(
"alt"
),
LFUNCVAL
(
uart_alt
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
LUALIB_API
int
luaopen_uart
(
lua_State
*
L
)
LUALIB_API
int
luaopen_uart
(
lua_State
*
L
)
{
{
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/modules/wifi.c
View file @
b773290b
...
@@ -1337,96 +1337,95 @@ static int wifi_ap_dhcp_stop( lua_State* L )
...
@@ -1337,96 +1337,95 @@ static int wifi_ap_dhcp_stop( lua_State* L )
}
}
// Module function map
// Module function map
static
const
LUA_REG_TYPE
wifi_station_map
[]
=
static
const
LUA_REG_TYPE
wifi_station_map
[]
=
{
{
{
LSTRKEY
(
"getconfig"
),
LFUNCVAL
(
wifi_station_getconfig
)
},
{
LSTRKEY
(
"getconfig"
),
LFUNCVAL
(
wifi_station_getconfig
)
},
{
LSTRKEY
(
"config"
),
LFUNCVAL
(
wifi_station_config
)
},
{
LSTRKEY
(
"config"
),
LFUNCVAL
(
wifi_station_config
)
},
{
LSTRKEY
(
"connect"
),
LFUNCVAL
(
wifi_station_connect4lua
)
},
{
LSTRKEY
(
"connect"
),
LFUNCVAL
(
wifi_station_connect4lua
)
},
{
LSTRKEY
(
"disconnect"
),
LFUNCVAL
(
wifi_station_disconnect4lua
)
},
{
LSTRKEY
(
"disconnect"
),
LFUNCVAL
(
wifi_station_disconnect4lua
)
},
{
LSTRKEY
(
"autoconnect"
),
LFUNCVAL
(
wifi_station_setauto
)
},
{
LSTRKEY
(
"autoconnect"
),
LFUNCVAL
(
wifi_station_setauto
)
},
{
LSTRKEY
(
"getip"
),
LFUNCVAL
(
wifi_station_getip
)
},
{
LSTRKEY
(
"getip"
),
LFUNCVAL
(
wifi_station_getip
)
},
{
LSTRKEY
(
"setip"
),
LFUNCVAL
(
wifi_station_setip
)
},
{
LSTRKEY
(
"setip"
),
LFUNCVAL
(
wifi_station_setip
)
},
{
LSTRKEY
(
"getbroadcast"
),
LFUNCVAL
(
wifi_station_getbroadcast
)
},
{
LSTRKEY
(
"getbroadcast"
),
LFUNCVAL
(
wifi_station_getbroadcast
)
},
{
LSTRKEY
(
"getmac"
),
LFUNCVAL
(
wifi_station_getmac
)
},
{
LSTRKEY
(
"getmac"
),
LFUNCVAL
(
wifi_station_getmac
)
},
{
LSTRKEY
(
"setmac"
),
LFUNCVAL
(
wifi_station_setmac
)
},
{
LSTRKEY
(
"setmac"
),
LFUNCVAL
(
wifi_station_setmac
)
},
{
LSTRKEY
(
"getap"
),
LFUNCVAL
(
wifi_station_listap
)
},
{
LSTRKEY
(
"getap"
),
LFUNCVAL
(
wifi_station_listap
)
},
{
LSTRKEY
(
"status"
),
LFUNCVAL
(
wifi_station_status
)
},
{
LSTRKEY
(
"status"
),
LFUNCVAL
(
wifi_station_status
)
},
{
LSTRKEY
(
"eventMonReg"
),
LFUNCVAL
(
wifi_station_event_mon_reg
)
},
{
LSTRKEY
(
"eventMonReg"
),
LFUNCVAL
(
wifi_station_event_mon_reg
)
},
{
LSTRKEY
(
"eventMonStart"
),
LFUNCVAL
(
wifi_station_event_mon_start
)
},
{
LSTRKEY
(
"eventMonStart"
),
LFUNCVAL
(
wifi_station_event_mon_start
)
},
{
LSTRKEY
(
"eventMonStop"
),
LFUNCVAL
(
wifi_station_event_mon_stop
)
},
{
LSTRKEY
(
"eventMonStop"
),
LFUNCVAL
(
wifi_station_event_mon_stop
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
static
const
LUA_REG_TYPE
wifi_ap_dhcp_map
[]
=
static
const
LUA_REG_TYPE
wifi_ap_dhcp_map
[]
=
{
{
{
LSTRKEY
(
"config"
),
LFUNCVAL
(
wifi_ap_dhcp_config
)
},
{
LSTRKEY
(
"config"
),
LFUNCVAL
(
wifi_ap_dhcp_config
)
},
{
LSTRKEY
(
"start"
),
LFUNCVAL
(
wifi_ap_dhcp_start
)
},
{
LSTRKEY
(
"start"
),
LFUNCVAL
(
wifi_ap_dhcp_start
)
},
{
LSTRKEY
(
"stop"
),
LFUNCVAL
(
wifi_ap_dhcp_stop
)
},
{
LSTRKEY
(
"stop"
),
LFUNCVAL
(
wifi_ap_dhcp_stop
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
static
const
LUA_REG_TYPE
wifi_ap_map
[]
=
static
const
LUA_REG_TYPE
wifi_ap_map
[]
=
{
{
{
LSTRKEY
(
"config"
),
LFUNCVAL
(
wifi_ap_config
)
},
{
LSTRKEY
(
"config"
),
LFUNCVAL
(
wifi_ap_config
)
},
{
LSTRKEY
(
"getip"
),
LFUNCVAL
(
wifi_ap_getip
)
},
{
LSTRKEY
(
"getip"
),
LFUNCVAL
(
wifi_ap_getip
)
},
{
LSTRKEY
(
"setip"
),
LFUNCVAL
(
wifi_ap_setip
)
},
{
LSTRKEY
(
"setip"
),
LFUNCVAL
(
wifi_ap_setip
)
},
{
LSTRKEY
(
"getbroadcast"
),
LFUNCVAL
(
wifi_ap_getbroadcast
)
},
{
LSTRKEY
(
"getbroadcast"
),
LFUNCVAL
(
wifi_ap_getbroadcast
)
},
{
LSTRKEY
(
"getmac"
),
LFUNCVAL
(
wifi_ap_getmac
)
},
{
LSTRKEY
(
"getmac"
),
LFUNCVAL
(
wifi_ap_getmac
)
},
{
LSTRKEY
(
"setmac"
),
LFUNCVAL
(
wifi_ap_setmac
)
},
{
LSTRKEY
(
"setmac"
),
LFUNCVAL
(
wifi_ap_setmac
)
},
{
LSTRKEY
(
"getclient"
),
LFUNCVAL
(
wifi_ap_listclient
)
},
{
LSTRKEY
(
"getclient"
),
LFUNCVAL
(
wifi_ap_listclient
)
},
{
LSTRKEY
(
"getconfig"
),
LFUNCVAL
(
wifi_ap_getconfig
)
},
{
LSTRKEY
(
"getconfig"
),
LFUNCVAL
(
wifi_ap_getconfig
)
},
{
LSTRKEY
(
"dhcp"
),
LROVAL
(
wifi_ap_dhcp_map
)
},
{
LSTRKEY
(
"dhcp"
),
LROVAL
(
wifi_ap_dhcp_map
)
},
//{ LSTRKEY( "__metatable" ), LROVAL( wifi_ap_map ) },
// { LSTRKEY( "__metatable" ), LROVAL( wifi_ap_map ) },
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
const
LUA_REG_TYPE
wifi_map
[]
=
const
LUA_REG_TYPE
wifi_map
[]
=
{
{
{
LSTRKEY
(
"setmode"
),
LFUNCVAL
(
wifi_setmode
)
},
{
LSTRKEY
(
"setmode"
),
LFUNCVAL
(
wifi_setmode
)
},
{
LSTRKEY
(
"getmode"
),
LFUNCVAL
(
wifi_getmode
)
},
{
LSTRKEY
(
"getmode"
),
LFUNCVAL
(
wifi_getmode
)
},
{
LSTRKEY
(
"getchannel"
),
LFUNCVAL
(
wifi_getchannel
)
},
{
LSTRKEY
(
"getchannel"
),
LFUNCVAL
(
wifi_getchannel
)
},
{
LSTRKEY
(
"setphymode"
),
LFUNCVAL
(
wifi_setphymode
)
},
{
LSTRKEY
(
"setphymode"
),
LFUNCVAL
(
wifi_setphymode
)
},
{
LSTRKEY
(
"getphymode"
),
LFUNCVAL
(
wifi_getphymode
)
},
{
LSTRKEY
(
"getphymode"
),
LFUNCVAL
(
wifi_getphymode
)
},
{
LSTRKEY
(
"sleep"
),
LFUNCVAL
(
wifi_sleep
)
},
{
LSTRKEY
(
"sleep"
),
LFUNCVAL
(
wifi_sleep
)
},
{
LSTRKEY
(
"startsmart"
),
LFUNCVAL
(
wifi_start_smart
)
},
{
LSTRKEY
(
"startsmart"
),
LFUNCVAL
(
wifi_start_smart
)
},
{
LSTRKEY
(
"stopsmart"
),
LFUNCVAL
(
wifi_exit_smart
)
},
{
LSTRKEY
(
"stopsmart"
),
LFUNCVAL
(
wifi_exit_smart
)
},
{
LSTRKEY
(
"sleeptype"
),
LFUNCVAL
(
wifi_sleeptype
)
},
{
LSTRKEY
(
"sleeptype"
),
LFUNCVAL
(
wifi_sleeptype
)
},
{
LSTRKEY
(
"sta"
),
LROVAL
(
wifi_station_map
)
},
{
LSTRKEY
(
"sta"
),
LROVAL
(
wifi_station_map
)
},
{
LSTRKEY
(
"ap"
),
LROVAL
(
wifi_ap_map
)
},
{
LSTRKEY
(
"ap"
),
LROVAL
(
wifi_ap_map
)
},
{
LSTRKEY
(
"NULLMODE"
),
LNUMVAL
(
NULL_MODE
)
},
{
LSTRKEY
(
"NULLMODE"
),
LNUMVAL
(
NULL_MODE
)
},
{
LSTRKEY
(
"STATION"
),
LNUMVAL
(
STATION_MODE
)
},
{
LSTRKEY
(
"STATION"
),
LNUMVAL
(
STATION_MODE
)
},
{
LSTRKEY
(
"SOFTAP"
),
LNUMVAL
(
SOFTAP_MODE
)
},
{
LSTRKEY
(
"SOFTAP"
),
LNUMVAL
(
SOFTAP_MODE
)
},
{
LSTRKEY
(
"STATIONAP"
),
LNUMVAL
(
STATIONAP_MODE
)
},
{
LSTRKEY
(
"STATIONAP"
),
LNUMVAL
(
STATIONAP_MODE
)
},
{
LSTRKEY
(
"PHYMODE_B"
),
LNUMVAL
(
PHY_MODE_11B
)
},
{
LSTRKEY
(
"PHYMODE_B"
),
LNUMVAL
(
PHY_MODE_11B
)
},
{
LSTRKEY
(
"PHYMODE_G"
),
LNUMVAL
(
PHY_MODE_11G
)
},
{
LSTRKEY
(
"PHYMODE_G"
),
LNUMVAL
(
PHY_MODE_11G
)
},
{
LSTRKEY
(
"PHYMODE_N"
),
LNUMVAL
(
PHY_MODE_11N
)
},
{
LSTRKEY
(
"PHYMODE_N"
),
LNUMVAL
(
PHY_MODE_11N
)
},
{
LSTRKEY
(
"NONE_SLEEP"
),
LNUMVAL
(
NONE_SLEEP_T
)
},
{
LSTRKEY
(
"NONE_SLEEP"
),
LNUMVAL
(
NONE_SLEEP_T
)
},
{
LSTRKEY
(
"LIGHT_SLEEP"
),
LNUMVAL
(
LIGHT_SLEEP_T
)
},
{
LSTRKEY
(
"LIGHT_SLEEP"
),
LNUMVAL
(
LIGHT_SLEEP_T
)
},
{
LSTRKEY
(
"MODEM_SLEEP"
),
LNUMVAL
(
MODEM_SLEEP_T
)
},
{
LSTRKEY
(
"MODEM_SLEEP"
),
LNUMVAL
(
MODEM_SLEEP_T
)
},
{
LSTRKEY
(
"OPEN"
),
LNUMVAL
(
AUTH_OPEN
)
},
{
LSTRKEY
(
"OPEN"
),
LNUMVAL
(
AUTH_OPEN
)
},
//{ LSTRKEY( "WEP" ), LNUMVAL( AUTH_WEP ) },
// { LSTRKEY( "WEP" ), LNUMVAL( AUTH_WEP ) },
{
LSTRKEY
(
"WPA_PSK"
),
LNUMVAL
(
AUTH_WPA_PSK
)
},
{
LSTRKEY
(
"WPA_PSK"
),
LNUMVAL
(
AUTH_WPA_PSK
)
},
{
LSTRKEY
(
"WPA2_PSK"
),
LNUMVAL
(
AUTH_WPA2_PSK
)
},
{
LSTRKEY
(
"WPA2_PSK"
),
LNUMVAL
(
AUTH_WPA2_PSK
)
},
{
LSTRKEY
(
"WPA_WPA2_PSK"
),
LNUMVAL
(
AUTH_WPA_WPA2_PSK
)
},
{
LSTRKEY
(
"WPA_WPA2_PSK"
),
LNUMVAL
(
AUTH_WPA_WPA2_PSK
)
},
{
LSTRKEY
(
"STA_IDLE"
),
LNUMVAL
(
STATION_IDLE
)
},
{
LSTRKEY
(
"STA_IDLE"
),
LNUMVAL
(
STATION_IDLE
)
},
{
LSTRKEY
(
"STA_CONNECTING"
),
LNUMVAL
(
STATION_CONNECTING
)
},
{
LSTRKEY
(
"STA_CONNECTING"
),
LNUMVAL
(
STATION_CONNECTING
)
},
{
LSTRKEY
(
"STA_WRONGPWD"
),
LNUMVAL
(
STATION_WRONG_PASSWORD
)
},
{
LSTRKEY
(
"STA_WRONGPWD"
),
LNUMVAL
(
STATION_WRONG_PASSWORD
)
},
{
LSTRKEY
(
"STA_APNOTFOUND"
),
LNUMVAL
(
STATION_NO_AP_FOUND
)
},
{
LSTRKEY
(
"STA_APNOTFOUND"
),
LNUMVAL
(
STATION_NO_AP_FOUND
)
},
{
LSTRKEY
(
"STA_FAIL"
),
LNUMVAL
(
STATION_CONNECT_FAIL
)
},
{
LSTRKEY
(
"STA_FAIL"
),
LNUMVAL
(
STATION_CONNECT_FAIL
)
},
{
LSTRKEY
(
"STA_GOTIP"
),
LNUMVAL
(
STATION_GOT_IP
)
},
{
LSTRKEY
(
"STA_GOTIP"
),
LNUMVAL
(
STATION_GOT_IP
)
},
{
LSTRKEY
(
"__metatable"
),
LROVAL
(
wifi_map
)
},
{
LSTRKEY
(
"__metatable"
),
LROVAL
(
wifi_map
)
},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
LUALIB_API
int
luaopen_wifi
(
lua_State
*
L
)
LUALIB_API
int
luaopen_wifi
(
lua_State
*
L
)
{
{
#if MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2
return
0
;
return
0
;
#else
# error "NodeMCU modules must be build with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
}
}
app/platform/platform.h
View file @
b773290b
...
@@ -243,4 +243,20 @@ int platform_flash_erase_sector( uint32_t sector_id );
...
@@ -243,4 +243,20 @@ int platform_flash_erase_sector( uint32_t sector_id );
void
*
platform_get_first_free_ram
(
unsigned
id
);
void
*
platform_get_first_free_ram
(
unsigned
id
);
void
*
platform_get_last_free_ram
(
unsigned
id
);
void
*
platform_get_last_free_ram
(
unsigned
id
);
// *****************************************************************************
// Helper macros
#define MOD_CHECK_ID( mod, id )\
if( !platform_ ## mod ## _exists( id ) )\
return luaL_error( L, #mod" %d does not exist", ( unsigned )id )
#define MOD_CHECK_TIMER( id )\
if( id == PLATFORM_TIMER_SYS_ID && !platform_timer_sys_available() )\
return luaL_error( L, "the system timer is not available on this platform" );\
if( !platform_timer_exists( id ) )\
return luaL_error( L, "timer %d does not exist", ( unsigned )id )\
#define MOD_CHECK_RES_ID( mod, id, resmod, resid )\
if( !platform_ ## mod ## _check_ ## resmod ## _id( id, resid ) )\
return luaL_error( L, #resmod" %d not valid with " #mod " %d", ( unsigned )resid, ( unsigned )id )
#endif
#endif
Prev
1
2
Next
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