You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I am trying to use interrupts on a raspberry 3b+ with this piece of code:
#include <stdio.h>
#include <stdlib.h>
#include <thread>
#include <signal.h>
#include <sys/time.h>
#include <pigpio.h>
#include <unistd.h>
const int PA= 4; //broche 7
const int port=13;
void onISR(int gpio, int level, uint32_t tick)
{
static int st=0;
gpioWrite(PA, st);
st=1-st;
}
int main(int argc, char **argv) {
if (gpioInitialise() == PI_INIT_FAILED) {
printf("ERROR: Failed to initialize the GPIO interface.\n");
return 1;
}
sleep(1);
int st = gpioSetISRFunc(port, EITHER_EDGE, 1, onISR);
printf("gpioSetISRFunc=%d\n", st);
while (1) {
time_sleep(100);
}
gpioTerminate();
}
When I run the code with raspberry os 11, the code runs fine and the isr occurs.
However when using raspberry os 12 (with a new installation), gpioSetISRFunc returns -123 (PI_BAD_ISR_INIT).
Can you help me to fix this?
The text was updated successfully, but these errors were encountered:
Hello
I am trying to use interrupts on a raspberry 3b+ with this piece of code:
When I run the code with raspberry os 11, the code runs fine and the isr occurs.
However when using raspberry os 12 (with a new installation), gpioSetISRFunc returns -123 (PI_BAD_ISR_INIT).
Can you help me to fix this?
The text was updated successfully, but these errors were encountered: