-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
Copy pathIOutputSegment.cs
56 lines (48 loc) · 1.81 KB
/
IOutputSegment.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Device.Gpio;
using System.Threading;
namespace Iot.Device.Multiplexing
{
/// <summary>
/// Abstracts a segment of outputs from multiplexing sources (like a shift register).
/// </summary>
public interface IOutputSegment : IDisposable
{
/// <summary>
/// Length of segment (number of outputs)
/// </summary>
int Length { get; }
/// <summary>
/// Segment values.
/// </summary>
PinValue this[int index] { get; set; }
/// <summary>
/// Writes a PinValue to a virtual segment.
/// Does not display output until calling Display() or Display(CancellationToken ct) methods.
/// </summary>
void Write(int index, PinValue value);
/// <summary>
/// Writes discrete underlying bits to a virtual segment.
/// Writes each bit, left to right. Least significant bit will written to index 0.
/// Does not display output.
/// </summary>
void Write(byte value);
/// <summary>
/// Writes discrete underlying bits to a virtual output.
/// Writes each byte, left to right. Least significant bit will written to index 0.
/// Does not display output.
/// </summary>
void Write(SpanByte value);
/// <summary>
/// Turns off all outputs.
/// </summary>
void TurnOffAll();
/// <summary>
/// Displays current state of segment.
/// Segment is displayed at least until token receives a cancellation signal, possibly due to a specified duration expiring.
/// </summary>
void Display(CancellationToken token);
}
}