Added system_time_ticks to C interface

This commit is contained in:
Benjamin Vedder 2024-02-29 10:17:06 +01:00
parent fd958d59a2
commit 4b15ea9385
2 changed files with 7 additions and 0 deletions

View File

@ -611,6 +611,10 @@ typedef struct {
// Unblock unboxed
bool (*lbm_unblock_ctx_unboxed)(lbm_cid cid, lbm_value unboxed);
// Time since boot in system ticks. Resolution: 100 uS.
// Use ts_to_age_s to get the age of a timestamp in
// seconds. ts_to_age_s should hanlde overflows.
systime_t (*system_time_ticks)(void);
} vesc_c_if;
typedef struct {

View File

@ -932,6 +932,9 @@ lbm_value ext_load_native_lib(lbm_value *args, lbm_uint argn) {
// Unblock unboxed
cif.cif.lbm_unblock_ctx_unboxed = lbm_unblock_ctx_unboxed;
// System time
cif.cif.system_time_ticks = chVTGetSystemTimeX;
lib_init_done = true;
}