The GpioConfig class provides a container to correlate various GPIO related information such as HeaderPinNumber, PinMuxRegisterOffset,
the GPIO and also the configuration state of the GPIO. This class is used for both the SYSFS and MemoryMapped versions of
the BBBCSIO
classes and some class members are only relevant during a specific access mode.
This class is primarily intended for internal use within the various port objects and there is little need for direct interaction by
external objects. These objects are usually auto-generated in the constructor of the port classes from the input GpioID using the tools and configuration
information hardcoded in the static GpioUtils class.
public int EventBank { get; }
Gets the Event bank. This is related to the GPIO. you will some
times see a gpio listed in the documentation like gpio1_23 or gpio1[23]
the gpio number will be (1*32) + 23 hence GPIO_55. This function
just recovers the bank (the 1 in the above example) from the calculated
GPIO number. It is needed when configuring certain things (like events)
in the device tree.
- value
- The event bank. This is the just GPIO/32.
public int EventBit { get; }
Gets the event bit number. This is related to the GPIO. you will some
times see a gpio listed in the documentation like gpio1_23 or gpio1[23]
the gpio number will be (1*32) + 23 hence GPIO_55. This function
just recovers the number of the bit (the 23 in the above example) from
the calculated GPIO number.
- value
- The event bit. This is the remainder of GPIO/32.
public GpioEnum Gpio { get; }
Gets the Gpio enum. There is no set accessor - this value set in the Constructor.
- value
- The Gpio as an enum.
public int GpioBank { get; }
Gets the Gpio bank. There is no set accessor - this value is calculated
from the GpioID in the Constructor.
- value
- The Gpio bank which will be a value of 0, 1, 2 or 3.
public int GpioBit { get; }
Gets the Gpio bit. There is no set accessor - this value is calculated
from the GpioID in the Constructor.
- value
- The bit offset in the PinMux Gpio bank. This is the remainder of GpioNum/32.
public int GpioMask { get; }
Gets the Gpio mask. There is no set accessor - this value is calculated
from the GpioID in the Constructor.
- value
- The bit offset in the PinMux Gpio bank. This is a 0x01 shifted left by the GpioBit value.
public int GpioSetting { get; }
Gets the GpioSettings. These are the raw hex bits that determine the various
mode settings. SYSFS mode only. Requires a call to UpdateConfigurationWithPinsFileInfo()
in order for it to be set.
- value
- The bits of the Gpio Setting.
public int HeaderNum { get; }
Gets the Header Number. There is no set accessor - this value set in the Constructor.
- value
- The header number. This will always be an 8 or 9 representing the P8 and P9 Headers respectively.
public int HeaderPin { get; }
Gets the Header Pin. There is no set accessor - this value set in the Constructor.
- value
- The header pin. This is the pin which exposes the GPIO on the P8 or P9 Header.
public bool GpioModeEnabled { get; }
Detects if the PinMux for the GPIO is in GPIO mode. A convenience property
which essentially just detects if MuxMode == 7
- value
- true the GPIO is in GPIO mode, false, it is not.
public int GpioNum { get; }
Gets the Gpio as a number. There is no set accessor - this value set in the Constructor.
- value
- The Gpio as a number.
public string GpioOwner { get; }
Gets the Gpio Owner. There is no set accessor - this value is set via a call to
UpdateConfigurationWithPinmuxPinsFileInfo()
- value
- The mux pin. Only set on SYSFS mode ports
public int MuxMode { get; }
Gets the Mux Mode. Gets the MuxMode. These are the lsb three bits of the GpioSetting.
Mode 7 111b enables GPIO's. Only set on SYSFS mode ports
- value
- The mux Mode. Essentially just gpioSetting & 0x07;
public string MuxOwner { get; }
Gets the Mux Owner. There is no set accessor - this value is set via a call to
UpdateConfigurationWithPinmuxPinsFileInfo()
- value
- The mux owner. Only set on SYSFS mode ports
public int MuxPin { get; }
Gets the Mux Pin. There is no set accessor - this value is set via a call to
UpdateConfigurationWithPinsFileInfo()
- value
- The mux pin. Only set on SYSFS mode ports
public int PinmuxRegisterAddress { get; }
Gets the PinMux register address. There is no set accessor - this value calculated from the PinmuxRegisterOffset.
- value
- The pinmuxRegisterAddress. This is BBBDefinitions.PINMUX_BASE_ADDRESS+PinmuxRegisterOffset.
public string PinmuxRegisterAddressAsHexString { get; }
Gets the PinMux register address as a hex string. There is no set accessor - this value calculated from the PinmuxRegisterAddress.
- value
- The pinmuxRegisterAddress as a hex string. This is a convenience for display purposes.
public int PinmuxRegisterDTIndex { get; }
Gets the PinMux register device tree index. There is no set accessor - this value calculated from the PinmuxRegisterOffset.
- value
- The pinmuxRegisterDTIndex. This is the pinmuxRegisterOffset-0x0800 the Device Tree Compiler uses this format for its addressing.
public int PinmuxRegisterDTIndexAsHexString { get; }
Gets the PinMux register device tree index as a hex string. There is no set accessor - this value calculated from the PinmuxRegisterDTIndex.
- value
- The pinmuxRegisterDTIndex as a hex string. This is a convenience for display purposes.
public int PinmuxRegisterOffset { get; }
Gets the PinMux register offset. There is no set accessor - this value set in the Constructor.
- value
- The PinMux register offset.
public string PinmuxRegisterOffsetAsHexString { get; }
Gets the PinMux register offset. There is no set accessor - this value calculated from the PinmuxRegisterOffset.
- value
- The PinMux register offset as a hex string. This is a convenience for display purposes.
public bool PulldownIsActive { get; }
Detects if a pull down resistor is enabled and active on the Gpio. There is no set accessor - this value calculated from the GpioSetting.
- value
- The PulldownIsActive state. This is a quick way to run through sequence of tests to see if we actually
have an active pull down resistor on the port.
public bool PullupIsActive { get; }
Detects if a pullup resistor is enabled and active on the Gpio. There is no set accessor - this value calculated from the GpioSetting.
- value
- The PullupIsActive state. This is a quick way to run through sequence of tests to see if we actually
have an active pullup resistor on the port.
public bool PullupsPulldownsEnabled { get; }
Detects if pullups/pulldowns are enabled. There is no set accessor - this value calculated from the GpioSetting.
- value
- The PullupsPulldownsEnabled state. Note this does not indicate if the port has a pullup or pulldown configured -
just that one or the other is enabled on that port.
public int PullupPulldownMode { get; }
Detects if the gpio is in pull up or pull down mode. There is no set accessor - this value calculated from the GpioSetting.
- value
- The PullupsPulldownsEnabled state. The actual
pull up or pull down resistor is only truely operational if PullupsPulldownsEnabled
is true.
public int ReceiverMode { get; }
Detects if the gpio configured in the PinMux as an input or output. There is no set accessor - this value calculated from the GpioSetting.
- value
- The receiver mode state. 1 receiver mode active, 0 receiver mode inactive
is true.
public int SlewControl { get; }
Detects the slew control state. There is no set accessor - this value calculated from the GpioSetting.
- value
- The slew control state. 1 slew control fast, 0 slew control slow
is true.