Skip to content

Commit d857738

Browse files
authored
Merge pull request #9229 from timchinowsky/rp2040-time_ns-precision
add subticks to RP2040 port_get_raw_ticks
2 parents aea70d6 + 1a16e6a commit d857738

File tree

1 file changed

+3
-0
lines changed
  • ports/raspberrypi/supervisor

1 file changed

+3
-0
lines changed

ports/raspberrypi/supervisor/port.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ static volatile bool _woken_up;
267267

268268
uint64_t port_get_raw_ticks(uint8_t *subticks) {
269269
uint64_t microseconds = time_us_64();
270+
if (subticks != NULL) {
271+
*subticks = (uint8_t)(((microseconds % 1000000) % 977) / 31);
272+
}
270273
return 1024 * (microseconds / 1000000) + (microseconds % 1000000) / 977;
271274
}
272275

0 commit comments

Comments
 (0)