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)
@staticmethod
def GetPin(pin: int) -> int:
The line within the port for the pin (0 to 15).
Returns int
GetPort(int pin)
@staticmethod
def GetPort(pin: int) -> int:
The port index for the pin (0 = A ... 8 = I; 9 = Z).
Returns int
IsPinReserved(int pin)
@staticmethod
def IsPinReserved(pin: int) -> bool:
True if the pin is currently reserved (by the app or by any library).
Returns bool
Name(int pin)
@staticmethod
def Name(pin: int) -> str:
The pin's name, for example "PC0"
Returns string
PinRelease(int pin)
@staticmethod
def PinRelease(pin: int) -> None:
Releases a reservation made with Gpio.PinReserve.
PinReserve(int pin)
@staticmethod
def PinReserve(pin: int) -> None:
Marks the pin as used by the app, so the libraries do not use it too
SetAlternate(int pin, Alternate alternate)
@staticmethod
def SetAlternate(pin: int, alternate: Alternate) -> None:
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)
@staticmethod
def SetModer(pin: int, moder: Moder) -> None:
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)
@staticmethod
def SetOutputType(pin: int, type: OutputType) -> None:
Writes the pin's OTYPER register bit (push-pull or open-drain).
SetPull(int pin, Pull pull)
@staticmethod
def SetPull(pin: int, pull: Pull) -> None:
Writes the pin's PUPDR register field (pull-up / pull-down).
SetSpeed(int pin, Speed speed)
@staticmethod
def SetSpeed(pin: int, speed: Speed) -> None:
Writes the pin's OSPEEDR register field (slew rate).