The nature of GPIO Ports

I’m trying to understand something. Does this code mean I must create a different LibGpiodDriver depending on the pin?

using System.Device.Gpio;
using System.Device.Gpio.Drivers;
using GHIElectronics.Endpoint.Core;

var port = EPM815.Gpio.Pin.PC0 / 16;
var pin = EPM815.Gpio.Pin.PC0 % 16;
var gpioDriver = new LibGpiodDriver((int)port);
var gpioController = new GpioController(PinNumberingScheme.
    Logical, gpioDriver);

gpioController.OpenPin(pin);
gpioController.SetPinMode(pin, PinMode.Output);

while (true){
    gpioController.Write(pin, PinValue.High);
    Thread.Sleep(100);
    gpioController.Write(pin, PinValue.Low);
    Thread.Sleep(100);
}

Yes, depends on the port of pin.

1 Like

Also take a look here, this might be of interest to you:

1 Like