Jump to content

Oragnepi zero Plus H5 ISR Problem


moonki123

Recommended Posts

Hi i wonder why ISR result is strange

 

first i test in orangepi zero Plus H5

that result is repeated infinite recall function   

summary - recall infinite function if i input interrupt pin(button)

 

i test

result repeat

second i test in orangepi zero(H2)

that result is only called function once

 

#include <wiringPi.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

void signal_both(void){
  printf("Signal Both\n");
}void signal_falling(void){
  printf("Signal Falling\n");
}void signal_rising(void){
  printf("Signal Rising\n");
}int main(int argc, char **argv){
  int mode=INT_EDGE_BOTH;
  int pin = 0;
  if(wiringPiSetup() == -1) {
    printf("wiringPiSetup Error\n");
  }
  if (argc == 2) {
    mode = atoi(argv[1]);
  }
  if (argc == 3) {
    mode = atoi(argv[1]);
    pin = atoi(argv[2]);
  }
  pinMode(pin,INPUT);
  printf("pin=%d\n",pin);
  if ( mode == INT_EDGE_BOTH) {
    printf("INT_EDGE_BOTH\n");
    wiringPiISR(pin, INT_EDGE_BOTH, signal_both );
  } else if ( mode == INT_EDGE_FALLING) {
    printf("INT_EDGE_FALLING\n");
    wiringPiISR(pin, INT_EDGE_FALLING, signal_falling );
  } else if ( mode == INT_EDGE_RISING) {
    printf("INT_EDGE_RISING\n");
    wiringPiISR(pin, INT_EDGE_RISING, signal_rising );
  }
  while(1) {
    sleep(10000);
  }
  return 0;
}

 

can you explain why result is different?

code is same in Orange Pi Zero and Orange Pi Zero Plus H5

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines