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.
class Gpio {};
Nested Types
| Type | Kind | Summary |
|---|---|---|
| EPM815.Gpio.Alternate | Enum | Alternate functions AF0..AF15 for the pin's AFRL / AFRH register. |
| EPM815.Gpio.Driver | Class | GPIO 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.Edge | Enum | Edge-trigger direction for pin change events. |
| EPM815.Gpio.Moder | Enum | Values for the GPIO MODER register. |
| EPM815.Gpio.OutputType | Enum | Values for the GPIO OTYPER register. |
| EPM815.Gpio.Pin | Class | The EPM815's pins (ports A to I and Z) |
| EPM815.Gpio.Port | Enum | GPIO ports on EPM815 (A..I plus the always-on Z bank). |
| EPM815.Gpio.Pull | Enum | Values for the GPIO PUPDR register. |
| EPM815.Gpio.Speed | Enum | Values for the GPIO OSPEEDR register (slew rate). |
Methods
GetPin(int pin)
static int32_t GetPin(int32_t pin);
The line within the port for the pin (0 to 15).
Returns int
GetPort(int pin)
static int32_t GetPort(int32_t pin);
The port index for the pin (0 = A ... 8 = I; 9 = Z).
Returns int
IsPinReserved(int pin)
static bool IsPinReserved(int32_t pin);
True if the pin is currently reserved (by the app or by any library).
Returns bool
Name(int pin)
static std::string Name(int32_t pin);
The pin's name, for example "PC0"
Returns string
PinRelease(int pin)
static void PinRelease(int32_t pin);
Releases a reservation made with Gpio.PinReserve.
PinReserve(int pin)
static void PinReserve(int32_t pin);
Marks the pin as used by the app, so the libraries do not use it too
SetAlternate(int pin, Alternate alternate)
static void SetAlternate(int32_t pin, Alternate alternate);
Writes the pin's alternate function (AFRL / AFRH).
| Parameter | Type | Description |
|---|---|---|
pin | int | EPM815 pin number. |
alternate | Alternate | The AF to select; Alternate.NONE is not allowed. |
SetModer(int pin, Moder moder)
static void SetModer(int32_t pin, Moder moder);
Writes the pin's MODER register field.
| Parameter | Type | Description |
|---|---|---|
pin | int | EPM815 pin number. |
moder | Moder | The mode to apply; Moder.NONE is not allowed. |
SetOutputType(int pin, OutputType type)
static void SetOutputType(int32_t pin, OutputType type);
Writes the pin's OTYPER register bit (push-pull or open-drain).
SetPull(int pin, Pull pull)
static void SetPull(int32_t pin, Pull pull);
Writes the pin's PUPDR register field (pull-up / pull-down).
SetSpeed(int pin, Speed speed)
static void SetSpeed(int32_t pin, Speed speed);
Writes the pin's OSPEEDR register field (slew rate).