You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nice work, I added the two interrupt methods, maybe you want to add them as well.
Use the following to compile the base so:
cc -shared wiringPi.o -o libwiringPi.so -lwiringPi
PiThreadInterrupts Class:
[DllImport("libwiringPi.so", EntryPoint = "waitForInterrupt")]
///Obsolete, use wiringPilSR
public static extern int waitForInterrupt(int p_pin, int p_timeout);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InterruptCallback();
[DllImport("libwiringPi.so", EntryPoint = "wiringPiISR")]
public static extern int wiringPiISR(int p_pin, int p_edgeType, [MarshalAs(UnmanagedType.FunctionPtr)] InterruptCallback p_callback);
Call:
if(WiringPi.PiThreadInterrupts.waitForInterrupt(8, -1) > 0) //only works in Sys mode! (WiringPi.Init.WiringPiSetupSys();)
{
Console.WriteLine("interrupt");
}
WiringPi.PiThreadInterrupts.wiringPiISR(8, (int)WiringPi.PiThreadInterrupts.Edge.INT_EDGE_RISING, new WiringPi.PiThreadInterrupts.InterruptCallback(Callback));
The text was updated successfully, but these errors were encountered:
Nice work, I added the two interrupt methods, maybe you want to add them as well.
Use the following to compile the base so:
cc -shared wiringPi.o -o libwiringPi.so -lwiringPi
PiThreadInterrups Class:
public enum Edge { INT_EDGE_SETUP = 0, INT_EDGE_FALLING = 1, INT_EDGE_RISING = 2, INT_EDGE_BOTH = 3}
PiThreadInterrupts Class:
[DllImport("libwiringPi.so", EntryPoint = "waitForInterrupt")]
///Obsolete, use wiringPilSR
public static extern int waitForInterrupt(int p_pin, int p_timeout);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void InterruptCallback();
[DllImport("libwiringPi.so", EntryPoint = "wiringPiISR")]
public static extern int wiringPiISR(int p_pin, int p_edgeType, [MarshalAs(UnmanagedType.FunctionPtr)] InterruptCallback p_callback);
Call:
if(WiringPi.PiThreadInterrupts.waitForInterrupt(8, -1) > 0) //only works in Sys mode! (WiringPi.Init.WiringPiSetupSys();)
{
Console.WriteLine("interrupt");
}
WiringPi.PiThreadInterrupts.wiringPiISR(8, (int)WiringPi.PiThreadInterrupts.Edge.INT_EDGE_RISING, new WiringPi.PiThreadInterrupts.InterruptCallback(Callback));
The text was updated successfully, but these errors were encountered: