In the progress of testing the input events I found that it is easy to generate an uneven count of rising or falling events.
My assumption is following: for every rising event there would have been a falling event before it and for every falling event there would have been a rising event before it.
Is my assumption wrong? because it easy to generate uneven count of rising / falling events when manual shorting the input to ground.
var gpio = GpioController.GetDefault();
var button = gpio.OpenPin(SC20260.GpioPin.PJ2);
button.DebounceTimeout = new TimeSpan(0, 0, 0, 0, 100);
Debug.WriteLine($"Debounce: {button.DebounceTimeout.TotalMilliseconds}");
button.SetDriveMode(GpioPinDriveMode.InputPullUp);
button.ValueChangedEdge = GpioPinEdge.FallingEdge | GpioPinEdge.RisingEdge;
button.ValueChanged += Button_ValueChanged;
static int total = 0;
static int rising = 0;
static int falling = 0;
static void Button_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
{
if (e.Edge == GpioPinEdge.FallingEdge)
{
Debug.WriteLine("Falling");
falling++;
}
if(e.Edge == GpioPinEdge.RisingEdge)
{
Debug.WriteLine("Rising");
rising++;
}
total++;
if(total % 2 == 0)
Debug.WriteLine($"Rising:{rising}, Falling: {falling}, Total: {total}");
}