Good Morning,
I am working with the SCM 20260D.
At the beginning of my program I have this line:
DisplayController = GHIElectronics.TinyCLR.Devices.Display.DisplayController.GetDefault();
which calls this method:
public static DisplayController GetDefault()
{
if (!(NativeApi.GetDefaultFromCreator(NativeApiType.DisplayController) is DisplayController result))
{
return FromName(NativeApi.GetDefaultName(NativeApiType.DisplayController));
}
return result;
}
Normally this is line of code executes just fine. But recently I decided i want to control pin 167 as a gpio pin. So at the very beginning of my program i added this code:
int pinNumber = 167;
var gpio = GpioController.GetDefault();
if (!gpio.TryOpenPin(pinNumber, out var pin))
{
Debug.WriteLine($"Pin {pinNumber} is already in use.");
}
else
{
Debug.WriteLine($"Pin {pinNumber} is free.");
}
Now when my program tries to initialize the display controller it throws an exception. Can someone explain to my where, why and how the controller declares and uses pin 167?
Can someone explain to me how I can control pin 167 without crashing my display controller? Can I create a custom controller that doesn’t use pin 167?
Any help will be appreciated.
Thanks.