I’m sure the answer to this is so silly I’m going to smack myself but I’ve having an issue here.
btnRed = new InterruptPort((Cpu.Pin)17, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeBoth); btnRed.OnInterrupt += new NativeEventHandler(BTN_OnInterrupt);
Fire Event when pressed:
if (state == 0) RedReleased(); else RedPressed();
Nicely wrapped up in a class called InputManager.
Now we create an instance and subscribe to the event
InputManager IM = new InputManager(); IM.RedPressed += new InputManager.RedPressedEventHandler(RedPressed);
Works so nice…
Now let’s say I call out to another class and pass over the InputManager. Easy no? First I unsubscribe:
IM.RedPressed += RedPressed;
Then I pass along the instance and subscribe on the new class. When I exit the class I resubscribe. But does that work properly? Noooooo. InputManager holds on to every freaking event and doesn’t fire jack until I get back to the first class. Setting a break point I see the InterruptPort doesn’t even fire?!