Skip to content
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

Question: Does an API exist for implementing an ISR callback? #34

Open
guymcswain opened this issue Feb 8, 2025 · 1 comment
Open

Comments

@guymcswain
Copy link

guymcswain commented Feb 8, 2025

A quick search of lg APIs for 'isr', 'irq', 'interrupt' turned up empty. My purpose for asking is that if such an API (implementing ISR callback) did exist, I would like to 'graft' that code onto the pigpio library to replace the deprecated /sys/class/gpio implementation of gpioSetISRFunc().

For background see joan2937/pigpio#613

@Pereira-Lucas
Copy link

You could use lgGpioSetAlertsFunc

https://abyz.me.uk/lg/lgpio.html#lgGpioSetAlertsFunc

void myInterrupt(int num_alerts, lgGpioAlert_p alerts, void *userdata) {
    // Do something
}
void main() {
    lgGpioSetAlertsFunc(handle, buttonPin, myInterrupt, NULL);
    lgGpioClaimAlert(handle, LG_SET_PULL_DOWN, LG_FALLING_EDGE, buttonPin, -1);
}

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

2 participants