Skip to content

Commit

Permalink
Merge pull request #20580 from maribu/backport/2024.04/cpu/msp430/tim…
Browse files Browse the repository at this point in the history
…er-query

cpu/msp430/periph_timer: fix timer_query_freqs() [backport 2024.04]
  • Loading branch information
Teufelchen1 authored Apr 23, 2024
2 parents bd8c054 + 11fe9b8 commit a8069ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpu/msp430/periph/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ uint32_t timer_query_freqs(tim_t dev, uword_t index)
assume((clock_source == TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK) ||
(clock_source == TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK));

if (index > TXID_DIV_MAX) {
return 0;
}

uint32_t clock_freq;
switch (clock_source) {
default:
Expand Down
2 changes: 2 additions & 0 deletions tests/periph/timer/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ static void print_supported_frequencies(tim_t dev)
" %u: %" PRIu32 "\n",
(unsigned)(end - 1), timer_query_freqs(dev, end - 1));
}

expect(timer_query_freqs(dev, end) == 0);
}

int main(void)
Expand Down

0 comments on commit a8069ca

Please sign in to comment.