Current Lua downloadable firmware will be posted here

User avatar
By alonewolfx2
#9665 i am trying to add pcd8544 module in nodemcu firmware but i cant register "pcd8544" function. i wish to use something like this "pcd8544.init()" or "pcd8544.print("test")" but i cant do this.
i added this in auxmods.h
Code: Select all#define AUXLIB_PCD8544      "pcd8544"
LUALIB_API int ( luaopen_pcd8544 )( lua_State *L );

i added this in userconfig.h
Code: Select all#define LUA_USE_MODULES_PCD8544

also i added subdir and component i makefile and
i added this end of the pcd8544.c file
Code: Select all// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE pcd8544_map[] =
{
  { LSTRKEY( "init" ), LFUNCVAL( pcd8544_setup ) },

#if LUA_OPTIMIZE_MEMORY > 0

#endif
  { LNILKEY, LNILVAL }
};

LUALIB_API int luaopen_pcd8544( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
  return 0;
#else // #if LUA_OPTIMIZE_MEMORY > 0
  luaL_register( L, AUXLIB_PCD8544, pcd8544_map );
  return 1;
#endif // #if LUA_OPTIMIZE_MEMORY > 0
}

and i added this in modules.h
Code: Select all#if defined(LUA_USE_MODULES_PCD8544)
#define MODULES_PCD8544       "pcd8544"
#define ROM_MODULES_PCD8544   \
    _ROM(MODULES_PCD8544, luaopen_pcd8544, pcd8544_map)
#else
#define ROM_MODULES_PCD8544
#endif

what am i missig?
User avatar
By pracas
#10688 Did you manage to figure it out? I'm struck on this as well. infact i did manage to register and run a module successfully but absent mindedly deleted the whole folder. Now back on this. It seems to be a small oversigth somewhere.