sipeed / Maixduino

Arduino port on Maix board ( k210 )
https://maixduino.sipeed.com
Other
215 stars 95 forks source link

Only last attachInterrupt gets called #88

Open Gerharddc opened 4 years ago

Gerharddc commented 4 years ago

I want to run 4 different ISR for 4 different pins and am currently setting this up using

void setup()
{
  pinMode(LeftA, INPUT);
  pinMode(LeftB, INPUT);
  pinMode(RightA, INPUT);
  pinMode(RightB, INPUT);

  attachInterrupt(LeftA, callback_LeftA, RISING);
  attachInterrupt(LeftB, callback_LeftB, RISING);
  attachInterrupt(RightA, callback_RightA, RISING);
  attachInterrupt(RightB, callback_RightB, RISING);

  Serial.begin(9600);
}

but only "callback_RightB" ever gets called. If I comment out any 3 of the 4 "attachInterrupt" interrupt calls then the one left uncommented does actually work but if more than one is uncommented, only the last one works.

I am testing on an Maixduino programmed using PlatformIO with the Arduino framework if it makes any difference and the pins are defined as

#define LeftA 21
#define LeftB 22
#define RightA 23
#define RightB 24

but using other pins does not make a difference.