added functions to vesc_c_if

This commit is contained in:
Joel Svensson 2022-08-27 14:08:48 +02:00
parent 757e5c563a
commit 7f8a7b2aec
3 changed files with 16 additions and 0 deletions

View File

@ -27,6 +27,7 @@
typedef uint32_t lbm_value;
typedef uint32_t lbm_type;
typedef uint32_t lbm_cid;
typedef uint32_t lbm_uint;
typedef int32_t lbm_int;

View File

@ -279,6 +279,14 @@ typedef struct {
bool (*uart_start)(uint32_t baudrate, bool half_duplex);
bool (*uart_write)(uint8_t *data, uint32_t size);
int32_t (*uart_read)(void);
// LBM
char* (*lbm_dec_str)(lbm_value);
int (*lbm_add_symbol_const)(char *, lbm_uint *);
void (*lbm_block_ctx_from_extension)(void);
bool (*lbm_unblock_ctx)(lbm_cid, lbm_value);
lbm_cid (*lbm_get_current_cid)(void);
} vesc_c_if;
typedef struct {

View File

@ -486,6 +486,13 @@ lbm_value ext_load_native_lib(lbm_value *args, lbm_uint argn) {
cif.cif.uart_write = lib_uart_write;
cif.cif.uart_read = lib_uart_read;
//LBM
cif.cif.lbm_dec_str = lbm_dec_str;
cif.cif.lbm_add_symbol_const = lbm_add_symbol_const;
cif.cif.lbm_block_ctx_from_extension = lbm_block_ctx_from_extension;
cif.cif.lbm_unblock_ctx = lbm_unblock_ctx;
cif.cif.lbm_get_current_cid = lbm_get_current_cid;
lib_init_done = true;
}