Skip to content

Missing import in sleep.h? #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
a-mueller opened this issue Mar 3, 2025 · 2 comments
Open

Missing import in sleep.h? #89

a-mueller opened this issue Mar 3, 2025 · 2 comments

Comments

@a-mueller
Copy link

I am pretty new to C so this might be stupid.

I am using a RP2040 and I am trying to go dormant. When using sleep_run_from_xosc it complains that hardware_alarm_callback_t is not defined in this scope. Adding #include "hardware/timer.h" to pico-extras/src/rp2_common/pico_sleep/include/pico/sleep.h will fix it but I am pretty sure some kind of test would have caught that the whole thing doesn't compile. Anything I am doing wrong here?

Thanks

@lurch
Copy link
Contributor

lurch commented Mar 4, 2025

ping @peterharperuk as he was the last person to edit the pico_sleep code 😴 (in #79 ).

I am pretty sure some kind of test would have caught that the whole thing doesn't compile.

The code in pico-extras (and pico-playground) is unsupported / experimental, and so it gets much less testing than the code in pico-sdk and pico-examples.

@peterharperuk
Copy link
Contributor

Yes, good catch. The test code builds fine but it has #include "pico/stdlib.h" before #include "pico/sleep.h" which includes "hardware/timer.h" for us. As a workaround just include it before including sleep.h and I'll push a fix.

peterharperuk added a commit to peterharperuk/pico-extras that referenced this issue Mar 5, 2025
If you include sleep.h first you get a compile error as
hardware_alarm_callback_t is not defined. Fix this by including the
appropriate header.

Fixes raspberrypi#89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants