Builds now. Uses Serial3 as log output. ls
This commit is contained in:
parent
c0e256e230
commit
da977a7ca6
2 changed files with 8 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
|||
// This line defines a "Uart" object to access the serial port
|
||||
// HardwareSerial CommOut = HardwareSerial();
|
||||
// usb_serial_class LogOut = Serial;
|
||||
#include "HardwareSerial.h"
|
||||
#define LogOut Serial3
|
||||
#define LOG_RINGSIZE 4096
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "log.h"
|
||||
#include "lua.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
extern "C" {
|
||||
#include "lua.h"
|
||||
|
@ -7,6 +8,7 @@ extern "C" {
|
|||
#include "lauxlib.h"
|
||||
#include "lua-alloc.h"
|
||||
|
||||
|
||||
/*These three are needed for stubs because something for some god awful reason wants them. Can't find the source of them and they're easier to fix this way*/
|
||||
int _kill(pid_t pid, int sig) {return 0;}
|
||||
int _getpid() {return 1;}
|
||||
|
@ -95,7 +97,7 @@ static void l_memstats() {
|
|||
|
||||
// CREATE ARRAY TYPE AND EXPOSE led_data TO LUA.
|
||||
// metatable method for handling "array[index]"
|
||||
static int led_data_index (lua_State* L) {
|
||||
/* static int led_data_index (lua_State* L) {
|
||||
CRGB** parray = (CRGB **) luaL_checkudata(L, 1, "led_data");
|
||||
int index = luaL_checkint(L, 2);
|
||||
lua_pushnumber(L, (*parray)[index-1]);
|
||||
|
@ -109,7 +111,7 @@ static int led_data_newindex (lua_State* L) {
|
|||
int value = luaL_checkint(L, 3);
|
||||
(*parray)[index-1] = value;
|
||||
return 0;
|
||||
}
|
||||
} */
|
||||
|
||||
void l_yield(lua_State *L, lua_Debug *ar) {
|
||||
lua_yield(L, 0);
|
||||
|
@ -151,7 +153,7 @@ int full_run(lua_State *L, lua_State *t) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
static const struct luaL_Reg led_data_metamethods[] = {
|
||||
/* static const struct luaL_Reg led_data_metamethods[] = {
|
||||
{ "__index", led_data_index },
|
||||
{ "__newindex", led_data_newindex },
|
||||
{NULL, NULL}
|
||||
|
@ -186,7 +188,7 @@ int luaopen_array (lua_State* L) {
|
|||
// make our test routine available to Lua
|
||||
lua_register(L, "led_data", getarray);
|
||||
return 0;
|
||||
}
|
||||
} */
|
||||
|
||||
// This code blatantly stolen and borrowed from lbaselib.c luaB_print
|
||||
static int l_print (lua_State *L) {
|
||||
|
@ -260,7 +262,7 @@ void l_start(const char *prgm) {
|
|||
debug_log("Importing libraries");
|
||||
|
||||
l_openlibs(L);
|
||||
luaopen_array(L);
|
||||
// luaopen_array(L);
|
||||
lua_pushcfunction(L, l_print);
|
||||
lua_setglobal(L, "print");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue