RPICSIO

The GpioEnum Enum

 

The GpioEnum Enum

The GpioEnum enum only defines the GPIOs available by default on the Raspberry Pi 2's header. There are others, not defined, which are not exposed on the header and hence cannot be used and still others which are only available by disabling some other device (I2C, SPI, UART etc) and changing the pinmux setting.

The GPIOs are not exposed on the header in any particularly logical order. You must refer to the Raspberry Pi header pinout in order to determine on which pin the GPIO appears. In particular, be aware that because it says GPIO_4 this does not mean it appears on pin 4 on the header. This is almost never the case and, in fact, GPIO_4 actually appears on pin 7 of the header on the Raspberry Pi 2.

 

Warnings - READ THIS!!!

The source code below lists the default GPIO values. In general you can assume that, by default, any particular GPIO is available for use on your Raspberry Pi. The RPICSIO library will correctly set these GPIOs to input or output depending on the type of port class you define to operate on it. Having said that, it is possible that the GPIOs could be redirected in the pinmux and hence be unavailable. This would take some custom work with the Device Tree and if you are doing that then you will probably be aware of why the GPIO is unavailable.

So, the upshot here is that any GPIO you see defined here should be available for use on the Raspberry Pi 2 for input or output.

IMPORTANT NOTE: Before creating any RPICSIO Port class you will need to ensure that the RPICSIO Library knows which type of Raspberry Pi you are dealing with. This is done by executing a call (only once is necessary) like the one below somewhere in your code before you create any port.

            RPICSIOConfig.Instance.RPIType = RPITypeEnum.RPITYPE_RPI2;

 

Source Code

The source code for this class is available online for download and also in browseable form.

 

Syntax

    public enum GpioEnum
    {
        GPIO_NONE,
        GPIO_4,
        GPIO_5,
        GPIO_6,
        GPIO_12,
        GPIO_13,
        GPIO_16,
        GPIO_17,
        GPIO_18,
        GPIO_19,
        GPIO_20,
        GPIO_21,
        GPIO_22,
        GPIO_23,
        GPIO_24,
        GPIO_25,
        GPIO_26,
        GPIO_27
    }