Ejemplo n.º 1
0
 public void WriteChar(char charToWrite)
 {
     //Indicate the writing of a character
     RegisterSelect.Write(true);
     SendData((byte)charToWrite);
     RegisterSelect.Write(false);
 }
Ejemplo n.º 2
0
 public void Write(string text)
 {
     RegisterSelect.Write(true);
     foreach (char c in text)
     {
         SendData((byte)c);
     }
     RegisterSelect.Write(false);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Closes this instance.
        /// </summary>
        public void Close()
        {
            RegisterSelect.Dispose();
            Clock.Dispose();

            if (Backlight != null)
            {
                Backlight.Dispose();
            }
            if (ReadWrite != null)
            {
                ReadWrite.Dispose();
            }

            foreach (var dataPin in Data)
            {
                dataPin.Dispose();
            }
        }
Ejemplo n.º 4
0
        protected virtual void WriteInternal(RegisterSelect register, uint data)
        {
            rs.Write(register == RegisterSelect.Data);  // Data => rs=high
            WaitAtLeast(addressSetupTimeNs);

            if (spi != null)
            {
                spiBuffer[0] = (byte)data;
                spi.Write(spiBuffer);
                WaitAtLeast(dataHoldTimeNs);
            }
            else
            {
                switch (dataMode)
                {
                    case DataMode.EightBit:
                        d7.Write((data & 0x80) != 0);
                        d6.Write((data & 0x40) != 0);
                        d5.Write((data & 0x20) != 0);
                        d4.Write((data & 0x10) != 0);
                        if ((d3 != null) && (d2 != null) && (d1 != null) && (d0 != null))
                        {
                            d3.Write((data & 0x08) != 0);
                            d2.Write((data & 0x04) != 0);
                            d1.Write((data & 0x02) != 0);
                            d0.Write((data & 0x01) != 0);
                        }
                        WaitAtLeast(dataSetupTimeNs);
                        e.Write(true);
                        WaitAtLeast(enableHighTimeNs);
                        e.Write(false);
                        WaitAtLeast(dataHoldTimeNs);
                        break;
                    case DataMode.FourBit:
                        // Send left-hand four bits
                        d4.Write((data & 0x10) != 0);
                        d5.Write((data & 0x20) != 0);
                        d6.Write((data & 0x40) != 0);
                        d7.Write((data & 0x80) != 0);
                        WaitAtLeast(dataSetupTimeNs);
                        e.Write(true);
                        WaitAtLeast(enableHighTimeNs);
                        e.Write(false);
                        WaitAtLeast(dataHoldTimeNs);
                        // Send right-hand four bits
                        d4.Write((data & 0x01) != 0);
                        d5.Write((data & 0x02) != 0);
                        d6.Write((data & 0x04) != 0);
                        d7.Write((data & 0x08) != 0);
                        WaitAtLeast(dataSetupTimeNs);
                        e.Write(true);
                        WaitAtLeast(enableHighTimeNs);
                        e.Write(false);
                        WaitAtLeast(dataHoldTimeNs);
                        break;
                }
            }
        }