I have used the IO module to generate interrupts on button clicks, but the IO module sometimes works for 15hours, then sometimes it locks up 5 times a day.
The only thing that helps is sending the reset command to the module ( and most of the time I need to send it 2 times) because the first time does not resolve the issue.
So my setup is IO module connected to socket 5 and the fez hydra has a network firmware with the ENC28 connected to network.
I saw that Ian driver on GitHub supports Hardware I2C because it seems like a timing issue on the software I2C bus. But when I enable the hardware bus the interrupts won’t even trigger… On the scope I see the commands being send and I can set other ports as output and see them change on my scope…
I created a basic test project with the following code and this is not working:
Added the source of Ian driver from Github and added HARDWARE_I2C as compile option. I used to extender modules to rewire the X socket to I.
IO Hydra
1 ---------- 1
2 ---------- 2
3 ---------- 3
4 ---------- 9
5 ---------- 8
10 ---------- 10
public partial class Program
{
private static bool _ledOn;
private IO60P16Module _io60P16Module;
private InterruptPort _interruptPort;
void ProgramStarted()
{
Debug.Print("Program Started");
_io60P16Module = new IO60P16Module(5);
_interruptPort = new InterruptPort(_io60P16Module, IOPin.Port0_Pin0, ResistorMode.ResistivePullDown, InterruptMode.RisingEdge);
_interruptPort.OnInterrupt += interruptPort_OnInterrupt;
}
void interruptPort_OnInterrupt(IOPin pin, bool pinState, DateTime timestamp)
{
Debug.Print("int!!!");
_ledOn = !_ledOn;
Mainboard.SetDebugLED(_ledOn);
}
}
}