Application Note AN_307 FT800 Restaurant Application

Application Note
AN_307
FT800 Restaurant Application
Version 1.0
Issue Date: 2014-03-19
This document is to introduce the setup of a Restaurant Application running on MSVC. The
objective of the Restaurant Application is to enable users to become familiar with the usage of the
FT800, the design flow, and display list used to design the desired user interface or visual effect.
Use of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and the
user agrees to defend, indemnify and hold FTDI harmless from any and all damages, claims, suits
or expense resulting from such use.
Future Technology Devices International Limited (FTDI)
Unit 1, 2 Seaward Place, Glasgow G41 1HH, United Kingdom
Tel.: +44 (0) 141 429 2777 Fax: + 44 (0) 141 429 2758
Web Site: http://ftdichip.com
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
Table of Contents
1
2
Introduction ................................................................................................................ 3
1.1
Overview .............................................................................................................. 3
1.2
Scope .................................................................................................................. 3
Application Flow ........................................................................................................... 4
2.1
3
Description .................................................................................................................. 5
3.1
Intialization .......................................................................................................... 5
3.1.1
Download the Bitmaps .................................................................................... 5
3.1.2
Set the tracker properties to Bitmaps using CMD_TRACK ..................................... 5
3.2
4
Restaurant Demo Flowchart .................................................................................... 4
Functionality ......................................................................................................... 5
3.2.1
Main Menu ..................................................................................................... 5
3.2.2
Sub Menu ...................................................................................................... 7
3.2.3
Order List ...................................................................................................... 9
Contact Information ................................................................................................... 10
Appendix A– References .................................................................................................... 11
Document References .................................................................................................... 11
Acronyms and Abbreviations ........................................................................................... 11
Appendix B – List of Tables & Figures .................................................................................. 12
Appendix C– Revision History ............................................................................................. 13
2
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
1 Introduction
This application demonstrates an interactive Restaurant Demo using menu, track and rotation
functions based on the FT800 platform.
The Restaurant demo user interactive function involves the menu items rotating one after another
in a circular path. Items can be selected and viewed in the order list.
1.1 Overview
The document will give the basic understanding about the FT800 CPU features Track, Points and
Bitmaps commands.
Arduino code of the application requires a SD card to read and load the bitmaps. The bitmaps have
to be copied from the Test folder to the SD card.
1.2 Scope
This document will be used by software programmers to develop GUI applications by using FT800
with any MCU via SPI.
3
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
2
Application Flow
2.1 Restaurant Demo Flowchart
Start
Place the menu items
with different tag and
track
NO
Is touch
detected?
Rotation Counts > 100
NO
YES
YES
Are the Menu
items in rotation?
Start the rotation
Increment the
rotation count by
one
YES
Clear the rotation
Counts and stop
rotation
NO
Valid tag?
YES
Place the SubMenu
items with different
tag and track
Is touch
detected?
NO
Rotation Counts > 100
NO
YES
YES
Are the SubMenu
items in rotation?
Start the rotation
Increment the
rotation count by
one
YES
Clear the rotation
Counts and stop
rotation
Valid tag?
YES
Enlarge the bitmap of
the item selected and
display its decription.
YES
Back button
clicked?
Home button
clicked?
YES
Order Button
clicked?
Order List
Window
YES
Back button
clicked?
YES
Home button
clicked?
YES
Figure 2-1 Restaurant App FlowChart
4
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
3 Description
Parameters needed to be initialized are described below for constructing the display list.
3.1 Intialization
3.1.1 Download the Bitmaps
The bitmaps are downloaded into the desired locations. The bitmap handles are also assigned
here. The menus items are combined into one single image and assigned one track value. They are
then called according to their cell numbers.
Note: After these configurations are set, swap the display list and flush into the J1 Memory.
3.1.2 Set the tracker properties to Bitmaps using CMD_TRACK
/* In the Function*/
Ft_Gpu_CoCmd_Track(phost,240, 136, 1, 1, tagval);
where ‘tagval’– Tag value of the bitmaps.
A w and h of (1,1) means that the tracker is rotary, and reports an angle value in REG_TRACKER.
(Refer to the FT800 Programming Guide).
3.2 Functionality
The Restaurant Demo is a user interactive demo where the user can select and view items that are
available.
3.2.1 Main Menu
The Main Menu has a gradient as the background. Then two points are drawn with an X vertex
equal to the Mid value of the screen width and a Y vertex of -150.
The first point is black in colour with reduced alpha value of 50 and point size of 250.The second
point is red in colour with default alpha value and a point size of 135.
The Main Menu has options like Beverages, Pastries and Frappe. The user can touch the screen at
any point if they want to stop the rotation. The preferred option can then be selected by clicking
on it.
The Main menu bitmaps are all combined together into a single file. These are accessed using their
cell numbers. They are of RGB565 format.
5
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
Figure 3-1 Menu Items
The bitmaps of the menu items are placed in an elliptical path around the points. Each of the items
has its individual track to monitor its movement. They are reduced or increased in size based on
their current positions using BITMAP_TRANSFORM as shown in the code below.
xoff = 200+(ft_int16_t)(190*cos(theta*0.0174));
yoff = -20+(ft_int16_t)(150*sin(theta*0.0174));
zinout = 310 - yoff;
Ft_App_WrCoCmd_Buffer(phost,BITMAP_TRANSFORM_A(zinout)); /* bitmap size adjustment */
Ft_App_WrCoCmd_Buffer(phost,BITMAP_TRANSFORM_E(zinout)); /* bitmap size adjustment */
Ft_App_WrCoCmd_Buffer(phost, VERTEX2F(xoff*16,yoff*16));
Ft_App_WrCoCmd_Buffer(phost,BITMAP_SIZE(BILINEAR, BORDER, BORDER, 256*80/zinout, 256*53/zinout ));
6
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
Figure 3-2 Main Menu Screen
3.2.2 Sub Menu
The Main Menu option selection opens up the respective Sub Menu. The Sub Menu items also
rotate in the same fashion.
The Sub Menu also has a gradient background. The two points are drawn with a X vertex equal to
the Mid value of the screen width and a Y vertex of -150.
The first point is black in colour with a reduced alpha value of 50 and a point size of 250.The
second point is red in colour with default alpha value of 255 and point size of 135.
There is a shopping cart bitmap which at the beginning moves from the right to the centre of the
screen by varying the X co-ordinates of the Cart bitmap.
The touch of an item in the submenu opens up the description window.
The Sub menu bitmaps are all combined together into a single file (as seen in Figure 3-1).
NOTE: Combining individual bitmaps into one file requires an external tool such as GIMP and is
outwith the scope of this app note. Note also that to ensure correct stride/height calculations, the
bitmaps should be arranged vertivcally.
These bitmaps are accessed using their cell numbers. They are of RGB565 format. The bitmaps are
reduced or increased in size based on their current positions using BITMAP_TRANSFORM.
Items can be dragged and placed on the shopping cart. This is done by using points and tracing
the path using the Touch screen register values as shown below.
Ft_App_WrCoCmd_Buffer(phost,BEGIN(FTPOINTS));
Ft_App_WrCoCmd_Buffer(phost,POINT_SIZE(5*16));
sx = Ft_Gpu_Hal_Rd16(phost,REG_TOUCH_SCREEN_XY+2);
sy = Ft_Gpu_Hal_Rd16(phost,REG_TOUCH_SCREEN_XY);
if(sx != -32768)
Ft_App_WrCoCmd_Buffer(phost,VERTEX2F(sx*16,sy*16));
The addition of an item in the shopping cart can be seen by the presence of the points in the cart.
The points in the shopping cart are pre calculated in an array and they are used as shown below
based on the number of items selected.
7
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
Ft_App_WrCoCmd_Buffer(phost,COLOR_RGB(0,255,0));
Ft_App_WrCoCmd_Buffer(phost,BEGIN(FTPOINTS));
Ft_App_WrCoCmd_Buffer(phost,POINT_SIZE(3*16));
Ft_App_WrCoCmd_Buffer(phost,VERTEX2F(points_cdsX[k]*16,points_cdsY[k]*16) );
The price and description of the items can be seen by clicking on the image which opens the
description window as shown below.
Figure 3-3 Description Window
The order list at the bottom of the screen is of ARGB4 format, and has the list of items that are
selected.
The back and home buttons at the bottom left of the screen are of ARGB4 format. These buttons
disappear after a pre-defined time out. They can be enabled again by clicking on the bottom area
of the screen.
Figure 3-4 Sub Menu Window
8
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
3.2.3 Order List
The Order list also has the same background as the other two windows.
The Order List has the list of the items that has been added to the shopping cart. Items can be
increased or decreased in quantity by clicking the respective buttons.
The plus and minus button are characters that are placed using VERTEX2II command. These are
then assigned tags.
The total price of the order is also shown.
The back and home buttons are placed at the bottom left of the screen. These buttons disappear
after a pre-defined time out. They can be enabled again by clicking on the bottom area of the
screen.
This window can also be scrolled. The scrolling is achieved by reading the REG_TOUCH_SCREEN_XY
Registers and by calculating its velocity as shown below.
signed short sy = Ft_Gpu_Hal_Rd16(phost,REG_TOUCH_SCREEN_XY);
if ((sy != -32768) & (scroller.dragprev != -32768)) {
scroller.vel = (scroller.dragprev - sy) << 4;
} else {
int change = max(1, abs(scroller.vel) >> 5);
if (scroller.vel < 0)
scroller.vel += change;
if (scroller.vel > 0)
scroller.vel -= change;
}
scroller.dragprev = sy;
/* previous touch */
scroller.base += scroller.vel;
scroller.base = max(0, min(scroller.base, scroller.limit));
Figure 3-5 Order List Screen
9
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
4 Contact Information
Head Office – Glasgow, UK
Branch Office – Tigard, Oregon, USA
Future Technology Devices International Limited
Unit 1, 2 Seaward Place, Centurion Business Park
Glasgow G41 1HH
United Kingdom
Tel: +44 (0) 141 429 2777
Fax: +44 (0) 141 429 2758
Future Technology Devices International Limited
(USA)
7130 SW Fir Loop
Tigard, OR 97223-8160
USA
Tel: +1 (503) 547 0988
Fax: +1 (503) 547 0987
E-mail (Sales)
E-mail (Support)
E-mail (General Enquiries)
[email protected]
[email protected]
[email protected]
E-Mail (Sales)
E-Mail (Support)
E-Mail (General Enquiries)
[email protected]
[email protected]
[email protected]
Branch Office – Taipei, Taiwan
Branch Office – Shanghai, China
Future Technology Devices International Limited
(Taiwan)
2F, No. 516, Sec. 1, NeiHu Road
Taipei 114
Taiwan , R.O.C.
Tel: +886 (0) 2 8791 3570
Fax: +886 (0) 2 8791 3576
Future Technology Devices International Limited
(China)
Room 1103, No. 666 West Huaihai Road,
Shanghai, 200052
China
Tel: +86 21 62351596
Fax: +86 21 62351595
E-mail (Sales)
E-mail (Support)
E-mail (General Enquiries)
E-mail (Sales)
E-mail (Support)
E-mail (General Enquiries)
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Web Site
http://ftdichip.com
Distributor and Sales Representatives
Please visit the Sales Network page of the FTDI Web site for the contact details of our distributor(s) and sales
representative(s) in your country.
System and equipment manufacturers and designers are responsible to ensure that their systems, and any Future Technology
Devices International Ltd (FTDI) devices incorporated in their systems, meet all applicable safety, regulatory and system-level
performance requirements. All application-related information in this document (including application descriptions, suggested
FTDI devices and other materials) is provided for reference only. While FTDI has taken care to assure it is accurate, this
information is subject to customer confirmation, and FTDI disclaims all liability for system designs and for any applications
assistance provided by FTDI. Use of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and the
user agrees to defend, indemnify and hold harmless FTDI from any and all damages, claims, suits or expense resulting from
such use. This document is subject to change without notice. No freedom to use patents or other intellectual property rights is
implied by the publication of this document. Neither the whole nor any part of the information contained in, or the product
described in this document, may be adapted or reproduced in any material or electronic form without the prior written consent
of the copyright holder. Future Technology Devices International Ltd, Unit 1, 2 Seaward Place, Centurion Business Park,
Glasgow G41 1HH, United Kingdom. Scotland Registered Company Number: SC136640
10
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
Appendix A– References
Document References
1. Datasheet for VM800C
http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_VM800C.pdf
2. Datasheet for VM800B
http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_VM800B.pdf
3. FT800 programmer guide.
http://www.ftdichip.com/Support/Documents/ProgramGuides/FT800%20Programmers%20Gui
de.pdf
4. FT800 Embedded Video Engine Datasheet
5. http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT800.pdf
Acronyms and Abbreviations
Terms
Description
SPI
Serial Peripheral Interface
GUI
Graphical User Interface
11
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
Appendix B – List of Tables & Figures
Figure 2-1 Restaurant App FlowChart ........................................................................ 4
Figure 3-1 Menu Items ............................................................................................... 6
Figure 3-2 Main Menu Screen ..................................................................................... 7
Figure 3-3 Description Window .................................................................................. 8
Figure 3-4 Sub Menu Window ..................................................................................... 8
Figure 3-5 Order List Screen ...................................................................................... 9
12
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_307 FT800 Restaurant Application
Version 1.0
Document Reference No.: FT_001009 Clearance No.: FTDI#381
Appendix C– Revision History
Document Title:
AN_307 FT800 Restaurant Application
Document Reference No.:
FT_001009
Clearance No.:
FTDI# 381
Product Page:
http://www.ftdichip.com/FTProducts.htm
Document Feedback:
Send Feedback
Revision
1.0
Changes
Initial release
Date
2014-03-25
13
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited