Class KeyMatrix
GPIO key matrix Driver
public class KeyMatrix
- Inheritance
-
KeyMatrix
Constructors
KeyMatrix(int[], int[], TimeSpan, GpioController?, bool)
Initialize key matrix
public KeyMatrix(int[] outputPins, int[] inputPins, TimeSpan scanInterval, GpioController? gpioController = null, bool shouldDispose = true)
Parameters
outputPins
int[]Output pins
inputPins
int[]Input pins
scanInterval
TimeSpanScanning interval in milliseconds
gpioController
GpioControllerGPIO controller
shouldDispose
boolTrue to dispose the GpioController
Properties
InputPins
Get input pins
public int[] InputPins { get; }
Property Value
- int[]
this[int]
Get buttons' values by output
public SpanPinValue this[int output] { get; }
Parameters
output
intOutput index
Property Value
- SpanPinValue
OutputPins
Get output pins
public int[] OutputPins { get; }
Property Value
- int[]
ScanInterval
Get or set interval in milliseconds
public TimeSpan ScanInterval { get; set; }
Property Value
Values
Get all buttons' values
public SpanPinValue Values { get; }
Property Value
- SpanPinValue
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
ReadKey()
Blocks execution until a key event is received
public KeyMatrixEvent? ReadKey()
Returns
StartListeningKeyEvent()
Start listening to key events
public void StartListeningKeyEvent()
StopListeningKeyEvent()
Stop listening to key events
public void StopListeningKeyEvent()
Events
KeyEvent
The raised event
public event KeyMatrix.KeyEventHandler? KeyEvent