-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathChannel.cs
63 lines (50 loc) · 1.54 KB
/
Channel.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
57
58
59
60
61
62
63
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace WS281x
{
/// <summary>
/// Represents the channel which holds the LEDs
/// </summary>
public class Channel
{
/// <summary>
/// Returns the GPIO pin which is connected to the LED strip
/// </summary>
public int GPIOPin { get; private set; }
/// <summary>
/// Returns a value which indicates if the signal needs to be inverted.
/// Set to true to invert the signal (when using NPN transistor level shift).
/// </summary>
public bool Invert { get; private set; }
/// <summary>
/// Gets or sets the brightness of the LEDs
/// 0 = darkest, 255 = brightest
/// </summary>
public byte Brightness { get; set; }
/// <summary>
/// Returns the type of the channel.
/// The type defines the ordering of the colors.
/// </summary>
public StripType StripType { get; private set; }
/// <summary>
/// Returns all LEDs on this channel
/// </summary>
public List<LED> Leds { get; private set; }
public int LEDCount { get => Leds.Count; }
//public Channel() : this(0, 0) { }
public Channel(int ledCount, int gpioPin) : this(ledCount, gpioPin, 255, false, StripType.Unknown) { }
public Channel(int ledCount, int gpioPin, byte brightness, bool invert, StripType stripType)
{
GPIOPin = gpioPin;
Invert = invert;
Brightness = brightness;
StripType = stripType;
Leds = new List<LED>();
for(int i= 0; i< ledCount; i++)
{
Leds.Add(new LED(i));
}
//LEDs = new ReadOnlyCollection<LED>(ledList);
}
}
}