This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Convert incoming BLE-MIDI timestamp to localtime, or delay. | |
* Timestamp out is in microseconds.*/ | |
static uint16_t convert_timestamp(uint16_t received_ts, uint16_t conn_interval, uint16_t time_of_rx) { | |
static uint16_t prev_received_ts; | |
static uint32_t prev_time_of_rx; | |
static uint32_t prev_returned_ts; | |
static bool first_timestamp = true; | |
if (first_timestamp) { | |
prev_time_of_rx = time_of_rx; |