public LEDService() { _module = new PiTopModule(); _plate = _module.GetOrCreatePlate <FoundationPlate>(); _green = _plate.GetOrCreateDevice <Led>(DigitalPort.D0); _green.DisplayProperties.Add(new NamedCssColor("green")); _amber = _plate.GetOrCreateDevice <Led>(DigitalPort.D1); _amber.DisplayProperties.Add(new NamedCssColor("gold")); _red = _plate.GetOrCreateDevice <Led>(DigitalPort.D2); _red.DisplayProperties.Add(new NamedCssColor("red")); _green.Off(); _amber.Off(); _red.Off(); }
public T GetOrCreateDevice <T>(DigitalPort port, Func <DigitalPort, IGpioControllerFactory, T> factory) where T : DigitalPortDeviceBase { return(_foundationPlate.GetOrCreateDevice(port, factory)); }