FT800 / Gameduino2 Library for Swordfish

Coding and general discussion relating to user created compiler modules

Moderators: David Barker, Jerry Messina

Post Reply
User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

FT800 / Gameduino2 Library for Swordfish

Post by Coccoliso » Thu Dec 11, 2014 4:24 pm

Hello
on wiki http://www.sfcompiler.co.uk/wiki/pmwiki ... User.FT800 you can find a library for FT800 / Gameduino2 display module done by a porting from Firewing David Barker library.
In the page also PCB and schematic diagram to do that.

bitfogav
Registered User
Registered User
Posts: 166
Joined: Sat Oct 09, 2010 1:39 pm
Location: United Kingdom

Re: FT800 / Gameduino2 Library for Swordfish

Post by bitfogav » Thu Dec 11, 2014 10:05 pm

That look's like some great hardware you have there! :)

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: FT800 / Gameduino2 Library for Swordfish

Post by Coccoliso » Sun Jan 29, 2017 5:20 pm

Hi,

to solve problems with
- cmd_progress()
- cmd_slider()
- cmd_dial()
- cmd_track()
and solve any tracking problems on many displayed objects apply this changes:

Code: Select all

'********************************************************************************
'* Name    : cmd_progress                                                       *
'* Purpose : Draw a progress bar                                                *
'******************************************************************************** 
Public Sub cmd_progress(x As Integer, 
                        y As Integer, 
                        w As Integer, 
                        h As Integer, 
                        options As Word, 
                        val As Word, 
                        range As Word) 
   cmd(FT_CMD_PROGRESS) 
   wr16(RAM_CMD+cmd_offset, x) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, y) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, w) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, h) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, options) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, val) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, range) 
   cmd_increment2()    
   wr16(RAM_CMD+cmd_offset, 0)       //<-----------------
   cmd_increment2()                  //<-----------------
End Sub

'********************************************************************************
'* Name    : cmd_slider                                                         *
'* Purpose : draw a slider                                                      *
'******************************************************************************** 
Public Sub cmd_slider(x As Integer, 
                      y As Integer, 
                      w As Word, 
                      h As Word, 
                      options As Word, 
                      val As Word, 
                      range As Word) 
   cmd(FT_CMD_SLIDER) 
   wr16(RAM_CMD+cmd_offset, x) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, y) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, w) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, h) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, options) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, val) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, range) 
   cmd_increment2()
   wr16(RAM_CMD+cmd_offset, 0)       //<-----------------
   cmd_increment2()                  //<-----------------
End Sub

'********************************************************************************
'* Name    : cmd_dial                                                           *
'* Purpose : Draw a rotary dial control                                         *
'******************************************************************************** 
Public Sub cmd_dial(x As Integer, 
                    y As Integer, 
                    r As Integer, 
                    options As Word, 
                    val As Word) 
   cmd(FT_CMD_DIAL) 
   wr16(RAM_CMD+cmd_offset, x) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, y) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, r) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, options) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, val) 
   cmd_increment2()                //<-----------------
   wr16(RAM_CMD+cmd_offset, 0)     //<-----------------
   cmd_increment2()                //<-----------------
End Sub

'********************************************************************************
'* Name    : cmd_track                                                          *
'* Purpose : enable co-processor engine to track the touch on the particular    *
'*           graphics object with one valid tag value assigned                  *
'******************************************************************************** 
Public Sub cmd_track(x As Integer, y As Integer, w As Integer, h As Integer, Tag As Integer) 
   cmd(FT_CMD_TRACK) 
   wr16(RAM_CMD+cmd_offset, x) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, y) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, w) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset, h) 
   cmd_increment2() 
   wr16(RAM_CMD+cmd_offset,Tag ) 
   cmd_increment2()     
   wr16(RAM_CMD+cmd_offset,0 )    //<-----------------
   cmd_increment2()               //<-----------------
End Sub

There is an unsolved problem with the cmd_spinner() :roll: .
ft800.jpg
ft800.jpg (102.03 KiB) Viewed 1937 times
Test program:

Code: Select all

Device  = 18F2682
Clock   = 40

#option FT800_SDCS              = PORTC.1
#option FT800_CS                = PORTC.0
#option FT800_CLK               = PORTC.3
#option FT800_DI                = PORTC.4
#option FT800_DO                = PORTC.5
#option FT800_MODEL             = FTDI_EVE
                                 
Include "FT800"
Include "EEProm"

    EEPROM(@EECalibrateAddr) = ($00,          // Flag calibrazione 
                                $00,$00,$00,$00,$00,$00,$00,$00,   // Calibrazione
                                $00,$00,$00,$00,$00,$00,$00,$00,
                                $00,$00,$00,$00,$00,$00,$00,$00)
Include "convert.bas"
Include "string.bas"

Dim i As Byte
Dim last As Byte
Dim v As Word
Dim R As Word
dim p as word
dim q as word
last = 0
R = 0
P = 0
q = 0
FT.SelfCalibrate(False, EECalibrateAddr)
While True
    FT.Cls()
    
    TagMask(1)
    tag(100)
    cmd_scrollbar(12, 26, 16, 160, 0, v, 60, 65535)
    cmd_track(12, 26, 16, 160, 100)
    TagMask(0)
        
    TagMask(1)
    tag(2)
    cmd_gauge(353, 46, 36, 0, 4, 8, 40, 100)
    TagMask(0)
    
    TagMask(1)
    tag(3)
    cmd_clock(437, 46, 36, 0, 13, 51, 17, 0)
    TagMask(0)
    
    TagMask(1)
    tag(4)
    cmd_number(442, 150, 28, 0, 42)
    TagMask(0)
    
    TagMask(1)
    tag(5)
    cmd_progress(115, 80, 180, 12, 0, p, 100)
    cmd_track(115, 80, 180, 12, 5)
    TagMask(0)
        
    TagMask(1)
    tag(6)
    cmd_slider(112, 50, 80, 8, 0, q, 100)
    cmd_track(112, 50, 80, 8, 6)
    TagMask(0)
    
    TagMask(1)
    tag(7)
    cmd_dial(429, 221, 36, 0, R)
    cmd_track(429, 221, 1, 1, 7)
    TagMask(0)

    TagMask(1)
    tag(12)
    FT.cmd_text(240, 136, 31, OPT_CENTER, "Hello world")
    TagMask(0)
       
    GetTrackValue(100,v,65535)
    GetTrackValue(5,p,100)
    GetTrackValue(6,q,100)
    GetTrackAngle(7,R)
    
    i = FT.GetTag()
    If i<>0 Then
        last = i
    End If
    If last<>0 Then
        FT.cmd_text(15, 240, 27, 0, "Selected Tag : " + DecToStr(last))
    End If 
    FT.Swap()
    DelayMS(25)
End While

Post Reply