Skip to main content

Gpio Class

Package: GHIElectronics.Endpoint.Core
Namespace: GHIElectronics.Endpoint.Core

GPIO pins and the register-level pin configuration (mode, alternate function, pull, speed, output type) for EPM815. Most applications should use the standard Gpio.GpioController through Gpio.Driver; the enums and setters here are for the low-level peripheral libraries in this package.

public static class Gpio

Nested Types​

TypeKindSummary
EPM815.Gpio.AlternateEnumAlternate functions AF0..AF15 for the pin's AFRL / AFRH register.
EPM815.Gpio.DriverClassGPIO driver for .NET's Gpio.GpioController using the EPM815 pin numbers, on every port. Open pins are reserved so the other libraries (I2C, UART, ...) cannot take them by mistake. Every pin mode, pull-up/down and pin change event of Gpio.GpioController works.
EPM815.Gpio.EdgeEnumEdge-trigger direction for pin change events.
EPM815.Gpio.ModerEnumValues for the GPIO MODER register.
EPM815.Gpio.OutputTypeEnumValues for the GPIO OTYPER register.
EPM815.Gpio.PinClassThe EPM815's pins (ports A to I and Z)
EPM815.Gpio.PortEnumGPIO ports on EPM815 (A..I plus the always-on Z bank).
EPM815.Gpio.PullEnumValues for the GPIO PUPDR register.
EPM815.Gpio.SpeedEnumValues for the GPIO OSPEEDR register (slew rate).

Methods​

GetPin(int pin)​

public static int GetPin(int pin)

The line within the port for the pin (0 to 15).

Returns int

GetPort(int pin)​

public static int GetPort(int pin)

The port index for the pin (0 = A ... 8 = I; 9 = Z).

Returns int

IsPinReserved(int pin)​

public static bool IsPinReserved(int pin)

True if the pin is currently reserved (by the app or by any library).

Returns bool

Name(int pin)​

public static string Name(int pin)

The pin's name, for example "PC0"

Returns string

PinRelease(int pin)​

public static void PinRelease(int pin)

Releases a reservation made with Gpio.PinReserve.

PinReserve(int pin)​

public static void PinReserve(int pin)

Marks the pin as used by the app, so the libraries do not use it too

SetAlternate(int pin, Alternate alternate)​

public static void SetAlternate(int pin, Alternate alternate)

Writes the pin's alternate function (AFRL / AFRH).

ParameterTypeDescription
pinintEPM815 pin number.
alternateAlternateThe AF to select; Alternate.NONE is not allowed.

SetModer(int pin, Moder moder)​

public static void SetModer(int pin, Moder moder)

Writes the pin's MODER register field.

ParameterTypeDescription
pinintEPM815 pin number.
moderModerThe mode to apply; Moder.NONE is not allowed.

SetOutputType(int pin, OutputType type)​

public static void SetOutputType(int pin, OutputType type)

Writes the pin's OTYPER register bit (push-pull or open-drain).

SetPull(int pin, Pull pull)​

public static void SetPull(int pin, Pull pull)

Writes the pin's PUPDR register field (pull-up / pull-down).

SetSpeed(int pin, Speed speed)​

public static void SetSpeed(int pin, Speed speed)

Writes the pin's OSPEEDR register field (slew rate).