Beispiel #1
0
        private static void SendMessage(Ssd1327 device, string message)
        {
            device.SetRowAddress(0x00, 0x07);

            foreach (char character in message)
            {
                byte[]      charBitMap = BasicFont.GetCharacterBytes(character);
                List <byte> data       = new List <byte>();
                for (var i = 0; i < charBitMap.Length; i = i + 2)
                {
                    for (var j = 0; j < 8; j++)
                    {
                        byte cdata = 0x00;
                        int  bit1  = (byte)((charBitMap[i] >> j) & 0x01);
                        cdata |= (bit1 == 1) ? (byte)0xF0 : (byte)0x00;
                        var secondBitIndex = i + 1;
                        if (secondBitIndex < charBitMap.Length)
                        {
                            int bit2 = (byte)((charBitMap[i + 1] >> j) & 0x01);
                            cdata |= (bit2 == 1) ? (byte)0x0F : (byte)0x00;
                        }

                        data.Add(cdata);
                    }
                }

                device.SendData(data.ToArray());
            }
        }
Beispiel #2
0
        private static void SendMessage(Ssd1306 device, string message)
        {
            device.SendCommand(new Ssd1306Cmnds.SetColumnAddress());
            device.SendCommand(new Ssd1306Cmnds.SetPageAddress(Ssd1306Cmnds.PageAddress.Page0, Ssd1306Cmnds.PageAddress.Page3));

            foreach (char character in message)
            {
                device.SendData(BasicFont.GetCharacterBytes(character));
            }
        }