spi.c 593 B

123456789101112131415161718192021222324
  1. // Module for interfacing with the SPI interface
  2. #include "module.h"
  3. #include "lauxlib.h"
  4. #include "spi_common.h"
  5. #include "driver/spi_common.h"
  6. static const LUA_REG_TYPE lspi_map[] = {
  7. { LSTRKEY( "master" ), LFUNCVAL( lspi_master ) },
  8. // { LSTRKEY( "slave" ), LFUNCVAL( lspi_slave ) },
  9. { LSTRKEY( "SPI" ), LNUMVAL( SPI_HOST ) },
  10. { LSTRKEY( "HSPI" ), LNUMVAL( HSPI_HOST ) },
  11. { LSTRKEY( "VSPI" ), LNUMVAL( VSPI_HOST ) },
  12. {LNILKEY, LNILVAL}
  13. };
  14. int luaopen_spi( lua_State *L ) {
  15. luaopen_spi_master( L );
  16. return 0;
  17. }
  18. NODEMCU_MODULE(SPI, "spi", lspi_map, luaopen_spi);