Table of Contents

Class Pin

Namespace
Pamoja.Gpio
Assembly
Pamoja.Gpio.dll

The GPIO pin model: levels, interrupt edges, and active polarity.

public static class Pin
Inheritance
Pin
Inherited Members

Remarks

Active-low wiring is everywhere in cheap hardware: a button to ground with a pull-up reads low when pressed, and many relay boards energise when driven low. PinPolarity maps between "asserted" and the physical level so that mapping lives in one place instead of in scattered inversions.

Methods

Invert(PinLevel)

Returns the opposite level.

public static PinLevel Invert(PinLevel level)

Parameters

level PinLevel

The level to invert.

Returns

PinLevel

The other level.

IsAsserted(PinPolarity, PinLevel)

Reports whether a physical level means the signal is asserted.

public static bool IsAsserted(PinPolarity polarity, PinLevel level)

Parameters

polarity PinPolarity

How the signal is wired.

level PinLevel

The level read on the pin.

Returns

bool

Whether the signal is asserted.

LevelFor(PinPolarity, bool)

Returns the physical level that represents a logical state.

public static PinLevel LevelFor(PinPolarity polarity, bool asserted)

Parameters

polarity PinPolarity

How the signal is wired.

asserted bool

Whether the signal should be asserted.

Returns

PinLevel

The level to drive, inverted for active-low wiring.

LevelFrom(bool)

Returns the level a boolean names.

public static PinLevel LevelFrom(bool high)

Parameters

high bool

true for high, false for low.

Returns

PinLevel

The level.

Triggers(PinEdge, PinLevel, PinLevel)

Reports whether a transition fires an interrupt trigger.

public static bool Triggers(PinEdge edge, PinLevel from, PinLevel to)

Parameters

edge PinEdge

The trigger configured on the pin.

from PinLevel

The level before the change.

to PinLevel

The level after it.

Returns

bool

Whether the trigger fires.