blob: 6c5e219ab0ed3f37ebf2176da9717e4de8ade89e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "rtoslib.h"
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
static int ldelay(lua_State *L)
{
int ms = luaL_checkinteger(L, 1);
vTaskDelay(pdMS_TO_TICKS(ms));
return 0;
}
static const struct luaL_Reg lrtos_funcs[] = {
{ "delay", ldelay },
{ NULL, NULL }
};
int luaopen_lrtos(lua_State *L)
{
luaL_newlib(L, lrtos_funcs);
return 1;
}
|