Quantcast
Channel: arm - openFrameworks
Viewing all articles
Browse latest Browse all 147

WiringPiISR Interrupts

$
0
0

Ian wrote:

Hi everyone!
I'm trying to setup WiringPi's interrupts within my openFrameworks app using the wiringPiISR function, documented here:
https://projects.drogon.net/raspberry-pi/wiringpi/functions/

When I compile, I get the following error:

error: cannot convert ‘void (testApp::*)()’ to ‘void (*)()’ for argument ‘3’ to ‘int wiringPiISR(int, int, void (*)())’

Any ideas how I resolve this?

Here's my code:

void testApp::setup(){

wiringPiSetup();

pinMode(0, INPUT);
pinMode(1, INPUT);

pullUpDnControl(0, PUD_UP);
pullUpDnControl(1, PUD_UP);

wiringPiISR(0,INT_EDGE_BOTH, &testApp::updateEncoders);
wiringPiISR(1,INT_EDGE_BOTH, &testApp::updateEncoders);
}

void testApp::updateEncoders(){
pinAValue = digitalRead(0);
pinBValue = digitalRead(1);
}

Any help most appreciated!

My end goal is to get a rotary encoder working with my Raspberry Pi. In my previous tests where everything was in the update loop, several changes in the knobs values were being dropped. I thought this may be due to the rate the pins were being queried, so I figured and interrupt based approach may be better. (I thought wiringPi's baked in functions might be faster than openFrameworks events system.)

Thanks a bunch!

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 147

Trending Articles