private void WriteCommand(byte command) { pinDC.Write(false); spi.Write(new byte[1] { command }); }
/// <summary> /// Clears all registers. /// </summary> public void Clear() { if (!reSized) { ErrorPrint("The array has not been sixed yet. Please indicate how many modules are chained before continuing"); } Enable.Write(true); CLR.Write(false); System.Threading.Thread.Sleep(10); byte[] clear = new byte[1] { 0 }; spi.Write(clear); CLR.Write(true); Enable.Write(false); for (int i = 0; i < data.Length; i++) { data[i] = 0x0; } }
/// <summary> /// Attempts to enable writing to the flash, and returns the result. /// </summary> /// <returns>True is writing is enabled, false if it is not</returns> public bool WriteEnable() { ClearBuffers(); writeData[0] = CMD_WRITE_ENABLE; statusLED.Write(true); spi.Write(writeData); writeData[0] = CMD_READ_STATUS; spi.WriteRead(writeData, readData); statusLED.Write(false); return((readData[1] & 0x2) != 0); }
/// <summary> /// Sets all LEDs to the passed in Color structure /// </summary> /// <param name="color">Color to set all LEDs to. Color values must be between 0-127.</param> public void SetAll(Color color) { //Clear(); _spi.Write(_zeros); for (int i = 0; i < LEDs.Length; i += 2) { LEDs[i] = color; LEDs[i + 1] = color; _spi.Write(LEDs[i].GetForRender()); _spi.Write(LEDs[i + 1].GetForRender()); } _spi.Write(_zeros); }