Table of Contents

Class CharlieplexSegment

Namespace
Iot.Device.Multiplexing
Assembly
Iot.Device.Charlieplex.dll

Provides support for Charlieplex multiplexing. https://wikipedia.org/wiki/Charlieplexing

public class CharlieplexSegment : IOutputSegment
Inheritance
CharlieplexSegment
Implements

Constructors

CharlieplexSegment(int[], int, GpioController?, bool)

Initializes a new Charlieplex type that can be use for multiplex over a relatively small number of GPIO pins.

public CharlieplexSegment(int[] pins, int nodeCount = 0, GpioController? gpioController = null, bool shouldDispose = true)

Parameters

pins int[]

The set of pins to use.

nodeCount int

The count of nodes (like LEDs) that will be addressable. If 0, then the Charlieplex maximum is used for the pins provided (n^2-n).

gpioController GpioController

The GPIO Controller used for interrupt handling.

shouldDispose bool

True (the default) if the GPIO controller shall be disposed when disposing this instance.

Properties

Length

The length of the segment; the number of GPIO pins it exposes.

public int Length { get; }

Property Value

int

NodeCount

The number of nodes (like LEDs) that can be addressed.

public int NodeCount { get; }

Property Value

int

Methods

Display(CancellationToken)

Displays nodes in their current configuration for the specified duration.

public void Display(CancellationToken token)

Parameters

token CancellationToken

CancellationToken used to signal when method should exit.

Dispose()

Cleanup. Failing to dispose this class, especially when callbacks are active, may lead to undefined behavior.

public void Dispose()

GetNodes(int[], int)

Provides the set of Charlie nodes given the set of pins and the count provided. If count = 0, then the Charlieplex maximum is used for the pins provided (n^2-n).

public static CharlieplexSegmentNode[] GetNodes(int[] pins, int nodeCount = 0)

Parameters

pins int[]

The pins to use for the segment.

nodeCount int

The number of nodes to use. Default is the Charlieplex maximum.

Returns

CharlieplexSegmentNode[]

Write(int, PinValue, TimeSpan)

Write a PinValue to a node, to update Charlieplex segment. Address scheme is 0-based. Given 8 nodes, addresses would be 0-7. Displays nodes in their updated configuration for the specified duration.

public void Write(int node, PinValue value, TimeSpan duration = default)

Parameters

node int

Node to update.

value PinValue

Value to write.

duration TimeSpan

Time to display segment, in milliseconds (default is 0; not displayed).