ILI9325D

This module supports the ILI9325D Tft driver which comes with the 2.8' Tft shield from iTeadstudio.


Installation

Download the zip file below and then drag and drop the zip file into the Firewing IDE (don't unzip the contents, leave as they are). This will install an updated Tft and new ILI9325D module into your user library.

Using the ILI9325D Module

All you need to do to use the new module is put a TFT_MODEL option at the top of your program (but after any device or clock declarations). For example:

clock = 80
#option TFT_MODEL = ILI9325D
imports Tft
imports TftGraphic
 etc etc...

Sample prog using the sdcard

' you can download the images used in this demo from here
' http://www.firewing.info/user-uploads/FirewingUser/ColorTFTSamples/sd-image-files.zip

#option TFT_MODEL = ILI9325D
imports Tft
imports TftGraphic
imports Sd
imports FixedFont

function SetBitmap(x as ushort, y as ushort, filename as string) as byte
   dim data as ushort
   dim width as ushort
   dim height as ushort

   SetBitmap = SD.Open(filename)
   if SetBitmap = errOK then
      width.Byte0 = SD.ReadByte
      width.Byte1 = SD.ReadByte       
      height.Byte0 = SD.ReadByte
      height.Byte1 = SD.ReadByte

      Tft.ILI9325D.SetBounds(x,y, x + width - 1, y + height - 1)
      do       
         data.Byte0 = SD.ReadByte 
         data.Byte1 = SD.ReadByte
         Tft.ILI9325D.WriteData(data)
      loop Until SD.EOF  
      SD.Close 
   end if
end function

' program entry point...
Sub Main()

   Tft.Clear 
   Tft.SetFont(Fixed) 

   ' initialise the SD card...
   If SD.Init <> errOK Then 
      Tft.WriteAt(10,10,"Failed to initialise")

   ' now read the data...
   else   
      while true  
         SetBitmap(0,0,"sunset.img")
         delayms(1000)
         SetBitmap(0,0,"bfly.img")  
         delayms(1000)    
         SetBitmap(0,0,"bird.img")  
         delayms(1000) 
         SetBitmap(0,0,"puffin.img")  
         delayms(1000) 
         SetBitmap(0,0,"tiger.img")  
         delayms(1000)
      end while
   end if   
End Sub

' disable UART1 on pins D0 and D1...
sub OnStartup() Handles PIC.OnStartup
   PPS.DisableRx1()
   PPS.DisableTx1() 
end sub