Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.62 KB

README.md

File metadata and controls

55 lines (39 loc) · 1.62 KB

Ili9341 TFT LCD Controller

The ILI9341 is a QVGA (Quarter VGA) driver integrated circuit that is used to control 240×320 VGA LCD screens

Documentation

Adafruit ILI9341 Arduino Library

Device Family

Related Devices

Usage

using System.Device.Spi;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Iot.Device.Ili9341;

const int pinID_DC = 25;
const int pinID_Reset = 24;

using Bitmap dotnetBM = new(240, 320);
using Graphics g = Graphics.FromImage(dotnetBM);
using SpiDevice displaySPI = SpiDevice.Create(new SpiConnectionSettings(0, 0) { Mode = SpiMode.Mode3, DataBitLength = 8, ClockFrequency = 12_000_000 /* 12MHz */ });
using Ili9341 ili9341 = new(displaySPI, pinID_DC, pinID_Reset);

while (true)
{
    foreach (string filepath in Directory.GetFiles(@"images", "*.png").OrderBy(f => f))
    {
        using Bitmap bm = (Bitmap)Bitmap.FromFile(filepath);
        g.Clear(Color.Black);
        g.DrawImageUnscaled(bm, 0, 0);
        ili9341.SendBitmap(dotnetBM);
        Task.Delay(1000).Wait();
    }
}

Binding Notes

This binding currently only supports commands and raw data. Eventually, the plan is to create a graphics library that can send text and images to the device.

The following connection types are supported by this binding.

  • SPI