Last time out I showed you how to create a new application in ModusToolbox IDE 2.0 Today, I am going to add TFT support and draw a few things on the screen. Before I launch into that, I think I should explain how eclipse presents your project, because it is a little different to what you've seen on the command-line. Here is the Project Explorer view.
Binaries is a virtual folder, not a real one on disk. It appears once you have successfully built the application and, in our case, just shows you the elf file(s) that have been built.
Archives is another virtual folder and it shows all the binary libraries in the project. If you look in there you will see the CapSense archives (.a and .ar files) for both hard and soft floating point on the three supported compilers (GNU, Arm and IAR).
Includes lists the include paths. Note that, because we are using a Make-based flow, PSoC applications only need the paths to the compiler run-time libraries in here, not all the ModusToolbox headers.
build is a real folder where all the generated object files are saved, in sub-folders for the kit and compiler configuration (e.g. CY8CKIT-062-WIFI-BT/Debug).
images comes from the starter example project (empty app) and it contains the pictures and diagrams that are displayed in the README.md file.
libs is the folder you've seen before, where the ModusToolbox Library Manager saves lib files and sources.
Hopefully you are now a little more comfortable with Eclipse so let's add that TFT code. Open the Library Manager from the Tools section of the Quick Panel or by right-clicking on the project name in the Project Explorer and opening the ModusToolbox menu. Switch to the Libraries tab and select two libraries.
The first library is the emWin library from Segger. It's a really easy-to-use and popular graphics package for embedded devices like PSoC. The second is the Cypress shield support package, which enables emWin to run on the PSoC and interface to the shield pins. The library name comes from the separately-purchasable TFT shield, which is included in the 062-WIFI-BT kit.
Apply the changes in the manager and wait until you get the "Successfully updated the project" message. Back in the IDE, you will see the new files in the libs folder.
The emWin software is designed to run in various configurations, as follows.
We are going to start with the simplest (for us) method, which is to run with no RTOS and no touch screen. Open the Makefile and change line 69 to this.
This will cause the build system to include the right support files for running with no RTOS and to leave out the touch support (the screen does not support it). Finally, it is time to write a little code... three whole lines of it. Include the header file for emWin.
Then add these two lines in main(), before the infinite loop.
GUI_DispString( "Hello!" );
Press the TFT_Play Program (KitProg3) to build download the program. The string should appear in the top left corner of the screen. That's how easy it is to write to the TFT!
So, now you have a start point for creating cool programs with the TFT. Try moving the text to another location on screen (hint: GUI_DispStringAt) and changing the fore- and background colors. Next time I shall start drawing more stuff and show you how to use the screen with an RTOS. For some light bed-time reading I have attached the Segger emWin documentation to this post. Well worth a look.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.