// // Constructor // public TLC5947ControllerBase(uint latchPin, uint blackoutPin) { // Create the controller m_controller = new LedController(this, ControlerUpdateType.AllSlots); // Open the latch pin GpioController controller = GpioController.GetDefault(); m_latchPin = controller.OpenPin((int)latchPin); m_latchPin.SetDriveMode(GpioPinDriveMode.Output); // Open the black out pin, set it high and low to reset the device. m_blackoutPin = controller.OpenPin((int)blackoutPin); m_blackoutPin.SetDriveMode(GpioPinDriveMode.Output); m_blackoutPin.Write(GpioPinValue.High); m_blackoutPin.Write(GpioPinValue.Low); // Create a async task to setup SPI new Task(async () => { // Create the settings var settings = new SpiConnectionSettings(SPI_CHIP_SELECT_LINE); // Max SPI clock frequency, here it is 30MHz settings.ClockFrequency = 30000000; settings.Mode = SpiMode.Mode0; // Find the selector string for the SPI bus controller string spiAqs = SpiDevice.GetDeviceSelector(SPI_CONTROLLER_NAME); // Find the SPI bus controller device with our selector string var devicesInfo = await DeviceInformation.FindAllAsync(spiAqs); // Create an SpiDevice with our bus controller and SPI settings m_spiDevice = await SpiDevice.FromIdAsync(devicesInfo[0].Id, settings); }).Start(); }
public VisualLedController() { // Create the base controller, specifiy how we want upates; if want everything everytime, or if we want signle slot updates. m_baseController = new LedController(this, ControlerUpdateType.AllSlots); // Enable animation on the base controller. This must be enabled for led animation. m_baseController.ToggleAnimation(true, false); }
public PwmLedControllerBase() { // Try to get the GPIO m_gpioController = GpioController.GetDefault(); if(m_gpioController == null) { throw new Exception("This device doesn't have a GPIO!"); } // Init the vars m_pinMap = new Dictionary<int, GpioPin>(); m_currentValuesList = new List<double>(); // Create the controller m_controller = new LedController(this, ControlerUpdateType.AllSlots); // Create an animator to control the ticks m_animator = new TheAnimator(this, 0); }