Skip to content

Commit

Permalink
Kconfig: rename LUA_MODULE_* to C_MODULE_*
Browse files Browse the repository at this point in the history
As we begin to contemplate baking into firmware modules entirely written
in Lua or which are split between both Lua and C, the name LUA_MODULE_*
more obviously refers to the in-Lua bits, so rename the C ones out of
the way.
  • Loading branch information
nwf committed May 30, 2020
1 parent f4887bf commit 1aeb853
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 68 deletions.
10 changes: 5 additions & 5 deletions components/base_nodemcu/include/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@
#define LOCK_IN_SECTION(s) __attribute__((used,unused,section(".lua_" #s)))
#endif
/* For the ROM table, we name the variable according to ( | denotes concat):
* cfgname | _module_selected | CONFIG_LUA_MODULE_##cfgname
* where the CONFIG_LUA_MODULE_XYZ macro is first expanded to yield either
* cfgname | _module_selected | CONFIG_C_MODULE_##cfgname
* where the CONFIG_C_MODULE_XYZ macro is first expanded to yield either
* an empty string (or 1) if the module has been enabled, or the literal
* CONFIG_LUA_MODULE_XYZ in the case it hasn't. Thus, the name of the variable
* CONFIG_C_MODULE_XYZ in the case it hasn't. Thus, the name of the variable
* ends up looking either like XYZ_module_enabled, or if not enabled,
* XYZ_module_enabledCONFIG_LUA_MODULE_XYZ. This forms the basis for
* XYZ_module_enabledCONFIG_C_MODULE_XYZ. This forms the basis for
* letting the build system detect automatically (via nm) which modules need
* to be linked in.
*/
#define NODEMCU_MODULE(cfgname, luaname, map, initfunc) \
const LOCK_IN_SECTION(libs) \
luaR_entry MODULE_PASTE_(lua_lib_,cfgname) = { luaname, LRO_FUNCVAL(initfunc) }; \
const LOCK_IN_SECTION(rotable) \
luaR_entry MODULE_EXPAND_PASTE_(cfgname,MODULE_EXPAND_PASTE_(_module_selected,MODULE_PASTE_(CONFIG_LUA_MODULE_,cfgname))) \
luaR_entry MODULE_EXPAND_PASTE_(cfgname,MODULE_EXPAND_PASTE_(_module_selected,MODULE_PASTE_(CONFIG_C_MODULE_,cfgname))) \
= {luaname, LRO_ROVAL(map ## _map)}
#endif
72 changes: 36 additions & 36 deletions components/modules/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,225 +47,225 @@ depends on LUA_BUILTIN_DEBUG
endmenu


config LUA_MODULE_ADC
config C_MODULE_ADC
bool "ADC module"
default "n"
help
Includes the adc module. This module provides access to the
adc1 hardware.

config LUA_MODULE_BIT
config C_MODULE_BIT
bool "Bit module"
default "n"
help
Includes the bit module. This module provide bit manipulation functions
on Lua numbers.

config LUA_MODULE_BTHCI
config C_MODULE_BTHCI
bool "BlueTooth HCI interface module"
default "n"
select BT_ENABLED
help
Includes the simple BlueTooth HCI module.

config LUA_MODULE_CAN
config C_MODULE_CAN
bool "CAN module"
default "n"
help
Includes the can module.

config LUA_MODULE_CRYPTO
config C_MODULE_CRYPTO
bool "Crypto module"
default "n"
help
Includes the crypto module.

config LUA_MODULE_DAC
config C_MODULE_DAC
bool "DAC module"
default "n"
help
Includes the dac module.

config LUA_MODULE_DHT
config C_MODULE_DHT
bool "DHT11/21/22/AM2301/AM2302 module"
default "n"
help
Includes the dht module.

config LUA_MODULE_ENCODER
config C_MODULE_ENCODER
bool "Encoder module"
default "n"
help
Includes the encoder module. This provides hex and base64 encoding and
decoding functionality.

config LUA_MODULE_ETH
config C_MODULE_ETH
bool "Ethernet module"
default "n"
help
Includes the ethernet module.

config LUA_MODULE_FILE
config C_MODULE_FILE
bool "File module"
default "y"
help
Includes the file module (recommended).

config LUA_MODULE_GPIO
config C_MODULE_GPIO
bool "GPIO module"
default "y"
help
Includes the GPIO module (recommended).

config LUA_MODULE_HTTP
config C_MODULE_HTTP
bool "HTTP module"
default "y"
help
Includes the HTTP module (recommended).

config LUA_MODULE_I2C
config C_MODULE_I2C
bool "I2C module"
default "y"
help
Includes the I2C module (recommended).

config LUA_MODULE_I2S
config C_MODULE_I2S
bool "I2S module"
default "n"
help
Includes the I2S module.

config LUA_MODULE_LEDC
config C_MODULE_LEDC
bool "LEDC module"
default "n"
help
Includes the LEDC module.

config LUA_MODULE_MQTT
config C_MODULE_MQTT
bool "MQTT module"
default "n"
help
Includes the MQTT module.

config LUA_MODULE_NET
config C_MODULE_NET
bool "Net module"
default "y"
help
Includes the net module (recommended).

config LUA_MODULE_NODE
config C_MODULE_NODE
bool "Node module"
default "y"
help
Includes the node module (recommended).

config LUA_MODULE_OW
config C_MODULE_OW
bool "1-Wire module"
default "y"
help
Includes the 1-Wire (ow) module (recommended).

config LUA_MODULE_OTAUPGRADE
config C_MODULE_OTAUPGRADE
bool "Over-The-Air upgrade module"
default "n"
help
Includes the over-the-air firmware upgrade module. Use of this requires
a partition table with at least two OTA partitions, plus the OTA data
partition. See the IDF documentation for details.

config LUA_MODULE_PULSECNT
config C_MODULE_PULSECNT
bool "Pulse counter module"
default "n"
help
Includes the pulse counter module to use ESP32's built-in pulse counting hardware.

config LUA_MODULE_QRCODEGEN
config C_MODULE_QRCODEGEN
bool "QR Code Generator module"
default "n"
help
Includes the QR Code Generator from
https://www.nayuki.io/page/qr-code-generator-library

config LUA_MODULE_SDMMC
config C_MODULE_SDMMC
bool "SD-MMC module"
default "n"
help
Includes the sdmmc module.

config LUA_MODULE_SIGMA_DELTA
config C_MODULE_SIGMA_DELTA
bool "Sigma-Delta module"
default "n"
help
Includes the sigma_delta module. This module provides access to the
sigma-delta hardware.

config LUA_MODULE_SJSON
config C_MODULE_SJSON
bool "SJSON module"
default "n"
help
Includes the sjson module.

config LUA_MODULE_SODIUM
config C_MODULE_SODIUM
bool "Sodium module"
default "n"
help
Includes the libsodium crypto module.

config LUA_MODULE_SPI
config C_MODULE_SPI
bool "SPI module"
default "n"
help
Includes the spi module.

config LUA_MODULE_STRUCT
config C_MODULE_STRUCT
bool "Struct module"
default "n"
help
Includes the struct module. This module provides [un]packing of raw
byte strings into Lua values and vice versa.

config LUA_MODULE_TMR
config C_MODULE_TMR
bool "Timer module"
default "y"
help
Includes the timer module (recommended).

config LUA_MODULE_TOUCH
config C_MODULE_TOUCH
bool "Touch module"
default "n"
help
Includes the touch module to use ESP32's built-in touch sensor hardware.

config LUA_MODULE_U8G2
config C_MODULE_U8G2
bool "U8G2 module"
default "n"
help
Includes the u8g2 module.

source "$PROJECT_PATH/components/u8g2/u8g2.kconfig"

config LUA_MODULE_UCG
config C_MODULE_UCG
bool "UCG module"
default "n"
select LUA_MODULE_SPI
select C_MODULE_SPI
help
Includes the ucg module.

source "$PROJECT_PATH/components/ucg/ucg.kconfig"

config LUA_MODULE_WIFI
config C_MODULE_WIFI
bool "WiFi module"
default "y"
help
Includes the WiFi module (recommended).

config LUA_MODULE_WS2812
config C_MODULE_WS2812
bool "WS2812 module"
default "n"
help
Includes the ws2812 module.

config LUA_MODULE_TIME
config C_MODULE_TIME
bool "Time module"
default "n"
help
Expand Down
2 changes: 1 addition & 1 deletion components/modules/bthci.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

#include "sdkconfig.h"
#ifdef CONFIG_LUA_MODULE_BTHCI
#ifdef CONFIG_C_MODULE_BTHCI

#include "module.h"
#include "lauxlib.h"
Expand Down
6 changes: 3 additions & 3 deletions components/modules/component.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Match up all the module source files with their corresponding Kconfig
# option in the form LUA_MODULE_<modname> and if enabled, add a
# option in the form C_MODULE_<modname> and if enabled, add a
# "-u <modname>_module_selected1" option to force the linker to include
# the module. See components/core/include/module.h for further details on
# how this works.
Expand All @@ -13,8 +13,8 @@ ifneq (4.0, $(firstword $(sort $(MAKE_VERSION) 4.0)))
endif

MODULE_NAMES:=$(call uppercase,$(patsubst $(COMPONENT_PATH)/%.c,%,$(wildcard $(COMPONENT_PATH)/*.c)))
FORCE_LINK:=$(foreach mod,$(MODULE_NAMES),$(if $(CONFIG_LUA_MODULE_$(mod)), -u $(mod)_module_selected1))
COMPONENT_ADD_LDFLAGS=$(FORCE_LINK) -lmodules $(if $(CONFIG_LUA_MODULE_BTHCI),-lbtdm_app)
FORCE_LINK:=$(foreach mod,$(MODULE_NAMES),$(if $(CONFIG_C_MODULE_$(mod)), -u $(mod)_module_selected1))
COMPONENT_ADD_LDFLAGS=$(FORCE_LINK) -lmodules $(if $(CONFIG_C_MODULE_BTHCI),-lbtdm_app)

# These are disabled by default in the IDF, so switch them back on
CFLAGS += \
Expand Down
2 changes: 1 addition & 1 deletion components/modules/u8g2.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "sdkconfig.h"
#endif

#ifndef CONFIG_LUA_MODULE_U8G2
#ifndef CONFIG_C_MODULE_U8G2
// ignore unused functions if u8g2 module will be skipped anyhow
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
Expand Down
2 changes: 1 addition & 1 deletion components/modules/ucg.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "sdkconfig.h"
#endif

#ifndef CONFIG_LUA_MODULE_UCG
#ifndef CONFIG_C_MODULE_UCG
// ignore unused functions if ucg module will be skipped anyhow
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
Expand Down
2 changes: 1 addition & 1 deletion components/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ config LUA_EMBEDDED_FLASH_STORE
config BUILD_FATFS
bool "Support for FAT filesystems"
default "n"
select LUA_MODULE_SDMMC
select C_MODULE_SDMMC
help
Include support for accessing FAT filesystems on SD cards.

Expand Down
10 changes: 5 additions & 5 deletions components/u8g2/u8g2.kconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
menu "Displays"
depends on LUA_MODULE_U8G2
depends on C_MODULE_U8G2

menuconfig U8G2_COMM_I2C
bool "I2C"
select LUA_MODULE_I2C
select C_MODULE_I2C
default "y"

config U8G2_I2C_LD7032_60X32
Expand Down Expand Up @@ -204,7 +204,7 @@ config U8G2_I2C_UC1611_EW50850

menuconfig U8G2_COMM_SPI
bool "SPI"
select LUA_MODULE_SPI
select C_MODULE_SPI
default "y"

config U8G2_SPI_HX1230_96X68
Expand Down Expand Up @@ -625,10 +625,10 @@ config U8G2_SPI_UC1701_MINI12864
endmenu

menu "Fonts"
depends on LUA_MODULE_U8G2
depends on C_MODULE_U8G2

config U8G2_FONT_SELECTION
depends on LUA_MODULE_U8G2
depends on C_MODULE_U8G2
string "Font list"
default "font_6x10_tf,font_unifont_t_symbols"
help
Expand Down
Loading

0 comments on commit 1aeb853

Please sign in to comment.