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

inGPIO.waitForEdge() leads to hang in program execution #30

Open
0xsubh opened this issue Oct 18, 2022 · 0 comments
Open

inGPIO.waitForEdge() leads to hang in program execution #30

0xsubh opened this issue Oct 18, 2022 · 0 comments

Comments

@0xsubh
Copy link

0xsubh commented Oct 18, 2022

Hi, I am trying to poll the GPIO pins and slightly modified the chp06/gpio/tests/test_syspoll.cpp as follows:

#include<iostream>
#include<unistd.h>
#include"GPIO.h"
using namespace exploringBB;
using namespace std;

int main(){
   GPIO outGPIO(44), inGPIO(45);
   inGPIO.setDirection(INPUT);    //button is an input
   outGPIO.setDirection(OUTPUT);  //LED is an output
   for(int i=0;i<100;i++)
   {
      outGPIO.setValue(HIGH);
      usleep(10);
      outGPIO.setValue(LOW);
      cout<< endl <<"toggle done";

      // poll the echo pin to go high
      inGPIO.setEdgeType(FALLING);   //wait for rising edge
      inGPIO.waitForEdge();          //will wait forever
      cout<< endl <<"checkpoint";
      usleep(1000*100);
   }
   return 0;
}

I am unable to debug this problem

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

1 participant