Skip to content

Commit

Permalink
fixup! fixup! drivers/rtt64: add extended RTT driver for timekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Jun 7, 2022
1 parent 2230ebd commit 53c1f54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/rtt64/rtt64.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
#define RTT_SUBSEC_BITS 13
#elif RTT_FREQUENCY == 16384
#define RTT_SUBSEC_BITS 14
#elif RTT_FREQUENCY == 16384
#define RTT_SUBSEC_BITS 15
#elif RTT_FREQUENCY == 32768
#define RTT_SUBSEC_BITS 15
#elif RTT_FREQUENCY == 65536
#define RTT_SUBSEC_BITS 16
#else
#error Invalid RTT frequency (must be power of 2)
Expand Down Expand Up @@ -106,7 +106,7 @@ static uint64_t _time_to_counter(uint64_t secs, uint32_t us)

static void _counter_to_time(uint64_t now, uint64_t *secs, uint32_t *us)
{
*secs = now >> RTT_SUBSEC_BITS;
*secs = now >> 16;
*us = ((uint64_t)US_PER_SEC * (now & 0xFFFF)) >> 16;
}

Expand Down

0 comments on commit 53c1f54

Please sign in to comment.