pbuelow
Posts: 2
Joined: Mon Apr 30, 2018 4:21 pm

GPIO Interrupt Context

Mon Feb 22, 2021 10:09 pm

I'm waiting for my first Pico, but I have a question. Is it safe to create a SW timer in the GPIO interrupt context? There is a blocking spinlock in the timer add code once you dig into it, but I don't think that's going to kill the IRQ or cause issues. I won't be servicing interrupts frequently (seconds between, not millis or micros), but thought I might ask.

Thanks.

kilograham
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 342
Joined: Fri Apr 12, 2019 11:00 am
Location: austin tx

Re: GPIO Interrupt Context

Tue Feb 23, 2021 1:11 am

Yes

Code: Select all

 * \note It is safe to call this method from an IRQ handler (including alarm callbacks), and from either core.

pbuelow
Posts: 2
Joined: Mon Apr 30, 2018 4:21 pm

Re: GPIO Interrupt Context

Tue Feb 23, 2021 12:41 pm

Thanks, I read the headline for that function comment but immediately followed it into the C file and skipped the content. More reminders the documentation is there for a reason.

Return to “SDK”