diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-02-15 19:18:51 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-06-09 18:58:35 -0400 |
commit | 620f77ddb79de683befb458f43c30435759ac0e2 (patch) | |
tree | ced439210a3e5885a4c9eaa35b1008586811730b /klippy/chelper/msgblock.h | |
parent | f938caa0d23f91c6fbf416334441e64e6739bbc7 (diff) | |
download | kutter-620f77ddb79de683befb458f43c30435759ac0e2.tar.gz kutter-620f77ddb79de683befb458f43c30435759ac0e2.tar.xz kutter-620f77ddb79de683befb458f43c30435759ac0e2.zip |
msgblock: Add clock estimation helper functions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper/msgblock.h')
-rw-r--r-- | klippy/chelper/msgblock.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/klippy/chelper/msgblock.h b/klippy/chelper/msgblock.h index 2d2967eb..43ee9532 100644 --- a/klippy/chelper/msgblock.h +++ b/klippy/chelper/msgblock.h @@ -34,6 +34,11 @@ struct queue_message { struct list_node node; }; +struct clock_estimate { + uint64_t last_clock, conv_clock; + double conv_time, est_freq; +}; + uint16_t msgblock_crc16_ccitt(uint8_t *buf, uint8_t len); int msgblock_check(uint8_t *need_sync, uint8_t *buf, int buf_len); int msgblock_decode(uint32_t *data, int data_len, uint8_t *msg, int msg_len); @@ -42,5 +47,8 @@ struct queue_message *message_fill(uint8_t *data, int len); struct queue_message *message_alloc_and_encode(uint32_t *data, int len); void message_free(struct queue_message *qm); void message_queue_free(struct list_head *root); +uint64_t clock_from_clock32(struct clock_estimate *ce, uint32_t clock32); +double clock_to_time(struct clock_estimate *ce, uint64_t clock); +uint64_t clock_from_time(struct clock_estimate *ce, double time); #endif // msgblock.h |