Skip to content

Commit

Permalink
Merge pull request #9229 from timchinowsky/rp2040-time_ns-precision
Browse files Browse the repository at this point in the history
add subticks to RP2040 port_get_raw_ticks
  • Loading branch information
tannewt committed May 13, 2024
2 parents aea70d6 + 1a16e6a commit d857738
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ports/raspberrypi/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ static volatile bool _woken_up;

uint64_t port_get_raw_ticks(uint8_t *subticks) {
uint64_t microseconds = time_us_64();
if (subticks != NULL) {
*subticks = (uint8_t)(((microseconds % 1000000) % 977) / 31);
}
return 1024 * (microseconds / 1000000) + (microseconds % 1000000) / 977;
}

Expand Down

0 comments on commit d857738

Please sign in to comment.