AN_309_FT800_Washing_Machine_Application

Application Note
AN_309
FT800 Washing Machine Application
Version 1.0
Issue Date: 2014-03-25
This document is to introduce the setup of the Washing Machine Application running on MSVC.
The objective of the Washing Machine 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_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
Table of Contents
1
2
Introduction ................................................................................................................ 3
1.1
Overview .............................................................................................................. 3
1.2
Scope .................................................................................................................. 3
Application Flow ........................................................................................................... 4
2.1
3
Washing Machine Demo Flowchart ........................................................................... 4
Description .................................................................................................................. 5
3.1
Intialization .......................................................................................................... 5
3.1.1
3.2
4
Download the Bitmaps .................................................................................... 5
Functionality ......................................................................................................... 5
3.2.1
Main Window ................................................................................................. 5
3.2.2
Child Lock ...................................................................................................... 6
3.2.3
Settings ........................................................................................................ 6
3.2.4
Wash Window ................................................................................................ 7
Contact Information ................................................................................................... 12
Appendix A– References .................................................................................................... 13
Document References .................................................................................................... 13
Acronyms and Abbreviations ........................................................................................... 13
Appendix B – List of Tables & Figures .................................................................................. 14
Appendix C– Revision History ............................................................................................. 15
2
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
1 Introduction
This application demonstrates an interactive Washing Machine application using Menu and
animation, based on the FT800 platform.
The Washing Machine application user interactive function involves the options that can be
selected for the washing process. The different stages in a Washing Machine are shown.
1.1 Overview
The document will give the basic understanding about the FT800 CPU features Menu and animation
using bitmaps.
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 root folder.
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_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
2
Application Flow
2.1 Washing Machine Demo Flowchart
Figure 2-1 Washing Machine Demo Flowchart
4
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
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 items in the Wash window for different stages are combined into one single image and
assigned different cell values. 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.2 Functionality
The Washing Machine Demo is a user interactive demo where the user can select and view items
that are available.
3.2.1 Main Window
The Main Menu has options for the Wash type such as Eco Cold, Normal, Heavy Duty, Perm Press,
Active Wear, Bedding and Wool. The preferred option can then be selected by clicking on it (touch
the screen). Each of the options has its own Soil Level, Temperature and Spin Speed which are
shown at the centre of the screen.
There are three options on the right side. Child Lock, Settings and Start button.
Estimated time remaining for the process is also shown.
The Menu Items on the left pane, are assigned individual tags. Below the Menu items, a rectangle
with only alpha value and a tag is drawn. This rectangle is drawn for the scrolling feature.
The scrolling feature is done by reading the X and Y coordinates at the particular point and by
calculating velocity using the previous 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));
The Options on the middle pane, change according to the Menu item selected. The bitmaps used
for the “Soil level”, “temperature” are changed in color according to the option. The Spin speed
bitmap is rotated using the Ft_Gpu_CoCmd_Rotate command.
5
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
Figure 3-1 Main Window Screen
3.2.2 Child Lock
The Child Lock option will lock the screen thereby disabling all the features of the Machine as
shown below.
An edge strip with an alpha value of 180 is drawn and the bitmap is placed in the centre with a tag
value to go back to the Main Screen
Figure 3-2 Locked Screen
3.2.3 Settings
The Settings screen has options for Sound and Brightness levels to be adjusted.
The default values for Display is 100 and Sound is 255 which are the highest. They are shown in
Level 5 and Level 4 respectively.
The Level buttons are drawn using rectangle commands and assigned tags. Only the selected
buttons are drawn with a bigger than default value.
6
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
The Home button is selected to go back to main screen.
Figure 3-3 Settings Screen
3.2.4 Wash Window
When the Start button is pressed, the washing process begins with stages as Pre Wash, Wash,
Rinse and Spin.
The different stages are shown with images being loaded one after the other to create an
animation effect.
The Time remaining for the whole process to be completed is shown here and in the Main Window
as well.
At any point during the process, the user can jump to main window and come back to Wash
Window without stopping the process that is happening.
A point is drawn using FT_POINTS with a low alpha value for the washing process to be displayed.
This is termed the Process point.
The progress bar is a bitmap. A rectangle of similar colour to the bitmap is drawn over the bitmap
as the washing process goes on. This gives an illusion that the bar progresses as the time reduces.
The time remaining is shown using the text and number commands. The time shown in seconds is
not exactly seconds. The seconds here are calculated faster to finish the process earlier.
7
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
Figure 3-4 Pre Wash Window
During the Pre wash stages the bitmaps needed are “dropped” from the top of the display to the
Process point. The bitmaps used are shown in the images below. They are “dropped” one after the
other during the Pre Wash process to the Process Point.
Figure 3.2.4-2 Wash, Rinse and Spin Images
The above displayed bitmaps, used for the Washing process are changed in different angles (as
shown below) using external software such as Gimp, or Microsoft Paint.
Figure 3.2.4-3 Wash, Rinse and Spin Process Images Altered
8
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
These bitmaps are accessed using their respective cell numbers as seen in the image as seen in
the code below:
For Wash and Spin:
Ft_App_WrCoCmd_Buffer(phost,VERTEX2II(200,60,ProcessFlag-2,BitmapTr));
For Rinse:
rotate_around(RotX,RotY,th); /* The images are rotated first:*/
Ft_App_WrCoCmd_Buffer(phost,VERTEX2II(200,60,ProcessFlag-2,BitmapTr));
For the Washing process, bubbles bitmaps are moved in different locations using the ft_random
command. The offset of the bubbles are calculated by using the Display Width and Display Height.
The distance the bubbles move is calculated by adding the “xdiff” and “ydiff” values to the offsets.
W_Bubble[i].xOffset = ft_random(FT_DispWidth);
W_Bubble[i].yOffset = ft_random(FT_DispHeight);
W_Bubble[i].xDiff = ft_random(16) ;
W_Bubble[i].yDiff = ft_random(8) ;
Ft_App_WrCoCmd_Buffer(phost,VERTEX2II(W_Bubble[i].xOffset,W_Bubble[i].yOffset,4,0));
W_Bubble[i].xOffset += W_Bubble[i].xDiff;
W_Bubble[i].yOffset += W_Bubble[i].yDiff;
Figure 3-5 Wash Window
9
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
For the Rinsing process, the bitmap is rotated at half its path.
Figure 3-6 Rinse Window
For the Spinning process, the bitmaps are displayed one after the other to create an animation
effect.
Figure 3-7 Spin Window
10
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
The Process point displays the text “DONE” when the process is complete.
Figure 3-8 Process Completed Window
11
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
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
12
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
Appendix A– References
Document References
1.
2.
3.
4.
Datasheet for VM800C
Datasheet for VM800B
FT800 programmer guide FT_000793.
FT800 Embedded Video Engine Datasheet FT_000792
Acronyms and Abbreviations
Terms
Description
SPI
Serial Peripheral Interface
GUI
Graphical User Interface
13
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
Appendix B – List of Tables & Figures
Figure 2-1 Washing Machine Demo Flowchart ............................................................ 4
Figure 3-1 Main Window Screen ................................................................................. 6
Figure 3-2 Locked Screen ........................................................................................... 6
Figure 3-3 Settings Screen ......................................................................................... 7
Figure 3-4 Pre Wash Window ..................................................................................... 8
Figure 3-5 Wash Window ........................................................................................... 9
Figure 3-6 Rinse Window ......................................................................................... 10
Figure 3-7 Spin Window ........................................................................................... 10
Figure 3-8 Process Completed Window .................................................................... 11
14
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited
Application Note
AN_309FT800 Washing Machine Application
Version 1.0
Document Reference No.: FT_001013 Clearance No.: FTDI#382
Appendix C– Revision History
Document Title:
AN_309 FT800 Washing Machine Application
Document Reference No.:
FT_001013
Clearance No.:
FTDI# 382
Product Page:
http://www.ftdichip.com/FTProducts.htm
Document Feedback:
Send Feedback
Revision
1.0
Changes
Initial release
Date
2014-04-25
15
Product Page
Document Feedback
Copyright © 2014 Future Technology Devices International Limited