NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

StarterWare Graphics

From Texas Instruments Wiki
Jump to: navigation, search

TIBanner.png

StarterWare Graphics Library[edit]

The graphics library from StellatisWare is integrated with StarterWare. The off-screen LCD support is added for 16 bpp and 24 bpp LCD. The graphics lib supports drawing various shapes like vertical, horizontal & slanting lines, filled and empty circle and rectangle, push button, check box, radio button, list box, slider, drawing image and it also supports drawing strings in various fonts. Currently it supports 153 different fonts.

It also supports widget tree data structure, where all the widgets like push button, radio button, check box, list box, slider can be added. If touch screen is integrated, the coordinates can be sent as a message to the tree. Based on the coordinates the message will be sent to the corresponding button. The button can be configured to call the user specific handler function when the button is touched. For the graphics library API reference, refer Stellaris Graphics Library User's Guide from here. While referring the document, the following points are to be noted from SitaraWare context,

  • The discussion on tool chain support has to be ignored at this point in time.
  • In addition to the Off-screen buffer display drivers provided in 1 bit-per-pixel (BPP) format, 4 BPP format and 8 BPP format, StarterWare supports 16BPP and 24BPP format also.

Graphics Library based Example Applications[edit]

The graphics library example application, demonstrate how graphics library APIs can be used to easily draw/paint/write on the off screen LCD panel. It provides examples which show the ease of use in displaying dynamic content on the LCD panel.

  • The modules used in the example applications are
    • Graphics Library - for dynamic content/image modifications
    • Raster DAL - for LCD display
    • I2C - for touch detection

SitaraWareGraphicsApplication.JPG

Programming[edit]

  • Since the examples use the raster DAL for display on the panel, the programming, in addition to LCD initialization, consists of
    • Initializing off-screen image buffer by calling the API GrOffScreenXXBPPInit() (XX- indicated corresponding BPP)
    • Initializing the drawing context by calling the API GrContextInit()

Demonstration Application[edit]

This application provides a demonstration of the capabilities of the Graphics Library. A series of panels show different features of the library. For each panel, the bottom provides a forward and back button (when appropriate), along with a brief description of the contents of the panel.

  1. The first panel provides some introductory text and basic instructions for operation of the application.
  2. The second panel shows the available drawing primitives: lines, circles, rectangles, strings, and images.
  3. The third panel shows the canvas widget, which provides a general drawing surface within the widget hierarchy. A text, image, and application-drawn canvas are displayed.
  4. The fourth panel shows the check box widget, which provides a means of toggling the state of an item. Four check boxes are provided, with each having a red LED to the right. The state of the LED tracks the state of the check box via an application callback.
  5. The fifth panel shows the container widget, which provides a grouping construct typically used for radio buttons. Containers with a title, a centered title, and no title are displayed.
  6. The sixth panel shows the push button widget. Two columns of push buttons are provided. Each push button has a red LED to its left, which is toggled via an application callback each time the push button is pressed.
  7. The seventh panel shows the radio button widget. Two groups of radio buttons are displayed, the first using text and the second using images for the selection value. Each radio button has a red LED to its right, which tracks the selection state of the radio buttons via an application callback. Only one radio button from each group can be selected at a time, though the radio buttons in each group operate independently.
  8. The eighth and final panel shows the slider widget. Six sliders constructed using the various supported style options are shown. The slider value callback is used to update two widgets to reflect the values reported by sliders. A canvas widget near the top right of the display tracks the value of the red and green image-based slider to its left and the text of the grey slider on the left side of the panel is update to show its own value. The slider on the right is configured as an indicator which tracks the state of the upper slider and ignores user input

On loading the graphics example binary on to the target, the banner page is displayed and on touching anywhere on the LCD the first slide is shown. Other slides can be navigated with the previous and next button at the bottom of the LCD.

Maze Game Application[edit]

The Maze game is ported from StellarisWare(Quickstart Application of EK-LM3S2965). A game in which a blob-like character tries to find its way out of a maze. The character starts in the middle of the maze and must find the exit, which will always be located at one of the four corners of the maze. Once the exit to the maze is located, the character is placed into the middle of a new maze and must find the exit to that maze; this repeats endlessly. The Graphics library is used to display the all the elements(maze, player, stars, score) in the game.

  • Executing The Example Application

The game is started by pressing the select button on the right side of the LCD. During game play, the select button will fire a bullet in the direction the character is currently facing, and the navigation push buttons on the left side of the LCD will cause the character to walk in the corresponding direction.

Populating the maze are a hundred spinning stars that mindlessly attack the character. Contact with one of these stars results in the game ending, but the stars go away when shot.

Score is accumulated for shooting the stars and for finding the exit to the maze. The game lasts for only one character, and the score is displayed on the virtual UART at 115,200, 8-N-1 during game play and will be displayed on the screen at the end of the game.

The application also contains a screen saver. The screen saver will only become active if two minutes have passed without the user action while waiting to start the game (that is, it will never come on during game play). Qix-style bouncing lines are drawn on the display by the screen saver.

After two minutes of running the screen saver, the display will be turned off and the user LED will blink. Either mode of screen saver (bouncing lines or blank display) will be exited by touching the touch screen on LCD. The select button will then need to be pressed again to start the game.

Porting StellarisWare graphics application to StarterWare[edit]

Please refer here to know more on the various aspects to be considered while porting StellarisWare graphics application to StarterWare.

pnmtoc Tool[edit]

This section explains how to convert an image to C structure definition that can be passed to the GrImageDraw() function. This involves two steps,

  • Convert image (jpg, bmp, jpeg etc...) to .pnm format using Imagemagick tool, which can be downloaded from here

       convert.exe file.bmp -colors 65536 file.pnm

    This command converts a bmp image to pnm file with maximum of 65536 colors.

  • pnmtoc (convert pnm file to C array). The tool is run from the command line, and its usage is as follows:

       Windows host: pnmtoc.exe [-c] [-f] file.pnm > file.c

       Linux host: ./pnmtoc [-c] [-f] file.pnm > file.c

       Where the arguments mean:

         -c  Specifies that the image should be compressed. If compression is bypassed it would result in a larger C array.

         -f   specifies whether 24bpp should be forced

         file.ppm  Specifies the input image file.

     This pnmtoc tool is located in /tools/pnmtoc/ (pnmtoc.exe - to be used in windows command prompt, pnmtoc - to be used in linux)

Note: The icons used in OOB demo are created with command "pnmtoc -f file.pnm > file.c"

The resulting C image array definition is written to standard output. The output should be redirected into a file so that it can then be used by the application.This will result in an  array called g_pucImage that contains the image data from file.ppm. If file.ppm contains only two colors, the 1 BPP image format is used; if it contains 16 or less colors, the 4 BPP image format is used; if it contains 256 or less colors, the 8 BPP image format used; if it contains more than 256 colors the 16 BPP image format used; and if it contains more than 65536 colors an error is generated.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article StarterWare Graphics here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article StarterWare Graphics here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article StarterWare Graphics here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article StarterWare Graphics here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article StarterWare Graphics here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article StarterWare Graphics here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article StarterWare Graphics here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article StarterWare Graphics here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article StarterWare Graphics here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity