/// <summary> /// Draw the display buffer to screen /// </summary> public override void Show() { // spiDisplay.WriteBytes(spiBuffer); if (xMax == 0 || yMax == 0) { return; } if (xMin > 0 || yMin > 0) { Show(xMin, yMin, xMax, yMax); return; } SetAddressWindow(0, 0, Width - 1, yMax); int len = (int)((yMax + 1) * Width * 2); dataCommandPort.State = Data; spi.ExchangeData(chipSelectPort, ChipSelectMode.ActiveLow, spiBuffer, spiReceive, len); xMin = width; yMin = height; xMax = 0; yMax = 0; }
/// <summary> /// Draw the display buffer to screen /// </summary> public override void Show() { /* if (xMax == 0 || yMax == 0) * { return; } * * if(xMin > 0 || yMin > 0) * { * Show(xMin, yMin, xMax, yMax); * return; * } */ // SetAddressWindow(0, 0, Width - 1, yMax); SetAddressWindow(0, 0, Width - 1, Height); int len; if (colorMode == DisplayColorMode.Format16bppRgb565) { len = (int)((Height + 1) * Width * 2); } else { len = (int)((Height + 1) * Width * 3 / 2); } dataCommandPort.State = Data; spi.ExchangeData(chipSelectPort, ChipSelectMode.ActiveLow, spiBuffer, spiReceive, len); /* xMin = width; * yMin = height; * xMax = 0; * yMax = 0; */ }
/// <summary> /// Send the internal pixel buffer to display. /// </summary> public override void Show() { SendCommands(showPreamble); // // Send the buffer page by page. // const int PAGE_SIZE = 16; var data = new byte[PAGE_SIZE + 1]; data[0] = 0x40; if (connectionType == ConnectionType.SPI) { // dataCommandPort.State = Data; // spiDisplay.WriteBytes(_buffer); spi.ExchangeData(chipSelectPort, ChipSelectMode.ActiveLow, buffer, spiReceive); } else { for (ushort index = 0; index < buffer.Length; index += PAGE_SIZE) { Array.Copy(buffer, index, data, 1, PAGE_SIZE); SendCommand(0x40); i2cPeriferal.WriteBytes(data); } } }
public override void Show() { // SetAddressWindow(0, 0, (byte)(Width - 1), (byte)(Height - 1)); SetAddressWindow(0, 0, 127, 127); int len = spiBuffer.Length; dataCommandPort.State = Data; spiBus.ExchangeData(chipSelectPort, ChipSelectMode.ActiveLow, spiBuffer, spiReceive, len); /* xMin = Width; * yMin = Height; * xMax = 0; * yMax = 0; */ }
/// <summary> /// Draw the display buffer to screen /// </summary> public void Refresh() { // spiDisplay.WriteBytes(spiBuffer); if (_yMax == 0) return; SetAddressWindow(0, 0, Width - 1, _yMax); int len = (int)((_yMax + 1) * Width * 2); dataCommandPort.State = (Data); spi.ExchangeData(chipSelectPort, ChipSelectMode.ActiveLow, spiBuffer, spiReceive, len); _yMax = 0; }
/// <summary> /// Writes a two dimensional buffer containing all the values to the devices. /// </summary> public void WriteBuffer(byte[,] buffer) { ValidateBuffer(buffer); for (int digit = 0; digit < NumDigits; digit++) { var i = 0; for (var deviceId = DeviceCount - 1; deviceId >= 0; deviceId--) { _writeBuffer[i++] = (byte)((int)Register.Digit0 + digit); _writeBuffer[i++] = buffer[deviceId, digit]; } //max7219.WriteBytes(_writeBuffer); spi.ExchangeData(chipSelectPort, ChipSelectMode.ActiveLow, _writeBuffer, _readBuffer); } }
/// <summary> /// Draw the display buffer to screen /// </summary> public override void Show() { // spiDisplay.WriteBytes(spiBuffer); if (yMax == 0) { return; } SetAddressWindow(0, 0, Width - 1, yMax); int len = (int)((yMax + 1) * Width * 2); dataCommandPort.State = (Data); spi.ExchangeData(chipSelectPort, ChipSelectMode.ActiveLow, spiBuffer, spiReceive, len); yMax = 0; }
public override void Show() { // spiDisplay.WriteBytes(spiBuffer); spi.ExchangeData(null, ChipSelectMode.ActiveLow, spiBuffer, spiReceive); }