private bool initializeGpio() { var gpio = GpioController.GetDefault(); if (gpio == null) { textBlockStatus.Text = "Gpio initialization error"; return(false); } for (int i = 0; i < PINS_NR; i++) { pins_[i] = gpio.OpenPin(PINS[i]); pins_[i].SetDriveMode(GpioPinDriveMode.Output); } for (int i = 0; i < DIGITS; i++) { display_[i] = new LedDigitDisplay(); display_[i].setPins(pins_, pins_[i + 8]); display_[i].clearDigit(); } numberDisplay_ = new NumberLedDisplay(display_); numberDisplay_.start(); textBlockStatus.Text = "Gpio initialized!"; return(true); }
public NumberLedDisplay(LedDigitDisplay[] displayDigits) { digits_ = (uint)displayDigits.Length; displayDigits_ = new LedDigitDisplay[digits_]; numberDigits_ = new uint?[digits_]; for (int i = 0; i < digits_; i++) { displayDigits_[i] = displayDigits[i]; numberDigits_[i] = null; } }