mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-07-30 00:39:15 +02:00
crc?
This commit is contained in:
@@ -406,6 +406,13 @@ int lua_get_available_rds_streams(lua_State *localL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int lua_crc16(lua_State *localL) {
|
||||
size_t len;
|
||||
const char* data = luaL_checklstring(localL, 1, &len);
|
||||
lua_pushinteger(localL, crc16_ccitt(data, len));
|
||||
return 1;
|
||||
}
|
||||
|
||||
void init_lua(RDSModulator* rds_mod) {
|
||||
static int mutex_initialized = 0;
|
||||
mod = rds_mod;
|
||||
@@ -524,6 +531,8 @@ void init_lua(RDSModulator* rds_mod) {
|
||||
lua_register(L, "get_userdata", lua_get_userdata);
|
||||
lua_register(L, "get_userdata_offset", lua_get_userdata_offset);
|
||||
|
||||
lua_register(L, "crc16", lua_crc16);
|
||||
|
||||
if (luaL_loadfile(L, "/etc/rds95.lua") != LUA_OK) {
|
||||
fprintf(stderr, "Lua error loading file: %s\n", lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
|
||||
Reference in New Issue
Block a user