FT800.interface

LibraryImplement them in the project, using #library

Interface to control / use of the graphic chip FT800 from FTDI with a TFT display. The library supports all graphic and audiophile capabilities of the FT800, as well as numerous additional functions for event management.

Download

Setup/Init

  • FT800.Setup.CallBack.EventTagAction = MyMethod().Addr
  • FT800.Setup.CallBack.EventTagChanged = MyMethod().Addr
  • FT800.Setup.CallBack.EventTagChangedValue = MyMethod().Addr
  • FT800.Setup.CallBack.ReadByte = MyMethod().Addr
  • FT800.Setup.CallBack.WriteByte = MyMethod().Addr
  • FT800.Setup.Display.HCycle = Constant
  • FT800.Setup.Display.Height = Constant
  • FT800.Setup.Display.HOffset = Constant
  • FT800.Setup.Display.HSync0 = Constant
  • FT800.Setup.Display.HSync1 = Constant
  • FT800.Setup.Display.PCLK = Constant
  • FT800.Setup.Display.PCLKPol = Constant
  • FT800.Setup.Display.Swizzle = Constant
  • FT800.Setup.Display.VCycle = Constant
  • FT800.Setup.Display.VOffset = Constant
  • FT800.Setup.Display.VSync0 = Constant
  • FT800.Setup.Display.VSync1 = Constant
  • FT800.Setup.Display.Width = Constant
  • FT800.Setup.PlayBack.Disable()
  • FT800.Setup.PlayBack.Enable()
  • FT800.Setup.BootupConfig()
  • FT800.Setup.Pin.PD = Port-Pin
  • FT800.Setup.Pin.SS = Port-Pin
  • FT800.Init

Touch

  • FT800.Touch.Position( byRef x as word, byRef y as word )
  • byte = FT800.Touch.PenDown

TagAction

  • FT800.TagAction.Process()
  • FT800.TagAction.Reset()
  • FT800.TagAction.Start()
  • FT800.TagAction.TagMask() = byte
  • byte = FT800.TagAction.Tag
  • long = FT800.TagAction.TrackerValue
  • word = FT800.TagAction.TagValue()

Coprocessor Main

  • FT800.CoPro.CheckCmdBuffer()
  • FT800.CoPro.Cmd( cmd as long )
  • FT800.CoPro.Display()
  • FT800.CoPro.EndFunc()
  • FT800.CoPro.Start()
  • FT800.CoPro.StartFunc( numBytes as word )
  • FT800.CoPro.StartTransferRead( addr as uint24 )
  • FT800.CoPro.StartTransferWrite( addr as uint24 )
  • FT800.CoPro.UpdateFifo()
  • FT800.CoPro.WaitFifo()
  • FT800.CoPro.EndTransfer

Coprocessor Commands

  • FT800.CoCmd.AlphaFunc( func as byte, ref as byte )
  • FT800.CoCmd.Begin( prim as byte )
  • FT800.CoCmd.BgColor( color as uint24 )
  • FT800.CoCmd.BitmapHandle( handle as byte )
  • FT800.CoCmd.BitmapLayout( format as byte, linestride as word, height as word )
  • FT800.CoCmd.BitmapSize( filter as byte, wrapx as byte, wrapy as byte, width as word, height as word )
  • FT800.CoCmd.BitmapSource( addr as uint24 )
  • FT800.CoCmd.BitmapTransformA( a as uint24 )
  • FT800.CoCmd.BitmapTransformB( b as uint24 )
  • FT800.CoCmd.BitmapTransformC( c as uint24 )
  • FT800.CoCmd.BitmapTransformD( d as uint24 )
  • FT800.CoCmd.BitmapTransformE( e as uint24 )
  • FT800.CoCmd.BitmapTransformF( f as uint24 )
  • FT800.CoCmd.BlendFunc( src as byte, dst as byte )
  • FT800.CoCmd.Box( x as word, y as word, w as word, h as word )
  • FT800.CoCmd.Button( byPtr caption as stringTyped, x as word, y as word, w as word, h as word, font as byte, options as word )
  • FT800.CoCmd.CallDL( dest as word )
  • FT800.CoCmd.Cell( cell as byte )
  • FT800.CoCmd.Clear( c as byte, s as byte, t as byte )
  • FT800.CoCmd.ClearColor( color as uint24 )
  • FT800.CoCmd.ClearColorA( alpha as byte )
  • FT800.CoCmd.ClearStencil( stencil as byte )
  • FT800.CoCmd.ClearTag( tag as byte )
  • FT800.CoCmd.Clock( x as word, y as word, w as word, h as word, hour as byte, minute as byte, second as byte )
  • FT800.CoCmd.ColdStart()
  • FT800.CoCmd.Color( rgb as uint24 )
  • FT800.CoCmd.ColorA( value as byte )
  • FT800.CoCmd.ColorMask( r as byte, g as byte, b as byte, a as byte )
  • FT800.CoCmd.Dial( x as word, y as word, r as word, options as word, value as word )
  • FT800.CoCmd.End()
  • FT800.CoCmd.FgColor( color as uint24 )
  • FT800.CoCmd.Gauge( x as word, y as word, r as word, options as word, major as word, minor as word, value as word, range as word )
  • FT800.CoCmd.GradColor( color as uint24 )
  • FT800.CoCmd.Image( handle as uint24, x as word, y as word, w as word, h as word, format as byte )
  • FT800.CoCmd.ImageScale( handle as uint24, x as word, y as word, w as word, h as word, dstw as word, dsth as word, format as byte )
  • FT800.CoCmd.JumpDL( dest as word )
  • FT800.CoCmd.Keyboard( keys as uint24, x as word, y as word, w as word, rowHeight as word, font as byte )
  • FT800.CoCmd.Keys( byPtr caption as stringTyped, x as word, y as word, w as word, h as word, font as byte, options as word )
  • FT800.CoCmd.Line( x1 as word, y1 as word, x2 as word, y2 as word )
  • FT800.CoCmd.LineWidth( width as word )
  • FT800.CoCmd.LoadIdentity()
  • FT800.CoCmd.Macro( m as byte )
  • FT800.CoCmd.Number( x as word, y as word, font as byte, options as word, value as int32 )
  • FT800.CoCmd.Pbox( x as word, y as word, w as word, h as word )
  • FT800.CoCmd.PointSize( size as word )
  • FT800.CoCmd.Progress( x as word, y as word, w as word, h as word, options as word, value as word, range as word )
  • FT800.CoCmd.RestoreContext()
  • FT800.CoCmd.Return()
  • FT800.CoCmd.Rotate( angleFactor as int32 )
  • FT800.CoCmd.SaveContext()
  • FT800.CoCmd.Scale( xfactor as int32, yfactor as int32 )
  • FT800.CoCmd.ScissorSize( width as word, height as word )
  • FT800.CoCmd.ScissorXY( x as word, y as word )
  • FT800.CoCmd.Scrollbar( x as word, y as word, w as word, h as word, options as word, value as word, slidersize as word, range as word )
  • FT800.CoCmd.SetMatrix()
  • FT800.CoCmd.Slider( x as word, y as word, w as word, h as word, options as word, value as word, range as word )
  • FT800.CoCmd.Spinner( x as word, y as word, style as byte, scale as byte )
  • FT800.CoCmd.StencilFunc( func as byte, ref as byte, mask as byte )
  • FT800.CoCmd.StencilMask( mask as byte )
  • FT800.CoCmd.StencilOp( sfail as byte, spass as byte )
  • FT800.CoCmd.Stop()
  • FT800.CoCmd.Tag( tag as byte )
  • FT800.CoCmd.TagMask( mask as byte )
  • FT800.CoCmd.Text( byPtr text as stringTyped, x as word, y as word, font as byte, options as word )
  • FT800.CoCmd.Text8x16( byPtr text as stringTyped, row as byte, column as byte )
  • FT800.CoCmd.Text8x8( byPtr text as stringTyped, row as byte, column as byte )
  • FT800.CoCmd.Toggle( byPtr caption as stringTyped, x as word, y as word, w as word, font as byte, options as word, state as byte )
  • FT800.CoCmd.Track( x as word, y as word, w as word, h as word, tag as byte )
  • FT800.CoCmd.Translate( xfactor as int32, yfactor as int32 )
  • FT800.CoCmd.Vertex2f( x as word, y as word )
  • FT800.CoCmd.Vertex2i( x as word, y as word )
  • FT800.CoCmd.Vertex2ii( x as word, y as word, handle as byte, cell as byte )

Macros

  • long = FT800.Macro.AlphaFunc( func as byte, ref as byte )
  • long = FT800.Macro.Begin( prim as byte )
  • long = FT800.Macro.BitmapHandle( handle as byte )
  • long = FT800.Macro.BitmapLayout( format as byte, linestride as word, height as word )
  • long = FT800.Macro.BitmapSize( filter as byte, wrapx as byte, wrapy as byte, width as word, height as word )
  • long = FT800.Macro.BitmapSource( addr as uint24 )
  • long = FT800.Macro.BitmapTransformA( a as uint24 )
  • long = FT800.Macro.BitmapTransformB( b as uint24 )
  • long = FT800.Macro.BitmapTransformC( c as uint24 )
  • long = FT800.Macro.BitmapTransformD( d as uint24 )
  • long = FT800.Macro.BitmapTransformE( e as uint24 )
  • long = FT800.Macro.BitmapTransformF( f as uint24 )
  • long = FT800.Macro.BlendFunc( src as byte, dst as byte )
  • long = FT800.Macro.CallDL( dest as word )
  • long = FT800.Macro.Cell( cell as byte )
  • long = FT800.Macro.Clear( c as byte, s as byte, t as byte )
  • long = FT800.Macro.ClearColor( color as uint24 )
  • long = FT800.Macro.ClearColorA( alpha as byte )
  • long = FT800.Macro.ClearStencil( stencil as byte )
  • long = FT800.Macro.ClearTag( tag as byte )
  • long = FT800.Macro.Color( color as uint24 )
  • long = FT800.Macro.ColorA( alpha as byte )
  • long = FT800.Macro.ColorMask( r as byte, g as byte, b as byte, a as byte )
  • long = FT800.Macro.JumpDL( dest as word )
  • long = FT800.Macro.LineWidth( width as word )
  • long = FT800.Macro.Macro( m as byte )
  • long = FT800.Macro.PointSize( size as word )
  • long = FT800.Macro.ScissorSize( width as word, height as word )
  • long = FT800.Macro.ScissorXY( x as word, y as word )
  • long = FT800.Macro.StencilFunc( func as byte, ref as byte, mask as byte )
  • long = FT800.Macro.StencilMask( mask as byte )
  • long = FT800.Macro.StencilOp( sfail as byte, spass as byte )
  • long = FT800.Macro.Tag( tag as byte )
  • long = FT800.Macro.TagMask( mask as byte )
  • long = FT800.Macro.Vertex2f( x as word, y as word )
  • long = FT800.Macro.Vertex2i( x as word, y as word )
  • long = FT800.Macro.Vertex2ii( x as word, y as word, handle as byte, cell as byte )

Sound & Audio

  • FT800.Audio.Volume( value as byte )
  • FT800.Sound.Play( midiNote as byte, effect as byte )
  • FT800.Sound.Stop()
  • FT800.Sound.Volume( value as byte )
  • byte = FT800.Sound.WaitPlay()
  • byte = FT800.Pwm.Get()
  • byte = FT800.Sound.IsPlaying()

Backlight PWM

  • FT800.Pwm.Set( duty as byte )
  • FT800.AutoFadeIn( fadeStep as byte )
  • FT800.AutoFadeOut( fadeStep as byte )
  • FT800.FadeIn( delayms as byte )
  • FT800.FadeOut( delayms as byte )

Memory

  • FT800.Memory.Pointer.Set( addr as uint24 )
  • uint24 = FT800.Memory.LoadJpeg( imgAddr as uint24, memType1), as byte, numBytes as word, width as word, height as word )
  • uint24 = FT800.Memory.Pointer.Get

Low-Level

  • FT800.HostCommand( cmd as byte )
  • word = FT800.Read16()
  • long = FT800.Read32()
  • byte = FT800.Read8()
  • word = FT800.ReadReg16( addr as uint24 )
  • long = FT800.ReadReg32( addr as uint24 )
  • byte = FT800.ReadReg8( addr as uint24 )
  • word = FT800.StringWidth( byPtr text as stringTyped, font as byte )
  • word = FT800.StringWidthFlash( addr as uint24, font as byte )
  • FT800.Write16( value as word )
  • FT800.Write32( value as long )
  • FT800.Write8( value as byte )
  • FT800.WriteReg16( addr as uint24, value as word )
  • FT800.WriteReg32( addr as uint24, value as long )
  • FT800.WriteReg8( addr as uint24, value as byte )

Demo

Example

The example „Hello World“:

'***************************************************************************
' Title       : Example-Application using Luna evel Class "evel"
' Last updated: 19.10.2013
' Author      : rgf
' Target      : EVE evel
' Compiler    : LunaAVR 2013.r6 or newer
'***************************************************************************
 
#library "Library/Spi.interface"
#library "Library/FT800.interface"
 
const F_CPU    = 20000000
avr.device  	= atmega328p
avr.clock		= F_CPU
avr.stack		= 128
 
'first define alias names for the important pins
#define SpiSckPin		as Portb.5
#define SpiMisoPin		as Portb.4
#define SpiMosiPin		as Portb.3
#define ft800PdPin		as Portb.1
#define ft800SsPin		as Portb.2
 
'setup the pins
SpiSckPin.mode 	= output		' SCK
SpiMisoPin.mode = input			' MISO
SpiMosiPin.mode = output		' MOSI
 
'initialize the spi hardware interface
spi.master
spi.clock = 4
spi.SpeedDouble
spi.enable
 
'config the ft800 base values
ft800.Setup.Pin.PD = ft800PdPin
ft800.Setup.Pin.SS	= ft800SsPin
ft800.Setup.Callback.ReadByte = Spi.Master.ReadByte().Addr
ft800.Setup.Callback.WriteByte = Spi.Master.WriteByte().Addr
 
'initialize the ft800 and display
ft800.Init()
'the ft800 is ready to accept commands
'Note: The display backlight is off!
 
'fade in the backlight
ft800.FadeIn(5)
 
'begin a new screen
ft800.CoPro.Start()
ft800.CoCmd.Color(0xffffff)
 
ft800.CoCmd.Text8x8("Hello World!",0,0)
ft800.CoCmd.Text8x16("Hello World!",1,0)
ft800.CoCmd.Text("Hello World!",0,30,24,0)
 
'end of screen, make it visible
ft800.CoPro.Display()
 
 
do
loop
1) Sram: (1 « OBJ_SRAM), Flash: (1 « OBJ_CRAM), Eeprom: (1 « OBJ_ERAM)