Skip to content

Commit 9f95a46

Browse files
authored
fix pico_time_test.c compile on native (#2207)
1 parent f20663c commit 9f95a46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/pico_time_test/pico_time_test.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <stdlib.h>
99
#include <string.h>
1010
#include <hardware/sync.h>
11+
#if PICO_ON_DEVICE
1112
#include "hardware/clocks.h"
13+
#endif
1214
#include "pico/stdlib.h"
1315
#include "pico/test.h"
1416
// Include sys/types.h before inttypes.h to work around issue with
@@ -342,10 +344,12 @@ static bool timer_callback_issue_2118(repeating_timer_t *rt) {
342344
int issue_2118_test(void) {
343345
PICOTEST_START_SECTION("Issue #2118 defect - failure to set an alarm");
344346

347+
#if PICO_ON_DEVICE
345348
// this problem only happens when running the clock fast as it requires the time between
346349
// alarm_pool_irq_handler handling an alarm and setting the next alarm to be <1us
347350
set_sys_clock_hz(200 * MHZ, true);
348351
setup_default_uart();
352+
#endif
349353

350354
alarm_pool_t *pool = alarm_pool_create(2, 1);
351355
repeating_timer_t timer;
@@ -359,10 +363,11 @@ int issue_2118_test(void) {
359363
PICOTEST_CHECK(counter_2118 >= 100, "Repeating timer failure");
360364

361365
alarm_pool_destroy(pool);
366+
#if PICO_ON_DEVICE
362367
hard_assert(timer_hw->armed == 0); // check destroying the pool unarms its timer
363-
364368
set_sys_clock_hz(SYS_CLK_HZ, true);
365369
setup_default_uart();
370+
#endif
366371

367372
PICOTEST_END_SECTION();
368373
return 0;

0 commit comments

Comments
 (0)