14#include <asm/byteorder.h>
25#define VIVE_TRACE(d, ...) U_LOG_IFL_T(d->log_level, __VA_ARGS__)
26#define VIVE_DEBUG(d, ...) U_LOG_IFL_D(d->log_level, __VA_ARGS__)
27#define VIVE_INFO(d, ...) U_LOG_IFL_I(d->log_level, __VA_ARGS__)
28#define VIVE_WARN(d, ...) U_LOG_IFL_W(d->log_level, __VA_ARGS__)
29#define VIVE_ERROR(d, ...) U_LOG_IFL_E(d->log_level, __VA_ARGS__)
33#define VIVE_CLOCK_FREQ 48e6
34#define CAMERA_FREQUENCY 54
35#define IMU_FREQUENCY 1000
50 uint32_t sample_ticks = __le32_to_cpu(sample_ticks_raw);
51 uint32_t prev_ticks = *inout_prev_ticks;
56 uint32_t delta_ticks = sample_ticks - prev_ticks;
58 const double one_tick_in_s = (1 / VIVE_CLOCK_FREQ);
62 *inout_prev_ticks = sample_ticks;
63 *inout_ts_ns += delta_ns;
@ U_LOGGING_WARN
Warning messages: indicating a potential problem.
Definition: u_logging.h:47
int64_t timepoint_ns
Integer timestamp type.
Definition: u_time.h:70
int64_t time_duration_ns
Integer duration type in nanoseconds.
Definition: u_time.h:81
Time-keeping: a clock that is steady, convertible to system time, and ideally high-resolution.
#define U_TIME_1S_IN_NS
The number of nanoseconds in a second.
Definition: u_time.h:47
static void ticks_to_ns(uint32_t sample_ticks_raw, uint32_t *inout_prev_ticks, timepoint_ns *inout_ts_ns)
Helper function to convert raw device ticks to nanosecond timestamps.
Definition: vive.h:48