Home
uC/GUI user manual
Contents
1. nsns 297 26 Standard FOMS tert 299 26 1 Font identifier naming nnn 299 26 2 Font file naming 2 1 mene nennen nnn nnn nnn 300 26 3 Measurement ROM size and character set of fonts 301 26 4 Proportional icine coven windiest Fea Su aa 301 26 5 Monospaced fonts vines vex ha el dey CD C CE Ya p reverses 318 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 27 Questions and 0 0 0 0 327 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 10 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Chapter 1 Introduction to nC GUI uC GUI uC GUI is a Unversial graphic software for embedded applications It is designed to provide an effi cient processor and LCD controller independent graphical user interface to any application using a graphical LCD It works in single as well as in multi task environments uC GUI can be adopted to any size of physical and virtual display with any LCD co
2. Routine Explanation GUI StoreKeyMsg Store a message in a specified key GUI SendKeyMsg Send a message to a specified key GUI StoreKeyMsg Description Stores a status message in a specified key Prototype void GUI StoreKeyMsg int Key int Pressed Parameter Meaning K May be any extended ASCII character between 0x20 and OxFF or any predefined ey character code Pressed Key state see table below Permitted values for parameter Pressed Pressed state 0 Released unpressed state GUI SendKeyMsg Description Sends a status message to a specified key Prototype void GUI SendKeyMsg int Key int Pressed Parameter Meaning K May be any extended ASCII character between 0x20 and OxFF or any predefined eT Hu C GUI character code Pressed Key state see GUI_StoreKeyMsg 18 2 2 Application layer API The table below lists the application layer keyboard routines in alphabetical order Detailed descriptions follow Routine Explanation GUI ClearKeyBuffer Clear the key buffer GUI GetKey Return the contents of the key buffer GUI_StoreKey Store a key in the buffer GUI_WaitKey Wait for a key to be pressed User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 276 CHAPTER 18 Input Devices GUI ClearKeyBuffer Description Clears the key buffer Prototype void GUI ClearKeyBuffer void GUI
3. Routine Explanation FRAMEWIN Create Creates the frame window FRAMEWIN CreateAsChild Create the frame window as a child window FRAMEWIN CreateIndirect Create the frame window from resource table entry FRAMEWIN GetDefaultBorderSize Returns the default border size FRAMEWIN GetDefaultCaptionSize Returns the default size of the title bar FRAMEWIN GetDefaultFont Returns the default font used for the title bar FRAMEWIN SetActive Sets the state of the frame window FRAMEWIN SetBarColor Sets the background color of the title bar FRAMEWIN SetClientColor Sets the background color of the client area FRAMEWIN SetDefaultBarColor Sets the default color of the title bar FRAMEWIN SetDefaultBorderSize Sets the default border size FRAMEWIN SetDefaultCaptionSize Sets the default height of the title bar FRAMEWIN SetDefaultFont Sets the default font of the title bar FRAMEWIN SetFont Selects the font for the title text FRAMEWIN SetText Sets the title text FRAMEWIN SetTextAlign Sets the alignment of the title text FRAMEWIN SetTextColor Sets the color s for the title text FRAMEWIN SetTextPos Sets the position of the title text FRAMEWIN Create Description Creates a FRAMEWIN widget of a specified size at a specified location Prototype FRAMEWIN Handle FRAMEWIN Create const char pTitle int Flags User s amp reference manual for uC GUI WM CALLBACK cb int x0 int
4. K ck ck k k k k k k x k k k ck Ck x k k k KK KKK KKK ck k ck x ck ck ck Sk ck k x ck kk K k x kk KKK KK KKK KKK KKK KKK KK File WIDGET FrameWin c Purpose Example demonstrating the use of a FRAMEWIN widget xy include gui H include framewin h include lt stddef h gt lt IK IK k k k K K K K K K K K K k K K K K K K TK K AA A SK SK K K K K K K K KKK KKK KKK KKK Callback routine of client window kk ck Ck Sk k k k KK KKK KK ck Ck Sk KKK KKK KK KKK KKK KKK x k k x ck kk ck kk kk ck kk KKK ko kc K k K KKK KKK KKK Tut static WM RESULT CallbackChild WM MESSAGE pMsg WM HWIN hWin FRAMEWIN Handle pMsg hWin switch pMsg MsgId case WM PAINT Handle the paint message UI SetBkColor GUI BLUE G GUI SetColor GUI WHITE GUI SetFont amp GUI FontComic24B ASCII G G G UI SetTextAlign GUI TA HCENTER GUI TA VCENTER UI Clear UI DispStringHCenterAt Child window WM GetWindowSizeX hWin WM GetWindowSizeY hWin 2 2 break 8K k k k K K K KK K K K k I A K K K K AR AAA AA A A K K A K ke KOK KOK KOK KOK KOK KOK K Create frame and childwindow kk ck Ck ck k k k x kk Ce KKK KKK KKK KKK KKK KK K k k KK ck ck ck k k k KK KKK ck K x KKK KK KKK KKK KKK kk ok static void DemoFramewin void 1 User s amp ref
5. Type Macro Default Explanation Number of pixels that text bitmap moves in b BUTTON 3D MOVE X horizontal direction in pressed state a Number of pixels that text bitmap moves in i vertical direction in pressed state N BUTTON BKCOLORO DEFAU OxAAAAAA Background color unpressed state N BUTTON BKCOLORl1 DEFAULT GUI WHITE Background color pressed state S BUTTON FONT DEFAULT amp GUI Font13 1 Font used for button text N BUTTON TEXTCOLORO DEFAU GUI BLACK Text color unpressed state N BUTTON TEXTCOLOR1 DEFAULT GUI BLACK Text color pressed state B BUTTON USE 3D 1 Enable support for 3D effects The default for the button is to use a white background in pressed state This has been done purposely because it makes it very obvious that the button is pressed on any kind of display If you want the background color of the button to be the same in both its pressed and unpressed states BUTTON BKCOLORO DI BUTTON API The table below lists the available uC GUI BUTTON related routines in alphabetical order Detailed descriptions of the routines follow EFAULT cha nge BUTTON BKCOLOR1 DEFAULT to Routine Explanation ON Create Create the button CreateAsChild Create the button as a child window ON Createlndirecti Create the button from resource table entry SetBitmap Set the bitmap used when displaying t
6. eee nnne nena sean rna 24 4 Tutorial Using uC GUI with Target 29 4 1 BASICS u cenae dua aqa a lata Dele deuce Wa ue E EE 29 4 2 Howto use uCc GUI colina donald desk eas Saa 30 4 3 The Hello world sample program 2 7 1 30 4 4 Adding functionality to the Hello world program 31 5 Displaying RN 33 5 1 API reference text ooo Sin ee xx a eov u dr DE 33 5 2 Basic routines eos MA ERR E aoa SS iu Ea raa Ra adu 34 5 3 Routines to display text si ccc csse re aii er a C n Y HAC ya pai CH DE e RR 34 5 4 Selecting text drawing modes sssssssssssssssseseen emen 38 5 5 Selecting text aligniment i orte o dene heey ecce ceo pelle rai a xe Cu sd pi Ree gia 40 5 6 Setting the current text position 42 5 7 Retrieving the current text position eee eats teeta meme 43 5 8 Routines to clear a window or parts 2 2 43 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 6 Displaying Vala S uu u contin adeo Lee d ae a nd Au 45 6 1 API refe
7. sign Displaying binary values GUI DispBin Display value in binary form at current position GUI DispBinAt Display value in binary form at specified position Displaying hexadecimal values GUI DispHex Display value in hexadecimal form at current position GUI DispHexAt Display value in hexadecimal form at specified position 5 2 Displaying decimal values GUI DispDec Description Displays a value in decimal form with a specified number of characters at the current text position in the current window using the current font User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 53 Prototype void GUI 132 v U8 Len Parameter Meaning Value to display Minimum 2147483648 2 31 Maximum 2147483647 2 31 1 Len No of digits to display max 9 Additionnal information Leading zeros are not suppressed are shown as 0 If the value is negative a minus sign is shown Example Display time as minutes and seconds GUI DispString Min GUI DispDec Min 2 GUI DispString Sec GUI DispDec Sec 2 Related topics GUI DispSDec GUI DispDecAt GUI DispDecMin GUI DispDecSpace GUI DispDecAt Description Displays a value in decimal form with a specified number of characters at a specified position in the current window using the current font Prototype void GUI DispDecAt I132 v I16P x
8. User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation GUI MEMDEV CreateAuto amp AutoDev Show needle for a fixed time 135 for Cnt 0 tDiff GUI GetTime t0 lt 24000 Cnt 1 Get value to display an calculate polygon for needle Param Angle GetAngle tDiff DEG2RAD GUI RotatePolygon Param aPoints GUI MEMDEV DrawAuto amp AutoDev Display milliseconds picture I SetColor GUI WHITE I SetFont amp GUI Font8x16 I DispStringHCenterAt I SetTextAlign GUI TA C I SetTextMode GUI TM NO I DispNextLine I GotoX 160 I DispFloatMin float tDiff Delete GUI AUTODEV object I MEMDEV DeleteAuto amp AutoDev ENT RMA ER L Q 00n0g gnugogodgu aNeedle amp Param AutoDevInfo illiseconds picture loat Cnt countof aNeedle Param Angle amp Draw amp Param 160 180 2 KK IK IK kk k k K K K K K K K K KOK KOK CK KOK KOK KOK KOK A K main k k k K KKK KKK ck ck ck ck k Ck Ck k CK CK k x K CK CC k x CC x K lt CK x lt x k x CK x x lt x x x KKK KKK x lt x x x x lt lt void main void ifndef WIN32 OS InitKern OS InitHW fendif GUI Init while 1 DemoScale Screen shot for preceeding example Scale using GUI RUT DEU ob ject Milliseconds picture 1
9. Transparent text Transparent text means that the text is written on top of whatever is already visible on the display The difference is that whatever was previously on the screen can still be seen whereas with normal text the background is erased Text be displayed transparently by specifying GUI TEXTMODE TRANS XOR text What usually is drawn white the actual character is inverted The effect is identical to that of the default mode normal text if the background is black If the back ground is white the output is identical to reverse text If you use colors an inverted pixel is calculated as follows New pixel color 2 number of colors actual pixel color 1 Transparent reversed text As with transparent text it does not overwrite the background and as with reverse text the text is displayed in reverse Text can be displayed in reverse transparently by specifying GUI TEXTMODE TRANS GUI TEXTMODE REVERSE Example Displays normal reverse transparent XOR and transparent reversed text GUI SetFont amp GUI Font8x160 GUI SetFont amp GUI Font8x16 GUI SetBkColor GUI BLUE GUI Clear GUI SetPenSize 10 GUI SetColor GUI RED GUI DrawLine 80 10 240 90 GUI DrawLine 80 90 240 10 GUI SetBkColor GUI BLACK GUI SetColor GUI
10. User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 100 CHAPTER 8 Bitmap Converter Command Explanation convertinto323 Convert to 323 convertinto332 Convert to 332 convertinto8666 Convert to 8666 convertintoRGB Convert to RGB convertintobestpal Convert to best palette ette convertintocustompal Convert to a custom palette tte lt filename gt Parameter filename user specified filename of desired custom palette fliph Flip image horizontally flipy Flip image vertically rotate90cw Rotate image by 90 degrees clockwise rotate90cc Rotate image by 90 degrees counterclockwise rotate180 Rotate image by 180 degrees invertindices Invert indices saveas filename type Save file as filename Parameter filename user specified does NOT include file extension Parameter type must be an integer from 1 to 6 as follows C with palette c file C without palette c file C without palette compressed c file stream dta file 1 2 3 C with palette compressed c file 4 5 6 Windows Bitmap file bmp file exit Terminate PC program automatically help Display this box Display this box 8 9 Example of a converted bitmap A typical example for the use of the bitmap converter would be the conversion of your company lo
11. 72 8 5 Drawing HNES 74 8 6 ERR kN E ER OE ga 76 8 7 Drawing Circle S sisir coti ot erect roe tee elect erase fev evade tees tes 81 8 8 Drawing ellipses qapa ve eve eves dl C rd 83 8 9 Drawing u WARA 84 9 Bitmap Converter 87 9 1 Introduction 88 9 2 Supported input formats nnn nn 88 9 3 Supported output formats BRA e exei Ri ren RETE oe 88 9 4 Generating C files from 88 9 5 Color conversion ice 90 9 6 Compressed nnn nnn 92 9 7 Using a CUSTOM palette aA dus pae a dcc aaa 92 9 8 C mmand line usage soi I ege nene ie daa aaa al khas urere ex endure xu esca 93 9 9 Example of a converted 1 4 1 1 nemen nennen 94 TOK icono tate tdeo bebat I SEDE LU Sasha ooa Les atatum lett cal aaa 99 10 1 API reference COlOMS ua a aaa q a Qa Dao saq q eie ra dE e das 100 10 2 Predefined colors sc evi evi aa ert One CR OI KB Y e 100 10 3 The color bar test routine c
12. GUI_TA_HCENTER Centers the title default GUI_TA_LEFT Displays the title to the left GUI TA RIGHT Displays the title to the right Additionnal information If this function is not called the default behavior is to display the text centered FRAMEWIN SetTextColor Description Sets the title text color Prototype void FRAMEWIN SetTextColor FRAMEWIN Handle hObj GUI COLOR Color Parameter Meaning hObj Handle of frame window Coor Color to be used for title text FRAMEWIN_SetTextPos Description Sets the position of the title text User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 200 CHAPTER 13 Window Objects Widgets Prototype void FRAMEWIN SetTextPos FRAMEWIN Handle hObj int XOff int YOff Parameter Meaning hObj Handle of frame window KORT X position of the title text SOFT Y position of the title text Example The following example illustrates how to use the FRAMEWIN widget The widget is first created several of its attributes are modified and then a client window is cre ated You cannot use the frame window widget itself to display something a client window must always be created This example can be found in the samples as WIDGET FrameWin c RK IK HK k A IR CK KK SK SK KK SK SK SK SK Kk Ck ke ke ke Micrium Inc Empowering embedded systems uC GUI sample code
13. Routine Explanation CHECKBOX Check Set the check box state to checked CHECKBOX Create Create the check box CHECKBOX CreateIndirect Create the check box from resource table entry CHECKBOX IsChecked Return the current state checked or not checked of the check box CHECKBOX Uncheck Set the check box state to unchecked default CHECKBOX Check Description Sets a specified check box to a checked state Prototype void CHECKBOX Check CHECKBOX Handle hObj Parameter Meaning hObj Handle of check box CHECKBOX Create Description Creates a CHECKBOX widget of a specified size at a specified location Prototype CHECKBOX Handle CHECKBOX Create int x0 int y0 int xsize int ysize WM HWIN hParent int ID int Flags Parameter Meaning x0 Leftmost pixel of the check box in desktop coordinates 0 Topmost pixel of the check box desktop coordinates xsize Horizontal size of the check box in pixels ysize Vertical size of the check box in pixels User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 183 Parameter Meaning hParent Handle of parent window ID ID to be returned Window create flags Typically WM SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values Retur
14. 2002 Micrium Technologies Corporation 195 int xsize int ysize Parameter Meaning pTitle Title displayed in the title bar 68 Reserved for future use Window create flags Typically WM SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values x0 X position of the frame window yo Y position of the frame window xsize X size of the framw window ysize Y size of the frame window Return value Handle for the created FRAMEWIN widget 0 if the routine fails FRAMEWIN CreateAsChild Description Creates a FRAMEWIN widget as a child window Prototype FRAMEWIN Handle FRAMEWIN CreateAsChild int x0 int y0 int xsize int ysize WM HWIN hParent const char pText WM CALLBACK cb int Flags Paraneter Meaning x0 X position of the frame window relative to the parent window yo Y position of the frame window relative to the parent window xsize X size of the frame window ysize Y size of the frame window hParent Handle of parent window pText Text to be displayed in the title bar eb Reserved for future use Flags Window create flags see FRAMEWIN_Create Return value Handle for the created FRAMEWIN widget 0 if the routine fails FRAMEWIN Createlndirect Prototype explained at the beginning of the chapter The following fla
15. S gt gt gt static const GUI CHARINFO GUI FontSJIS13 CharInfo 6 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 264 CHAPTER 17 Shift JIS Support Ty 7 1 void amp acFontSJIS13 0041 code 0041 4 V 7 1 void amp acFontSJIS13 0042 code 0042 at Ly Ts 1 void amp acFontSJIS13 0043 code 0043 14 14 2 void amp acFontSJIS13 8350 code 8350 24 I4 14 2 void amp acFontSJIS13 8351 code 8351 Pt 14 14 2 void amp acFontSJIS13 8352 code 8352 static const GUI FONT PROP GUI FontSJIS13 Prop2 0x8350 first character 0x8352 last character amp GUI FontSJIS13 CharInfo 3 address of first character void 0 pointer to next GUI FONT PROP static const GUI FONT PROP GUI FontSJIS13 Propl 0x0041 first character 0x0043 last character amp GUI FontSJIS13 CharInfo 0 address of first character void amp GUI FontSJIS13 Prop2 pointer to next GUI FONT PROP static const GUI FONT GUI FontSJIS13 GUI FONTTYPE PROP 5015 type of font 13 height of font 13 space of font y l magnification x 1 magnification y void amp GUI FontSJIS13 Propl BK IK IK KR kk k k K K K K K K K K K K K K k ck k ck k ck kk k ck KOK KOK ck KOK KOK K Definition of string containing ASC
16. When a key is pressed with the mouse the corresponding section of the hardkey bitmap Devicel bmp will overlay the device bitmap in order to display the key in its pressed state The keys may be polled periodically to determine if their states pressed unpressed have changed and whether they need to be updated Alternatively a callback routine may be set to trigger a particular action to be carried out when the state of a hardkey changes 3 6 Simulator API All of the simulator API functions must be called in the setup phase The calls should ideally be done from within the routine 5 X Init which is located in the file SIM The example below calls SIM_SetLCDPos in the setup Ay include lt windows h gt include lt stdio h gt include SIM h void SIM X Init SIM SetLCDPos 0 0 Define the position of the LCD in the bitmap User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 35 The table below lists the available simulation related routines in alphabetical order within their respective categories Detailed descriptions of the routines follow Routine Explanation Device simulation SIM SetLCDPos Set the position for the simulated LCD within the target device bit map SIM SetTransColor Set the color to be used for transparent areas Hardkey simulation SIM HARDKEY GetNum Return the number of available hardkeys SIM HARDKEY GetS
17. low Routine Explanation GUI TOUCH GetState Return the current state of the touch screen GUI TOUCH StoreState Store the current state of the touch screen GUI TOUCH GetState Description Returns the current state of the touch screen Prototype int GUI TOUCH GetState GUI PID STATE pState Parameter Meaning pstate Pointer to a structure of type GUI PID STATE Return value 1 if touch screen is currently pressed 0 if not pressed GUI TOUCH StoreState Description Stores the current state of the touch screen Prototype void GUI TOUCH StoreState int x int y Parameter Meaning X position y Y position Additional information This function will call GUI PID StoreState Driver API for analog touch screens The pC GUI touch screen driver handles analog input from an 8 bit or better A D converter debouncing and calibration of the touch screen The touch screen driver continuously monitors and updates the touch panel through the use of the function GUI TOUCH Exec which calls the appropriate generic touch screen API routines when it recognizes that an action has been performed or some thing has changed User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 272 CHAPTER 18 Input Devices The table below lists the available analog touch screen driver routines in alphabetical order These functions only apply if you are using the driver included
18. Return value The selected text alignment mode Additionnal information GUI SetTextAllign does not affect the character output routines beginning with GUI DispChar Example Displays the value 1234 with the center of the text at x 100 y 100 GUI SetTextAlign GUI TA HCENTER GUI TA VCENTER GUI DispDecAt 1234 100 100 4 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 48 CHAPTER 4 Displaying Text 4 6 Setting the current text position Every task has a current text position This is the position relative to the origin of the window usually 0 0 where the next character will be written if a text output rou tine is called Initially this position is 0 0 which is the upper left corner of the cur rent window There are 3 functions which can be used to set the current text position GUI GotoXY GUI GotoX GUI GotoY Description Set the current text write position Prototypes char GUI GotoXY int x int y char GUI GotoX int x char GUI GotoY int y Parameter Meaning New X position in pixels O is left border y New Y position in pixels 0 is top border Return value Usually 0 If a value 0 is returned then the current text position is outside of the window to the right or below so a following write operation can be omitted Additionnal information GUI GotoXY sets both the X and Y components of t
19. Screen shot of above example Click on phone button 13 4 CHECKBOX Check box widget One of the most familiar widgets for selecting various choices is the check box A check box may be checked or unchecked by the user and any number of boxes may be checked at one time A box will appear gray if it is disabled as seen in the table below where each of the four possible check box appearances are illustrated Checked Unchecked Enabled Disabled E E User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 182 CHAPTER 13 Window Objects Widgets CHECKBOX related routines are located in the file s CHECKBOX c CHECKBOX h All identifiers are prefixed CHECKBOX Configuration options Type Macro Default Explanation CHECKBOX_BKCOLORO_DEFAULT 0 808080 Background color disabled state N CHECKBOX_BKCOLOR1_DEFAULT GUI_WHITE Background color enabled state N CHECKBOX_FGCOLORO_DEFAULT 0x101010 Foreground color disabled state N CHECKBOX_FGCOLOR1_DEFAULT GUI_BLACK Foreground color enabled state S CHECKBOX FONT DEFAULT amp GUI Font13 1 Font used for check mark B CHECKBOX USE 3D 1 Enable support for 3D effects CHECKBOX API The table below lists the available uC GUI CHECKBOX related routines in alphabetical order Detailed descriptions of the routines follow
20. static void Draw void p PARAM pParam PARAM p Fixed background if pParam AutoDevInfo DrawFixed GUI ClearRect 60 50 bmScaleR140 YSize 60 bmScaleR140 XSize 1 150 GUI DrawBitmap amp bmScaleR140 60 50 Moving needle GUI_SetColor GUI_WHITE GUI FillPolygon pParam aPoints countof aNeedle MAG 160 MAG 190 Fixed foreground if pParam AutoDevInfo DrawFixed GUI SetTextMode GUI TM TRANS GUI SetColor GUI RED GUI SetFont amp GUI Font24B ASCII GUI DispStringHCenterAt RPM 1000 160 110 RK IK IK kk k k K K K k K K K k kkk kk K K K K K K K K K K K K K K K KOK KOK K K k ck k ck k ck kck k ck KOK KOK ck ck KOK K Shows a scale with a needle using a banding memory device CK ck ck k k k K ck ck Ck ck ck Ck ck k k k lt ck lt k ck x k ck ck ck x k ck x lt ck x k k x ck Ck ck k k ck ck k k k k k ck ck k k k k k KKK k k ko oko tic void DemoScale void 1 nt Cnt nt tDiff t0 GUI GetTime ARAM Param Parameters for drawing routine UI AUTODEV AutoDev Object for banding memory device Show message UI SetColor GUI WHITE UI SetFont amp GUI Font8x160 UI DispStringHCenterAt Scale using GUI AUTODEV object 160 0 Enable high resolution for antialiasing UI AA EnableHiRes UI AA SetFactor MAG Create GUI AUTODEV object m ct w 0 0 0 0
21. R SetTextPos Set the text position default 0 0 U ROGBA R SetValue Set the value for the bar graph and percentage if no text has been assigned PROGBAR Create Description Creates a PROGBAR widget of a specified size at a specified location Prototype PROGBAR Handle PROGBAR Create int x0 int y0 int xsize int ysize int Flags Parameter Meaning x0 Leftmost pixel of the progress bar in desktop coordinates 0 Topmost pixel of the progress bar in desktop coordinates xsize Horizontal size of the progress bar in pixels ysize Vertical size of the progress bar in pixels Window create flags Typically WM SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values Return value Handle for the created PROGBAR widget 0 if the routine fails User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 211 PROGBAR Createlndirect Prototype explained at the beginning of the chapter The elements Flags and Para of the resource passed as parameter are not used PROGBAR SetBarColor Description Sets the color s of the progress bar Prototype void PROGBAR SetBarColor PROGBAR Handle hObj int Index GUI COLOR Color Parameter Meaning Handle of progress bar Index See tabl
22. Parameter Meaning Value Value to be modified Min Minimum value Max Maximum value Len Number of digits to edit xsize Pixel size in X of edit field Suq F E If gt O it specifies the position of the decimal point Flags See EDIT SetDecMode Return value The new value will be returned if ENTER is pressed If lt ESC gt is pressed the old value is returned Additionnal information The routine returns after pressing ENTER or lt ESC gt The contents of the given text will be modified only if ENTER is pressed GUI EditHex Description Edits a hexadecimal value at the current cursor position Prototype U32 GUI EditHex U32 Value U32 Min U32 Max int Len int xsize Parameter Meaning Value Value to be modified Min Minimum value Max Maximum value Len Number of digits to edit xsize Pixel size in X of the edit field Return value The new value will be returned if ENTER is pressed If ESC is pressed the old value is returned Additionnal information The routine returns after pressing ENTER or lt ESC gt The contents of the given text will be modified only if ENTER is pressed User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 192 CHAPTER 13 Window Objects Widgets GUI EditString Description Edits a string at the current cursor position Prototype void GUI EditString char pString int
23. Cancel Button GUI EndDialog hWin 1 break case WM NOTIFICATION SEL CHANGED Selection changed FRAMEWIN SetText hWin Dialog sel changed break default FRAMEWIN SetText hWin Dialog notification received break default WM DefaultProc pMsg For further details this entire example is available as Dialog c in the samples shipped with u C GUI 14 3 API reference dialogs The table below lists the available dialog related routines in alphabetical order within their respective categories Detailed descriptions of the routines can be found in the sections that follow Routine Explanation Dialog boxes GUI_CreateDialogBox Create a non blocking dialog GUI_ExecDialogBox Create a blocking dialog GUI_EndDialog End a dialog box Message boxes GUI_MessageBox Create a message box 14 4 Dialog boxes GUI CreateDialogBox Description Creates a non blocking dialog box Prototype WM HWIN GUI CreateDialogBox const GUI WIDGET CREATE INFO paWidget int NumWidgets WM CALLBACK cb User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 237 WM HWIN hParent int x0 int 0 Parameter Meaning paWidget Pointer to resource table defining the widgets to be included in the dialog NumWidgets Total number of widgets included in the dialog cb Pointer to an application specific c
24. RK IK IKK RR K SK K K K K K K Ck CKCk Ck k ck k ck k ck k ck k ck KOK KOK KOK KOK K main CK Ck CK Ck k k k k Kk x k lt lt lt x K k k k kk K k k k x x K x kk Ck k k x Ck Sk lt x kk x K x k kk lt x x k x x KKK KK KKK void main void GUI Init ShowHiResPixel while 1 Magnified Screen shot for preceeding example Moving pointer using high resolution antialiasing This example illustrates the use of high resolution antialiasing by drawing a rotating pointer that turns 0 1 degrees with each step There is no screen shot of this exam ple because the effects of high resolution antialiasing are only visible in the move ment of the pointers Without high resolution the pointer appears to make short jumps whereas in high resolution mode there is no apparent jumping The example can be found under Sample Misc HiResAntialiasing c RK KK KK A A A A A A A A A A A K K I KOK KOK KOK KOK KOK KOK Micrium Inc Empowering embedded systems ig uC GUI sample code Dk k k k k ck kk k k k k k k k K ck k k ck k k ck ck ck ck ck k k k ck k k k k k ck ck k k k k k k k k k ck k k k k ck k k k k Sk ck k k k KK ko k ko ko File HiResAntialiasing c Purpose Demonstrates high resolution antialiasing include GUI H kk ck k k k k k ck lt k lt k lt lt KKK k k k KKK k k x kk ck kk x lt lt Ck x k k k lt kk k x x x k k kk k k k k k k k k k ko
25. 1 Frame window is active User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation FRAMEWIN SetBarColor Description Sets the background color of the title bar 197 Prototype void FRAMEWIN SetBarColor FRAMEWIN Handle hObj int Index GUI COLOR Color Parameter Meaning hObj Handle of frame window Index Has to be 0 reserved for future use Color Color to be used as background color for the title bar FRAMEWIN SetClientColor Description Sets the color of the client window area Prototype void FRAMEWIN SetClientColor FRAMEWIN Handle hObj GUI COLOR Color Parameter Meaning hObj Handle of frame window Color Color to be set FRAMEWIN SetDefaultBarColor Description Sets the color of the title bar Prototype void FRAMEWIN SetDefaultBarColor int Index GUI COLOR Color Parameter Meaning Index Index for color see table below Colton Color to be set Permitted values for parameter Index 0 Sets the color to be used when frame window is inactive 1 Sets the color to be used when frame window is active FRAMEWIN SetDefaultBorderSize Description Sets the default border size of frame windows User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 198 CHAPTER 13 Window Objects Widgets Prototype void FRAMEWIN SetDefaultBorderSize int BorderSi
26. 135 BytesPerLine GUI COMPRESS RLEA BitsPerPixel acLogoCompressed Pointer to picture data indices amp PalLogoCompressed Pointer to palette DRAW RLE4 J LESES End of file Fee z User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 104 CHAPTER 8 Bitmap Converter User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 105 Chapter 9 Colors HC GUI supports black white grayscale monochrome with different intensities and color displays The same user program can be used with any display only the LCD configuration needs to be changed The color management tries to find the closest match for any color that should be displayed Logical colors are the colors the application deals with A logical colors is always defined as an RGB value This is a 24 bit value containing 8 bits per color as follows OxBBGGRR Therefore white would be OxFFFFFF black would be 0x000000 bright red OxFF Physical colors are the colors which can actually be displayed by the display They are specified in the same 24 bit RGB format as logical colors At run time logical col ors are mapped to physical colors For displays with few colors such as monochrome displays 8 16 color LCDs uC GUI converts them by using an optimized version of the least square deviation search It compares the color to display the logical color with all the available col
27. Description Returns the coordinates of the client area in the active window Prototype void WM GetClientRect GUI RECT pRect Parameter Meaning pRece Pointer to a GUI_RECT structure WM GetDialogltem Description Returns the window handle of a dialog box item widget User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 154 CHAPTER 12 The Window Manager WM Prototype WM HWIN WM GetDialogItem WM HWIN hDialog int Id Parameter Meaning hDialog Handle of dialog box ie Window ID of the widget Return value The window handle of the widget Additionnal information This function is always used when creating dialog boxes since the window ID of a widget used in a dialog must be converted to its handle before it can be used WM_GetOrgX WM_GetOrgY Description Return the X or Y position respectively of the origin of the client area in the active window Prototypes int WM_GetOrgX void int WM GetOrgY void Return value X or Y position of the client area in pixels WM GetWindowOrgX WM GetWindowOrgY Description Return the X or Y position respectively of the origin of the client area in a specified window Prototypes int WM GetWindowOrgX WM HWIN hWin int WM GetWindowOrgY WM HWIN hWin Parameter Meaning hWin Window handle Return value X or Y position of the client area in pixels
28. GUI DispString Foreground window break User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 168 CHAPTER 12 The Window Manager WM default WM DefaultProc pMsg J KCKCKCKCKCKCk KR K K K K K SK K K K K K K KOK K Ck k ck k ck k ck KOK kck KOK KOK K K KOK K K Demonstrates the redraw mechanism of uC GUI kk ck k k k k k ck lt ck Ck ck kk Ck x k k k KKK k x k KKK Ck x ck k x ck kk k k x kk ck x x lt ck ck x x k lt x lt kk ko x x KKK KK KKK static void DemoRedraw void GUI HWIN hWnd while 1 Create foreground window hWnd WM CreateWindow 10 10 100 100 WM CF SHOW cbForegroundWin 0 Show foreground window UI Delay 1000 Delete foreground window DeleteWindow hWnd UI DispStringAt Background of window has not been redrawn 10 10 Wait a while background will not be redrawn UI Delay 1000 UI Clear Set callback for Background window SetCallback WM HBKWIN cbBackgroundWin Create foreground window WM CreateWindow 10 10 100 100 WM CF SHOW cbForegroundWin 0 Show foreground window UI Delay 1000 Delete foreground window DeleteWindow hWnd Wait a while background will be redrawn UI Delay 1000 Delete callback for Background window SetCallback WM HBKWIN 0 51 0 51 0 5 2 0 0 21 0 R
29. User s amp reference manual for uC GUI 35 2002 Micrium Technologies Corporation 136 CHAPTER 10 Memory Devices User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 137 Chapter 11 Execution Model Single Task Multitask HC GUI has been designed from the beginning to be compatible with different types of environments It works in single task and in multitask applications with a propri etary operating system or with any commercial RTOS such as embOS or uC OS User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 138 CHAPTER 11 Execution Model Single Task Multitask 11 1 Supported execution models We have to basically distinguish between 3 different execution models Single task system superloop The entire program runs in one superloop Normally all software components are peridocally called Interrupts must be used for real time parts of the software since no real time kernel is used yu C GUlIMultitask system one task calling pC GUI A real time kernel RTOS is used but only one task calls uC GUIUC GUI functions From the graphic software s point of view it is the same as being used in a single task system uC GUIMultitask system multiple tasks calling uC GUI real time kernel RTOS is used and multiple tasks call pC GUI functions This works without a problem as long as the software is made thread safe which is done by enablin
30. Value to be set Additionnal information The topmost radio button in a RADIO widget always has the 0 value the next button down is always 1 the next is 2 etc 13 10 SCROLLBAR Scroll bar widget Scroll bars are used for scrolling through list boxes or any windows which do not fit entirely into their frames They may be created horizontally as shown below or ver tically User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 219 A scroll bar is typically attached to an existing window for example the list box shown below All SCROLLBAR related routines are located in the file s SCROLLBAR c SCROLL BAR h All identifiers are prefixed SCROLLBAR Configuration options Type Macro Default Explanation N SCROLLBAR _BKCOLORO_DEFAULT 0x808080 Background thumb area color N SCROLLBAR _BKCOLOR1_DEFAULT GUI_BLACK Scroll bar thumb color N SCROLLBAR COLORO DEFAULT OxcOcOcO Arrow button colors B SCROLLBAR USE 3D 1 Enable 3D support SCROLLBAR API The table below lists the available uwC GUI SCROLLBAR related routines alphabeti cal order Detailed descriptions of the routines follow Routine Explanation SCROLLBAR AddValue or decrement the value of the scroll bar by a specified SCROLLBAR_Create Create the s
31. k k k lt K k k k lt lt lt k k k KK lt k k KK ko Micrium Inc Empowering embedded systems pC GUI sample code k k x ck k k k k k ck k k K k Sk ck Ck x k k k ck Ck ck ck k ck k k k k k k k k k k k k k ck k k k k k KK k k k KK k k k KKK KKK k k KKK File BandingMemdev c Purpose Example demonstrating the use of banding memory devices include gui h User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 129 static const GUI POINT aPoints 50 0 10 10 0 50 10 10 50 O 10 10 0 50 1 10 10 define SIZE OF ARRAY Array sizeof Array sizeof Array 0 typedef struct int XPos_Poly YPos_Poly int XPos_Text YPos_Text GUI_POINT aPointsDest 8 tDrawItContext KK KK IK kk kk kk K K K K K K K K K KOK KOK KOK KOK KOK KOK KOK A KOK KOK KOK KOK KOK k ck k ck k ck KOK KOK KOK KOK KOK K kx Drawing routine K ck ck ck ck k ck k k Ck Ck k Ck Ck k Ck K k CC k x x k x x k K K k x x x k x K k KK x lt k K K K k x lt KKK KKK k x lt x x lt Ff static void DrawIt void pData tDrawItContext pDrawlItContext tDrawItContext pData GUI Clear GUI SetFont amp GUI Font8x8 GUI SetTextMode GUI TM TRANS draw background GUI SetColor GUI GREEN GUI FillRect pDrawItContext XPos Text pDrawItContext YPos Text 25
32. GUI DispDecShift Description Displays a 1ong value in decimal form with a specified number of characters and with decimal point at the current text position in the current window using the current font Prototype void GUI DispDecShift I32 v U8 Len U8 Shift Parameter Meaning Value to display Minimum 2147483648 2 31 maximum 2147483647 2 31 1 Len No of digits to display max 9 Shift No of digits to show to right of decimal point Additionnal information Watch the maximum number of 9 characters including sign and decimal point GUI DispDecSpace Description Displays a value in decimal form at the current text position in the current window using the current font Leading zeros are suppressed replaced by spaces User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 55 Prototype void DispDecSpace I32 v U8 MaxDigits Parameter Meaning Value to display Minimum 2147483648 2 31 maximum 2147483647 2 31 1 No of digits to display including leading spaces Maximum no of digits displayed is 9 excluding leading spaces V MaxDigits Additionnal information If values have to be aligned but differ in the number of digits this function is a good choice Example Show result GUI DispString The result is GUI DispDecSpace Result 200 Related topics GUI DispDec GUI DispDecAt GU
33. Move a window to another position Paint Draw or redraw a window immediately _ResizeWindow Change window size SelectWindow Set the active window to be used for drawing operations zx ShowWindow Make a window visible Advanced functions Activate Activate the window manager BringToBottom Place a window behind its siblings BringToTop Place a window in front of its siblings ClrHa sTrans t Clear the has transparency flag Deactivate Deactivate the window manager DeftaultProci Default routine to handle messages GetActiveWindow Return handle of the active window GetDesktopWindow Return handle of the desktop window GetFirstthild t Return handle of a window s first child window GetNextSibling Return handlw of a window s next sibling GetHasTrans Return current value of the has transparency flag GetParent Return handle of a window s parent window Tie O Initialize window manager No longer necessary done by GUI Init IsWindow Determine whether a specified handle is a valid window handle SendMessage Send a message to a window SetDesktopColor Set desktop window color _SetCallback Set the callback routine for a window SetCreateFlags Sets the flags to be used as default
34. WM GetWindowRect Description Returns the coordinates of the active window User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 155 Prototype void WM GetWindowRect GUI RECT pRect Parameter Meaning pRect Pointer to a GUI RECT structure WM GetWindowSizeX WM GetWindowSizeY Description Return the X or Y size respectively of a specified window Prototypes int WM GetWindowSizeX WM HWIN hWin int WM GetWindowSizeY WM HWIN hWin Parameter Meaning hWin Window handle Return value X or Y size of the window in pixels Defined as x1 x0 1 in horizontal direction y1 yO 1 in vertical direction where xO yO y1 are the leftmost rightmost topmost bottommost positions of the window WM HideWindow Description Makes a specified window invisible Prototype void WM HideWindow WM HWIN hWin Parameter Meaning hWin Window handle Additionnal information The window will not immediately appear invisible after calling this function The invalid areas of other windows areas which appear to lie behind the window which should be hidden will be redrawn when executing wM Exec If you need to hide draw over a window immediately you should call Paint to redraw the other windows WM InvalidateArea Description Invalidates a specified rectangular area of the display User s amp reference ma
35. cela aha virer reu se Rip ai ee qe 9 1 4 How to use this 4 144 1 4 lt ase sena nnn nnn 10 1 5 Typographic conventions for syntax 1 11 nn 10 1 6 gua M E LE IEEE EE REED 10 1 7 Samples and demos oo oe p ee xe e m D de V ns n V n ga 12 1 8 Screen and coordinates u u a u esee nennen sena sea sena saa ren nnn 12 1 9 How to connect the LCD to the microcontroller cese 12 1 10 Data a do REED aT E EU 13 1 11 Types of Configuration MACKOS xx Ee eh eee ya Aaa le er RR 14 Getting Started 15 2 1 Recommended directory 1 enne 16 2 2 Configuring terit eral bee xe En Ne 17 2 3 Using UC GUI with your target 22 22 2 2 2 4 2244440 17 2 4 C files to include in the project 66 17 2 5 Creating ius creep 18 SNEIMUMLierterc IN 19 3 1 Understanding the simulator 1 eene emen 20 3 2 Using the simulat ssar cen DRE abel 21 3 3 THE VIEW Id 21 3 4 Device simulation and other advanced features 22 3 5 API reference
36. 2002 Micrium Technologies Corporation 22 CHAPTER 2 Getting Started 2 4 pnC GUI C files to include in the project Generally speaking you need to include the core C files of uC GUI the LCD driver all font files you plan to use and any optional modules you have ordered with uC GUI e All C files of the folders GUI Core GUI ConvertColor and GUI ConvertMono e The fonts you plan to use located in GUI Font Additional software packages If you plan to use additional optional modules you must also include their C files e Antialiasing all C files located in GUI AntiAlias Memory devices all C files located in GUI MemDev Touch panel support all C files located in GUI Touch Widget library all C files located in GUI Widget Window Manager all C files located in GUINWM Using the hardware e LCD driver All C files of the folder GUI LCDDriver except LCDWin c e GUI X c A sample file is available as Sample GUI x This file contains the hard ware dependent part of uC GUI and should be modified as described in Chapter 21 High Level Configuration Using the simulator e CD driver GUI LCDDriver LCDWin c Be sure that you include GuI h in all of your source files that access u C GUI 2 5 wC GUIConfiguring pnC GUI The Config folder should contain the configuration files matching your order The file LCDConf h normally contains all the definitions necessary to adopt pu C GUI to your LCD which is the mai
37. 245 15 2 Antialiasing API The table below lists the available routines in the antialiasing package in alphabeti cal order within their respective categories Detailed descriptions of the routines can be found in the sections that follow Routine Explanation Control functions GUI AA DisableHiRes Disable high resoluton coordinates GUI AA EnableHiRes Enable high resolution coordinates GUI AA GetFactor Return the current antialiasing factor GUI AA SetFactor Set the current antialiasing factor Drawing functions GUI AA DrawArc Draw an antialiased arc GUI AA DrawLine Draw an antialiased line GUI AA DrawPolyOutline Draw the outline of an antialiased polygon GUI AA FillCircle Draw an antialiased circle GUI AA FillPolygon Draw a filled and antialiased polygon 15 3 Control functions GUI AA DisableHiRes Description Disables high resolution coordinates Prototype void GUI AA DisableHiRes void Additional Information High resolution coordinates are disabled by default GUI AA EnableHiRes Description Enables high resolution coordinates Prototype void GUI AA EnableHiRes void GUI AA GetFactor Description Returns the current antialiasing quality factor Prototype int GUI AA GetFactor void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 246 CHAPTER 15 Return
38. LISTBOX_GetSe 1 Return the number of the selected row LISTBOX IncSel Increment selection LISTBOX SetBackColor Set the background color LISTBOX SetDefaultFont Change the default font for LISTBOX widgets LISTBOX SetFont Select the font LISTBOX SetSel Set the selected row LISTBOX SetTextColor Set the foreground color LISTBOX Create Description Creates a LISTBOX widget of a specified size at a specified location Prototype LISTBOX Handle LISTBOX Create const GUI ConstString ppText int x0 int 0 int xSize int ySize int Flags Parameter Meaning pprext Pointer to an array of string pointers containing the elements to be displayed x0 X position of the list box yo Y position of the list box User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 203 Parameter Meaning xSize X size of the list box ySize Y size of the list boxt Window create flags Typically WM SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values Return value Handle for the created FRAMEWIN widget 0 on failure Additionnal information If the parameter ySize is greater than the required space for drawing the contents of the widget the Y size will be reduced to the required value The same applies for the Xsize parameter LISTB
39. User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 122 CHAPTER 10 Memory Devices Routine Explanation GUI MEMDEV CreateAuto Create an auto device object GUI MEMDEV DeleteAuto Delete an auto device object GUI MEMDEV DrawAuto Use a GUI AUTODEV object for drawing User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 123 GUI MEMDEV Create Description Creates a memory device Prototype GUI MEMDEV Handle GUI MEMDEV Create int x0 int y0 int XSize int YSize Parameter Meaning x0 X position of memory device yo Y position of memory device xsize X size of memory device ysize Y size of memory device Return value Handle for created memory device If the routine fails the return value is O GUI_MEMDEV_CopyToLCD Description Copies the contents of a memory device from memory to the LCD Prototype void GUI_MEMDEV_CopyToLCD GUI_MEMDEV_Handle hMem Parameter Meaning hMem Handle to memory device GUI MEMDEV Delete Description Deletes a memory device Prototype void GUI MEMDEV Delete GUI MEMDEV Handle MemDev Parameter Meaning hMem Handle to memory device Return value Handle for deleted memory device GUI MEMDEV Select Description Activates a memory device o
40. c 1998 2002 Segger Microcontroller Systeme GmbH www seggercom Source file LogoCompressed Dimensions 269 76 NumColors 10 2 include stdlib h include GULH Palette The following are the entries of the palette table Every entry is a 32 bit value of which 24 bits are actually used the lower 8 bits represent the Red component the middle 6 bits represent the Green component User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 103 the highest 8 bits of the 24 bits used represent the Blue component as follows OxBBGGRR const GUI COLOR ColorsLogoCompressed OxBFBFBEOxFFFFFEOxB5B5B5 0x000000 OxFF004C 0xB5002B 0x888888 0xCF0038 0x CFCFCF 0xCOCOCO const GUI LOGPALETTE PalLogoCompressed 10 number of entries 0 No transparency amp ColorsLogoCompressed 0 gt const unsigned char acLogoCompressed RLE 270 Pixels 000 000 254 0x00 16 0x00 RLE 268 Pixels 001 001 254 0x01 14 0x01 RLE 001 Pixels 000 002 1 0x00 RLE 267 Pixels 001 002 254 0x01 13 0x01 ABS 002 Pixels 266 002 0 2 0x20 ABS 002 Pixels 268 073 0 2 0x20 RLE 267 Pixels 001 074 254 0x01 13 0x01 ABS 003 Pixels 268 074 0 3 0x20 0x10 RLE 267 Pixels 002 075 254 0x02 13 0x02 0 4702 for 20444 pixels const GUI BITMAP bmLogoCompressed 269 XSize 16 YSize
41. 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x20 b const GUI BITMAP bmMicriumLogoBlue 269 XSize 76 YSize 135 BytesPerLine 4 BitsPerPixel acMicriumLogoBlue Pointer to picture data indices amp PalMicriumLogoBlue Pointer to palette 5 fe 8 Eng of file We can use the same bitmap image to create a compressed C file which is done sim ply by loading and converting the bitmap as before and saving it as C with palette compressed The source code is displayed below some data is not shown to con serve space The total number of pixels used in the image is 269 76 20444 Since every pixel can take any of the 16 colors used to compose this bitamp each pixel take 4 bits Two pixel are stored per byte and the total uncompressed size of the image is 20444 2 10222 bytes At the end of the following code the total compressed image size can be seen as 4702 bytes for 20444 pixels The ratio of compression can therefore be calculated as 10222 4702 2 17 Resulting compressed C code generated by bitmap converter yt C file generated by uC BmpCvt V2 30b compiled May 8 2002 10 05 37 c 2002 Micrium Inc www micrium com
42. 1 LCD READ AO 1 and so on Note that the first controller is considered to be controller 0 so that a second con troller would be defined as 1 etc The macros for additional LCD controllers are listed as follows Second LCD controller Type Macro Explanation F CD READ 0 1 Result LCD controller 1 Read a byte with AO O F READ 1 1 Result LCD controller 1 Read a byte with AO 1 F LCD WRITE 0 1 Byte LCD controller 1 Write a byte with AO O F LCD WRITE 1 1 Byte LCD controller 1 Write a byte with AO 1 Third LCD controller Type Macro Explanation F CD READ 0 2 Result LCD controller 2 Read a byte with AO 0 F READ 1 2 Result LCD controller 2 Read a byte with AO 1 F LCD WRITE 0 2 Byte LCD controller 2 Write a byte with AO 0 F LCD WRITE A1 2 Byte LCD controller 2 Write a byte with AO 1 Fourth LCD controller Type Macro Explanation F CD READ 0 3 Result LCD controller 3 Read a byte with AO O F CD READ A1 3 Result LCD controller 3 Read a byte with AO 1 F LCD WRITE 0 3 Byte LCD controller 3 Write a byte with AO O F LCD WRITE A1 3 Byte LCD controller 3 Write a byte with AO 1 20 8 Full bus interface configuration Some LCD controllers especially those for displays with higher resolution requir
43. 8 8 bit wide VRAM 16 16 bit wide VRAM default Additionnal information Since this completely depends on your hardware you will have to substitute these macros The Epson SED1352 distinguishes between memory and register access memory is the video memory of the LCD controller and registers are the 15 configu ration registers The macros define how to access read write VRAM and registers LCD ENABLE REG ACCESS Description Enables register access and sets the M R signal to high Type Function replacement Prototype define LCD ENABLE REG ACCESS MR 1 Additionnal information Only used for Epson SED1356 and SED1386 controllers After using this macro LCD ENABLE MEM ACCESS must also to be defined in order to switch back to memory access after accessing the registers LCD ENABLE MEM ACCESS Description Switches the M R signal to memory access It is executed after register access func tions and sets the M R signal to low Type Function replacement Prototype define LCD ENABLE MEM ACCESS MR 0 Additionnal information Only used for Epson SED1356 and SED1386 controllers LCD SWAP BYTE ORDER Description Inverts the endian mode swaps the high and low bytes between CPU and LCD con troller when using a 16 bit bus interface Type Binary switch User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 297 0 inactive e
44. GUI DispBinAt Description Displays a value in binary form at a specified position in the current window using the current font Prototype void DispBinAt U32 v I16P y I16P x U8 Len Parameter Meaning v Value to display 16 bit x X position to write to in pixels of the client window Y position to write to in pixels of the client window Len No of digits to display including leading zeroes Additionnal information As with decimal and hexadecimal values the least significant bit is rightmost Example Show binary input status P e Input 0 0 8 Related topics GUI DispBin GUI DispHex 5 5 Displaying hexadecimal values GUI DispHex Description Displays a value in hexadecimal form at the current text position in the current win dow using the current font Prototype void GUI DispHex U32 v U8 Len Parameter Meaning v Value to display 16 bit Len No of digits to display Additionnal information As with decimal and binary values the least significant bit is rightmost User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 61 Example Show value of AD converter GUI DispHex Input 4 Related topics GUI DispDec GUI DispBin GUI DispHexAt GUI DispHexAt Description Displays a value in hexadecimal form at a specified position in the current window using the current font Prototype v
45. I16P y U8 Len Parameter Meaning Value to display Minimum 2147483648 2 31 Maximum 2147483647 2 31 1 x X position to write to in pixels of the client window y Y position to write to in pixels of the client window Len No of digits to display max 9 Additionnal information Leading zeros are not suppressed If the value is negative a minus sign is shown Example Update seconds in upper right corner GUI DispDecAT Sec 200 0 2 Related topics GUI DispDec GUI DispSDec GUI DispDecMin GUI DispDecSpace User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 54 CHAPTER 5 Displaying Values GUI DispDecMin Description Displays a value in decimal form at the current text position in the current window using the current font The length need not be specified the minimum length will automatically be used Prototype void GUI DispDecMin I32 v Parameter Meaning Value to display y Minimum 2147483648 2 31 maximum 2147483647 2 31 1 Maximum no of digits displayed is 9 Additionnal information If values have to be aligned but differ in the number of digits this function is not a good choice Try one of the functions that specify the number of digits Example Show result GUI DispString The result is GUI DispDecMin Result Related topics GUI DispDec GUI DispDecAt GUI DispSDec GUI DispDecSpace
46. Prototypes void LISTBOX DecSel LISTBOX Handle hObj Parameter Meaning hObj Handle of list box LISTBOX GetDefaultFont Description Returns the default font used for creating LISTBOX widgets Prototype const GUI FONT LISTBOX GetDefaultFont void Return value Pointer to default font LISTBOX GetSel Description Returns the number of the currently selected element in a specified list box Prototype int LISTBOX GetSel LISTBOX Handle hObj Parameter Meaning hObj Handle of list box Return value Number of the currently selected element LISTBOX IncSel Description Increment the list box selection moves the selection bar of a specified list box down by one element Prototypes void LISTBOX IncSel LISTBOX Handle hObj Parameter Meaning hObj Handle of list box User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 205 LISTBOX SetBackColor Description Sets the list box background color Prototype void LISTBOX SetBackColor LISTBOX Handle hObj int Index GUI COLOR Color Parameter Meaning Handle of list box Index Index for background color see table below Colors Color to be set Permitted values for parameter Index 0 Sets the color for unselected elements 1 Sets the color for the selected element LISTBOX_SetDefaultFont Description Sets the default font used for creatin
47. Return the current state of the PID GUI_PID_StoreState Store the current state of the PID GUI PID_GetState Description Returns the current state of the pointer input device Prototype void GUI_PID_GetState const GUI PID STATE pState Parameter Meaning pstate Pointer to a structure of type GUI STATE Return value 1 if input device is currently pressed 0 if not pressed GUI PID StoreState Description Stores the current state of the pointer input device Prototype int GUI PID StoreState GUI PID STATE pState Parameter Meaning pstate Pointer to a structure of type GUI PID STATE User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 269 18 1 1 Mouse driver input Mouse support consists of two layers a generic layer and a mouse driver layer Generic routines refer to those functions which always exist no matter what type of mouse driver you use The available mouse driver routines on the other hand will call the appropriate generic routines as necessary and may only be used with the PS2 mouse driver supplied with uC GUI If you write your own driver it is responsible for calling the generic routines The generic mouse routines will in turn call the corresponding PID routines Generic mouse API The table below lists the generic mouse routines in alphabetical order These func tions may be used with any type of mouse driver Detailed desc
48. Uca FAS Ea a IF l L 2 oP h 120 bytes size of GUI Fonti16 HK size of GUI Fonti6 1 size of GUI Fonti6 ASCII ee F16 1HK c F16 HK c 16 1 F16 ASCII c GUI Fonti16B ASCII User s amp reference manual for uC GUI Crim I 2 55 amp 0123456789 2 eGABCDEFGHIJKL M HOPORSTUVWX YZD abcdefghijklmnopqrstuvw xyztli 2002 Micrium Technologies Corporation 357 ROM Size Used files 2690 bytes F16B ASCII c GUI Font16B 1 Cr ul I 2 05 amp 4 0123456789 2 eGABCDEF GHIJKL M 2 amy AARAA ra x fo x r 1 ROM Size Used files 2790 bytes size of GUI Font16B ASCII F16B 1 c F16B ASCII c GUI FontComic18B ASCII rum Hn 0 0123456789 22 9 ABCD EFGHIJKLMNOPQRSTUVWXYZ Y ab cdefghi kImnopqrstuvwxyzt VD amp ROM Size Used files 3572 bytes FComic18B ASCII c User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 358 CHAPTER 25 Standard Fonts GUI FontComic18B 1 cul na 0123456789 2 9 ABCD EFGHIJKLANOPQRSTUVWXYZ DT cde fghi il rstuvuxyz D ERS a Q Q 9473 ug 4420 AAAAAAALCEE EELIITDNOOOOS QUUULY Phadaatiaces ee eililanooood euuuuyp ROM Size Used files 4334 bytes size of GU
49. bela SEG2 SEG3 SEG4 gt lt gt lt gt Pane1 7 B G R B G R B G R i Q x gt Q Pane 0 7 B G R B G R B G R B G R B G R D DD DD D D COM 0 B B B BB B 7 6 5 4 312 11 D B 0 Byten 327 a B G R B G R B coun 3 bits per pixel fixed palette 111 B Byte 0 Byte 1 SEGO SEG1 SEG2 SEG3 SEG4 ra q gt 4 B G R B G R B G R B G R B G R D D D DI D D D D COM 0 B B B B 716 543210 E B G R B G R B G R B G R B G R B coun Byte n This driver supports a 3 or 6 bpp memory area for color displays The pictures above show the dependence between the memory area handled by the driver and the SEG and COM lines of the LCD 6 bits per pixel fixed palette mode 222 When using the 6 bpp mode the display memory is divided into 2 panes for each pixel The lower bit of each pixel is stored in pane O and the higher bit is stored in pane 1 The advantage of this method is that the output of the display data can be executed very quickly User s amp reference manual for uC GUI 2002 Micrium Technologies Corpo
50. color may be changed with the function SIM SetTransColor Hardkey simulation Hardkeys may also be simulated as part of the device and may be selected with the mouse pointer The idea is to be able to distinguish whether a key or button on the simulated device is pressed or unpressed A hardkey is considered pressed as long as the mouse button is held down releasing the mouse button or moving the pointer off of the hardkey unpresses the key A toggle behavior between pressed and unpressed may also be specified with the routine SIM HARDKEY SetMode In order to simulate hardkeys you need a second bitmap of the device which is transparent except for the keys themselves in their pressed state This bitmap can again be in a seperate file in the directory or included as a resource in the execut able The filename needs to be Devicel bmp and the following lines would typically be included in the resource file extension rc 145 BITMAP DISCARDABLE Device bmp 146 BITMAP DISCARDABLE Devicel bmp User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 34 CHAPTER 3 Simulator Although hardkeys may be any shape it is very important that the two bitmaps are the same size in pixels so that the hardkeys in Devicel bmp will overlay those in Device bmp exactly The following example illustrates this Device bitmap unpressed hardkey Device hardkey bitmap pressed state Device bmp hardkey state Device1 bmp
51. e Which LCD controllers can be accessed as well as supported color depths and types of interfaces Additional RAM requirements Additional functions How to access the hardware Special configuration switches Special requirements for particular LCD controllers User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 310 CHAPTER 22 LCD Drivers 22 1 Supported LCD controllers and respective drivers The following table lists the available drivers and which LCD controllers are supported by each Value for macro Supported Driver LCD ntroller 3 s LCD CONTROLLER SOLEMUS bits pixel 711 Samsung KS0711 2 741 Samsung KS0741 1352 Epson SED1352 S1D13502 1354 Epson SED1354 S1D13504 1356 Epson SED1356 S1D13506 1374 Epson SED1374 S1D13704 1 2 4 8 16 LCD15XX 1375 Epson SED1375 S1D13705 1376 Epson SED1376 S1D13706 1386 Epson SED1386 S1D13806 1300 Epson S1D13A03 S1D13A04 LCD159A 0x159A Epson SED159A 8 LCD15E05 0x15E05 Epson S1D15E05 2 713 Samsung KS0713 1560 Epson SED1560 1565 Epson SED1565 1566 Epson SED1566 Den ES 1567 Epson SED1567 1 1568 Epson SED1568 1569 Epson SED1569 1575 Epson SED1575 66420 Hitachi HD66420 LCD6642X 66421 Hitachi HD66421 2 LCDMem 0 No controller writes into RAM 2 monochrome displays LCDMemC 0 No controller writes into RAM 3 6 color displays LCDPageibpp 8811 Philips PCF8810 PCF8811 1 1330 Epson SED1330 LCDSLin 1335
52. handle the job of magnifying the display LCD XMAG Description Specifies the horizontal magnification factor of the LCD Type Numerical value default is 1 Additionnal information A factor of 1 results in no magnification LCD YMAG Description Specifies the vertical magnification factor of the LCD Type Numerical value default is 1 Additionnal information A factor of 1 results in no magnification User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 289 20 7 Simple bus interface configuration There are basically 2 types of bus interface for LCD controllers full and simple bus interfaces Most LCD controllers for smaller displays usually up to 240 128 or 320 240 use a simple bus interface to connect to the CPU With a simple bus only one address bit usually 0 is connected to the LCD controller Some of these controllers are very slow so that the hardware designer may decide to connect it to input output I O pins instead of the address bus Block diagram for LCD controllers with simple bus interface LCD Video Controller memory Control signals Segment Driver Common Driver Eight data bits one address bit and 2 or 3 control lines are used to connect the CPU and one LCD controller Four macros inform the LCD driver how to access each con troller used If the LCD controller s is connected directly to the address bus of the CPU configuration
53. on constantly on N LCD WRITE A0 0x2F Power control set booster regulator and follower off N LCD WRITE A0 0x40 Display Start Line 0 0 0 Display Page Address 0 LCD WRITE 0 0 10 Display Column Address MSB LCD WRITE 0 0 00 Display Column Address LSB N LCD WRITE 0 0 Display on off on EX LCD WRITE A0 0xe3 NOP Aj User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 286 CHAPTER 20 Low Level Configuration 20 4 Display orientation LCD MIRROR X Description Inverts the X direction horizontal of the display Type Binary switch 0 inactive X not mirrored default 1 active X mirrored Additionnal information If activated X gt LCD 5 7 1 This macro in combination with LCD MIRROR Y and LCD SWAP Xv be used to sup port any orientation of the display Before changing this configuration switch make sure that LCD SWAP XY is set as required by your application LCD MIRROR Y Description Inverts the Y direction vertical of the display Type Binary switch 0 inactive Y not mirrored default 1 active Y mirrored Additionnal information If activated Y gt LCD YSIZE 1 Y This macro in combination with LCD MIRROR X and LCD SWAP Xv can be used to sup port any orientation of the display Before changing this configuration switch make sure that LCD SWAP XY is
54. reference manual for uC GUI 2002 Micrium Technologies Corporation 216 CHAPTER 13 Window Objects Widgets main kc Ck k k K k k k kk k k lt k KKK K k K x k K k x lt k x K k lt k lt x k lt k x x k lt k K K k lt lt K x k lt x k lt KKK lt x k ko lt ko ko lt lt lt void main void GUI Init DemoProgBar Screen shot of above example Progress bar Tank 13 9 RADIO Radio button widget Radio buttons like check boxes are used for selecting choices A dot appears when a radio button is turned on or selected The difference from TE check boxes is that the user can only select one radio button at a time When a button is selected the other buttons in the widget are turned off e as shown to the right One radio button widget may contain any number of NE buttons which are always arranged vertically E All RADIO related routines are located in the file s RADIO c RADIO h All identifiers are prefixed RADIO Configuration options Type Macro Default Explanation RADIO_BKCOLORO_DEFAUL 0 0 0 0 Background color of button inactive state RADIO BKCOLORI1 DEFAULT GUI WHITE Background color of button active state The table below lists the available uC GUI RADIO related routines in alphabetical order Detailed descriptions of the routines follow Routine Explanation RADIO Create
55. to one line Items are numbered top to bottom or left to right beginning with a value of 0 SCROLLBAR GetValue Description Return the value of the current item User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 222 CHAPTER 13 Window Objects Widgets Prototype int SCROLLBAR GetValue SCROLLBAR Handle hObj Parameter Meaning hObj Handle of scroll bar Return value The value of the current item SCROLLBAR Inc Description Increments the current value of the scroll bar by a value of 1 Prototype void SCROLLBAR Inc SCROLLBAR Handle hObj Parameter Meaning hObj Handle of scroll bar Additional information The definition of an item is application specific although in most cases it is equal to one line Items are numbered top to bottom or left to right beginning with a value of 0 SCROLLBAR SetNumltems Description Sets the number of items for scrolling Prototype void SCROLLBAR SetNumItems SCROLLBAR Handle hObj int NumItems Parameter Meaning hObj Handle of scroll bar NumItems Number of items to be set Additional information The definition of an item is application specific although in most cases it is equal to one line The number of items specified is the maximum value the scroll bar cannot go beyond this value SCROLLBAR_SetPageSize Description Sets the page size User s amp referenc
56. 0Oxff0000 255 cs 0 1011 GUI DrawVLine x yO 5 yStep yO 6 yStep 1 Gray GUI SetColor U32 cs 0 101011 GUI DrawVLine x yO 6 yStep yO 7 yStep 1 Yellow GUI SetColor cs 0x101 GUI DrawVLine x yO 7 yStep yO 8 yStep 1 GUI SetColor Oxffff 255 cs 0 100001 GUI DrawVLine x yO 8 yStep yO 9 yStep 1 Cyan GUI SetColor cs 0x10100 1 GUI DrawVLine x yO 9 yStep yO 10 yStep 1 GUI SetColor Oxffff00 255 cs Ox1L GUI DrawVLine x yO 10 yStep yO 11 yStep 1 Magenta GUI SetColor cs 0x10001 GUI DrawVLine x yO 11 yStep yO 12 yStep 1 GUI SetColor OxffO00ff 255 cs 0 1001 GUI DrawVLine x yO 12 yStep yO 13 yStep 1 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 108 CHAPTER 9 Colors RK KK IK kk RR K OK K K K K K K K K KOK KOK kc k kk k ck kk k ck KOK ck k ck KOK K kk main Dk k ck CC k k k k ck k k k K ck ck ck ck k K ck Ck ck k k x x lt k k k k Ck ck k k k k amp k k k k amp k k k k k amp k k k k Sk k ko k void main void GUI_Init ShowColorBar while 1 GUI Delay 100 9 3 Fixed palette modes The following table lists the available fixed palette color modes and the necessary defines which need to be made in the file LcDConf h Detailed descriptions follow
57. 1 first segment line used define LCD LASTSEG 87 Contr 1 last segment line used define LCD FIRSTCOM1 0 Contr 1 first com line used define LCD LASTCOMI1 63 Contr 1 last com line used define LCD XORG1 88 Contr 1 leftmost lowest x Pos define LCD YORG1 0 Contr 1 topmost lowest y Pos 20 10 COM SEG lookup tables When using chip on glass technology it is sometimes very difficult to ensure that the COM and SEG outputs of the controller s are connected to the display in a linear fashion In this case a COM SEG lookup table may be required in order to inform the driver as to how the COM SEG lines are connected LCD LUT COM Description Defines a COM lookup table for the controller Type Alias Example Let us assume your display contains only 10 COM lines and their connecting order is 0 1 2 6 5 4 3 7 8 9 To configure the LCD driver so that the COM lines are accessed in the correct order the following macro should be added to your LCD Conf h fdefine LCD LUT COM 0 1 2 6 5 4 3 7 8 9 If you need to modify the segment order you should use the macro LCD LUT SEG in the same manner User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 301 LCD LUT SEG Description Defines a SEG lookup table for the controller Type Alias 20 11 Miscellaneous LCD NUM CONTROLLERS Description Defines the number of LCD cont
58. 164 CHAPTER 12 The Window Manager WM Prototype WM CALLBACK WM SetCallback WM HWIN hWin WM CALLBACK cb Parameter Meaning hWin Window handle cb Pointer to callback routine Return value Pointer to the previous callback routine WM SetCreateFlags Description Sets the flags to be used as default when creating a new window Prototype U8 WM SetCreateFlags U8 Flags Parameter Meaning Flags Window create flags see WM CreateWindow Return value Former value of this parameter Additionnal information The flags specified here are binary ored with the flags specified in the WM CreateWindow and WM CreateWindowAsChild routines The flag is frequently used to enable memory devices on all windows Example WM SetCreateFlags WM MEMDEV Auto use memory devices on all windows WM SetHasTrans Description Sets the has transparency flag sets it to 1 Prototype void WM SetHasTrans WM HWIN hWin Parameter Meaning HWin Window handle Additionnal information When set this flag tells the window manager that a window contains sections which are not redrawn and will therefore be transparent The WM then knows that the back ground needs to be redrawn prior to redrawing the window in order to make sure the transparent sections are restored correctly User s amp reference manual for uC GUI 2002 Mi
59. A K k K k K K SK SK A A SK K AA A K A KOK kk kk I ke K KOK K KOK KK uC GUI Multitask inteface for Win32 kk ck Ck ck k k k ck kk k k ck lt K k x k k k ck KKK KKK KKK KKK KKK k k k KKK ck kk x kk kk k kk k k k k k k k k k k kc k k KKK The folling section consisting of 4 routines is used to make pC GUI thread safe with WIN32 static HANDLE hMutex void GUI X InitOS void hMutex CreateMutex NULL 0 pC GUISim Mutex unsigned int GUI X GetTaskId void return GetCurrentThreadId void GUI X Lock void WaitForSingleObject hMutex INFINITE void GUI X Unlock void ReleaseMutex hMutex User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 145 Chapter 12 The Window Manager WM When using the uC GUI window manager WM everything which appears on the dis play is contained in a window an area on the screen which acts as a user interface element for drawing or viewing objects A window can be any size and you can dis play multiple windows on the screen at once even partially or entirely in front of other windows The window manager supplies a set of routines which allow you to easily create move resize and otherwise manipulate any number of windows It also provides lower level support by managing the layering of windows on the display and by alert ing your application to display changes that affect its windows The pC GUI window manager
60. All coordinates passed to an API function are always specified in pixels 1 6 How to connect the LCD to the microcontroller HC GUI handles all access to the LCD Virtually any LCD controller can be supported independently of how it is accessed For details please refer to Chapter 20 Low Level Configuration Also please get in contact with us if your LCD controller is not supported We are currently writing drivers for all LCD controllers available on the market and may already have a proven driver for the LCD controller that you intend to use It is usually very simple to write the routines or macros used to access the LCD in your application MIcrium offers the customization serviceu if necessary with your target hardware It does not really matter how the LCD is connected to the system as long as it is somehow accessible by software which may be accomplished in a variety of ways Most of these interfaces are supported by a driver which is supplied in source code form This driver does not normally require modifications but is configured for your hardware by making changes in the file LcDConf h Details about how to customize User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 16 CHAPTER 1 Introduction to uC GUI driver to your hardware as necessary are explained in Chapter 22 LCD Drivers The most common ways to access the LCD are described as follows If you simply want to understand how to use
61. Deutsch Deutsch Francais All LISTBOX related routines are in the file s LISTBOX c LISTBOX h All identifiers are prefixed LISTBOX User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 202 CHAPTER 13 Window Objects Widgets Configuration options Type Macro Default Explanation N LISTBOX DEFAUL GUI WHITE Background color unselected state N LISTBOX BKCOLOR1 DEFAULT GUI GRAY pee color selected state without N LISTBOX_BKCOLOR2_DEFAUL GUI WHITE A color selected state with S LISTBOX FONT DEFAULT amp GUI Fonti13 1 Font used N LISTBOX TEXTCOLORO DEFAULT GUI BLACK Text color unselected state N LISTBOX TEXTCOLOR1 DEFAULT GUI BLACK Text color selected state without focus N LISTBOX TEXTCOLOR2 DEFAULT GUI BLACK Text color selected state with focus B h S ESO NUS TEES 1 Enable 3D support The table below lists the available uC GUI LISTBOX related routines in alphabetical order Detailed descriptions of the routines follow Routine Explanation LISTBOX Create Create the list box LISTBOX CreateAsChild Create the list box as a child window LISTBOX CreateIndirect Create the list box from resource table entry LISTBOX DecSel Decrement selection LISTBOX GetDefaultFont Return the default font for LISTBOX widgets
62. DispSFloatMin Description Displays a floating point value with sign with a minimum number of decimals to the right of the decimal point at the current text position in the current window using the current font Prototype void GUI DispSFloatMin float f char Fract Parameter Meaning Value to display Minimum 1 2 E 38 maximum 3 4 E38 Minimum no of digits to display V Additionnal information Leading zeros are suppressed A sign is always shown in front of the value The length need not be specified the minimum length will automatically be used If values have to be aligned but differ in the number of digits this function is not a good choice Try one of the functions that specify the number of digits 5 4 Displaying binary values GUI DispBin Description Displays a value in binary form at the current text position in the current window using the current font Prototype void GUI DispBin U32 v U8 Len Parameter Meaning V Value to display 32 bit Len No of digits to display including leading zeros Additionnal information As with decimal and hexadecimal values the least significant bit is rightmost Example Show binary value 7 result 000111 ZZ U32 Input 0 7 GUI DispBin Input 6 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 60 CHAPTER 5 Displaying Values Related topics GUI DispBinAt
63. DispStringHCenterAt Click on button 160 0 Create the button Button BUTTON Create 110 20 100 40 GUI ID OK WM CF SHOW Set the button text UTTON SetText hButton Click me ey GUI WaitKey Delete button object UTTON Delete hButton KK IK IK IK kk K K K K K K KOK K KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK k ck k ck k ck KOK KOK KOK KOK ke sk ke kk x main k k ck ck k ck ck ck ck ck k Ck Ck k Ck K k x CK k K K k x CK k x K k x x CK x K k x x k K K k x S x lt KKK KKK k lt lt x x lt void main void GUI_Init DemoButton Screen shot of above example Click on button Click me Advanced use of the BUTTON widget The following example illustrates how to create a button which displays a picture of a telephone When pressed the picture changes to show the reciever lifted The exam ple is also available in the samples as WIDGET PhoneButton c KK IK IK kk kk kk K K K K K K K K K K K K K K K K K K K K KOK KOK K K SK A A A A A KOK K K KOK kk KOK ke ko KOK e ke e Micrium Inc Empowering embedded systems pC GUI sample code FF ox KKK k k k k KKK k k k KKK K k lt KKK k k lt KKK KKK KKK KKK KK lt k K KKK KKK kk ck lt k k x lt lt X k KKK ko ko ko File WIDGET_PhoneButton c Purpose Example demonstrating the use of a BU
64. FLAG AA2 GUI FONTINFO FLAG AAA Example Gets the info of GUI Font6x8 After the calculation FontInfo Flags contains the flag GUI FONTINFO FLAG GUI FONTINFO FontInfo GUI GetFontInfo amp GUI Font6x8 amp FontInfo GUI GetFontSizeY Description Returns the height in pixels Y size of the currently selected font Prototype int GUI GetFontSizeY void Additionnal information The returned value is the ySize value of the entry for the currently selected font This value is less than or equal to the Y spacing returned by the function GUI GetFontDistY The returned value is valid for both proportional and monospaced fonts GUI GetStringDistX Description Returns the X size used to display a specified string in the currently selected font Prototype int GUI GetStringDistX const char GUI FAR s Parameter Meaning s Pointer to the string User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 88 CHAPTER 7 Fonts GUI GetYDistOfFont Description Returns the Y spacing of a particular font Prototype int GUI_GetYDistOfFont const GUI FONT pFont Parameter Meaning pEornt Pointer to the font Additionnal information see GUI GetFontDistY GUI GetYSizeOfFont Description Returns the Y size of a particular font Prototype int GUI_GetYSizeOfFont const GUI FONT pFont Parameter Meaning pFont Pointer to the fon
65. Font10 1 cr emu MEPS 23455788 gt ABCDOEFGHIJKLMMOPORSTUY ol EL EN AS eee Ree ET Pur AAA RA PRAGAS Basses nao mur ROM Size Used files 2456 bytes size of GUI Font10 ASCII F10 1 c F10 ASCII c GUI Font10S ASCII Crom 14 Ba HE B4 Bz I EEX amp R 0d23456 T8322 T G ABCDEF GHIUKLMIMOPOGRSTUN abede Fghijklmnopqrztuvw xul ROM Size Used files 1760 bytes F10 ASCII c GUI Font10S 1 cm 1 BE 04 Bz User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation 352 CHAPTER 25 Standard Fonts PRERNR 0123456783502 FIG ABCDEF GHIJKLMMOPGRST US W YZ abede FghijkImnoparztuvwxyeilr Etf Oea ata ee AAA AA AECE E EITIBROO As mL ROM Size 1770 bytes size of GUI Font10S ASCII Used time s F10S 1 c F10 ASCII c GUI Font13 Cr iem e oo l atto SRL 0123456789 lt ABCDEFGHITJELMMOPOQRS Tuvwxvz 1 abcdefghijklmnoparskuvwx yz be ROM Size 2076 bytes Used F13_ASCII c GUI Font13 1 cr emu ca co Meee I 0123456789 gt im ABCDEFGHIJELMMOPOQRS TuvwxYz 1 abedefahigklmnaparstuvwxyzi ro ities 5 a P D 10818 156 S8LA AA AA A ECEEEETITIBN OO OO xii IU amp ROM Size 2149 bytes size of GUI Font
66. GUI AA FillPolygon 212 GUI AA GetFactor 209 GUI AA SetFactor 210 GUI ALLOC SIZE 264 GUI AUTODEV 123 GUI AUTODEV INFO 124 GUI BITMAP 87 GUI Clear 43 GUI ClearRect 70 GUI Color2Index 109 GUI DEBUG LEVEL 264 GUI DEFAULT BKCOLOR 264 GUI DEFAULT COLOR 264 GUI DEFAULT FONT 264 GUI Delay 244 GUI DispBin 54 GUI DispBinAt 55 GUI DispCEOL 43 GUI DispChar 34 GUI DispCharAt 35 GUI DispChars 35 GUI DispDec 46 GUI DispDecAt 47 GUI DispDecMin 48 GUI DispDecShitt 48 GUI DispDecSpace 49 GUI DispFloat 50 GUI DispFloatFix 52 GUI DispFloatMin 52 GUI DispHex 55 GUI DispHexAt 56 GUI DispSDec 49 GUI DispSDecShift 50 GUI DispSFloatFix 53 GUI DispSFloatMin 53 GUI DispString 36 GUI DispString UC 223 GUI DispStringAt 36 GUI DispStringAtCEOL 37 GUI DispStringInRect 37 GUI DispStringLen 38 GUI DrawArc 84 GUI DrawBitmap 72 GUI DrawBitmapExp 73 GUI DrawBitmapMag 73 GUI DrawCircle 81 User s amp reference manual for uC GUI 379 GUI DrawEllipse 83 GUI DrawHLine 74 GUI DrawLine 75 GUI DrawLineRel 75 GUI DrawLineTo 75 GUI DRAWMODE XOR 69 GUI DrawPixel 70 GUI DrawPoint 71 GUI DrawPolygon 76 GUI DrawPolyLine 76 GUI DrawStreamedBitmap 74 GUI DrawVLine 76 GUI EnlargePolygon 77 GUI FillCircle 82 GUI FillEllipse 83 GUI FillPolygon 78 GUI FillRect 71 GUI Font10 1 302 GUI Font10 ASCII 302 GUI Font10S 1 303 GUI Font10S ASCII 303 GUI Font13 1 304 GUL Font13 ASCII 304 GUI Font13H 1 305 GUI Fo
67. GUI MEMDEV CopyFromLCD 116 GUI MEMDEV CopyToLCD 115 GUI MEMDEV CopyToLCDAA 116 GUI MEMDEV Create 115 GUI MEMDEV CreateAuto 123 GUI MEMDEV Delete 115 GUI MEMDEV DeleteAuto 123 GUI MEMDEV Draw 120 GUI MEMDEV DrawAuto 123 GUI MEMDEV GetYSize 117 GUI MEMDEV ReduceYSize 117 GUI MEMDEV Select 115 GUI MEMDEV SetOrg 117 GUI 183 202 GUI OS 230 GUI RotatePolygon 79 GUI SetBkColor 108 User s amp reference manual for uC GUI GUI SetBkColorIndex 108 GUI SetColor 108 GUI SetColorlndex 108 GUI SetDrawMode 69 GUI SetFont 58 GUI SetL Border 41 GUI SetTextAlign 41 GUI SetTextMode 40 GUI SUPPORT MEMDEV 264 GUI SUPPORT TOUCH 264 GUI SUPPORT UNICODE 264 GUI TEXTMODE NORMAL 40 41 GUI TEXTMODE REVERSE 40 41 GUI TEXTMODE TRANSPARENT 40 41 GUI TEXTMODE XOR 40 41 GUI TOUCH AD BOTTOM 237 GUI TOUCH AD LEFT 237 GUI TOUCH AD RIGHT 237 GUI TOUCH AD TOP 237 GUI TOUCH Calibrate 238 GUI TOUCH Exec 239 GUI TOUCH GetState 239 GUI TOUCH Init 239 GUI TOUCH MIRROR X 237 GUI TOUCH MIRROR Y 237 GUI TOUCH SetDefaultCalibration 240 GUI TOUCH SWAP XY 237 GUI UC ENDCHAR 223 GUI UC STARTCHAR 223 GUI WINSUPPORT 264 GUI X Delay 266 GUI X GetKey 266 GUI X GetTaskID 231 268 GUI X GetTime 266 GUI X Init 266 GUI X Lock 231 268 GUI X Log 267 GUI X StoreKey 267 GUI X Unlock 232 267 GUI X WaitKey 266 GUIConf h 57 113 230 263 264 H Handle of a window 130 Hardkey simulation 23 24 H
68. HC GUI during the initialization phase GUI Init gt LCD gt LCD InitLUT gt LCD 10 SetLUTEntry However it might be desirable for var ious reasons to modify the LUT at run time Some possible reasons include e Color corrections in order to compensate for display problems non linearities or gamma correction e Inversion of the display e The need to use more colors at different times than the hardware can show at one time If you are simply modifying the LUT at run time the color conversion routines will not be aware of this and will therefore still assume that the LUT is initialized as it was originally User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Using different colors The default contents of the color table are defined at compile time in the configura tion file GUIConf h 1 113 LCD PHYS COLORS In order to minimize RAM consumption this data is normally declared const and is therefore stored in ROM In order to be able to modify it it needs to figuration GUI SetLUTColor becomes available and can be used to modify the contents of the color table and the LUT at the same time A call to LCD InitLUT Will restore the original default settings 9 6 Color API The following table lists the available color related functions in alphabetical order within their respective categories Detailed description of the routines can be found
69. Len int xsize Parameter Meaning pstring Pointer to the string to be edited Len Maximum number of characters xsize Pixel size in X of the edit field Additionnal information The routine returns after pressing ENTER or lt ESC gt The contents of the given text will be modified only if ENTER is pressed Example The following example demonstrates the use of the EDIT widget It is available as WIDGET Edit c in the samples shipped with un C GUI RK IK HK k k k k kk KC KC kk CK KC K k K K SK YK KK KK RA KK CK SK K Ck Ck kk ke K KOK KOK KOK ke ke ke Micrium Inc Empowering embedded systems pC GUI sample code k k x k k k k k k ck k k x K ck ck Ck K k k ck kk ck k k Ck ck ck k KKK KKK k k k KKK k k k k k k k k k k k k k k k k k k k KKK KK File WIDGET Edit c Purpose Example demonstrating the use of a EDIT widget 4 include gui H include edit h RK IK HK k k k kk KA A CK KK IR A IR A CK Ck Ck ke ke ke Edit a string until ESC or ENTER is pressed KKK k k ck K KKK k K lt KKK k K K K K K k k k lt KKK K lt lt K K k k k K KKK k x KKK kk K kk kk K k kc KKK ko x KKK static int Edit void int Key EDIT Handle hEdit char aBuffer 28 GUI SetFont amp GUI Font8x160 GUI DispStringHCenterAt Use keyboa
70. Lower right Y position Additional Information Uses the current drawing mode which normally means all pixels inside the rectangle are set Related topics GUI_InvertRect GUI_ClearRect User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 68 CHAPTER 6 2 D Graphic Library GUI InvertRect Description Draws an inverted rectangular area at a specified position in the current window Prototype void GUI InvertRect int x0 int yO int xl int yl Parameter Meaning x0 Upper left X position 0 Upper left Y position x1 Lower right X position yl Lower right Y position Related topics GUI FillRect GUI ClearRect 6 4 Drawing bitmaps GUI DrawBitmap Description Draws a bitmap image at a specified position in the current window Prototype void GUI DrawBitmap const GUI BITMAP pBM int x int y Parameter Meaning pBM Pointer to the BITMAP to display x X position of the upper left corner of the bitmap in the display y Y position of the upper left corner of the bitmap in the display Additional Information The bitmap data must be defined pixel by pixel Every pixel is equivalent to one bit The most significant bit MSB defines the first pixel the picture data is interpreted as bitstream starting with the MSB of the first byte A new line always starts at an even byte address as the nth line of the bitmap starts at offset n BytesPe
71. Micrium Technologies Corporation 125 Additional Information The device data is handled as antialiased data A matrix of 2x2 pixels is converted to 1 pixel The intensity of the resulting pixel depends on how many pixels are set in the matrix Example Creates a memory device and selects it for output A large font is then set and a text is written to the memory device GUI MEMDEV Handle hMem GUI MEMDEV Create 0 0 60 32 GUI MEMDEV Select hMem GUI SetFont amp GUI Font32B ASCII GUI DispString Text GUI MEMDEV COopyToLCDAA hMem Screen shot for preceeding example GUI MEMDEV GetYSize Description Returns the Y size of a memory device Prototype int GUI MEMDEV GetYSize GUI MEMDEV Handle hMem Parameter Meaning hMem Handle to memory device GUI MEMDEV ReduceYSize Description Reduces the Y size of a memory device Prototype void GUI MEMDEV ReduceYSize GUI MEMDEV Handle hMem int YSize Parameter Meaning hMem Handle to memory device YSize New Y size of the memory device Additional Information Changing the size of the memory device is more efficient than deleting and then rec reating it GUI MEMDEV SetOrg Description Changes the origin of the memory device on the LCD User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 126 CHAPTER 1
72. SetTextColor 166 Ellipses drawing 83 84 Evaluation board 11 F FAQs 327 FEDIT see Font editor Fixed color palettes 91 Fixed palette modes 102 105 Flickering of display 111 147 Floating point calculations 67 Floating point values displaying 50 54 Font converter 11 57 66 207 219 Font editor 65 Font files linking 57 65 naming convention 300 Fonts 11 57 66 299 326 adding 65 antialiased 57 205 207 available 57 creating additional 57 default 57 defining 11 file naming convention 300 301 included with uC GUI 11 57 monospaced 57 299 318 326 naming convention 299 300 proportional 57 299 301 317 scaling 11 selecting 57 58 59 usage of 57 Foreground window 130 Frame window widget 168 174 FRAMEWIN Create 168 FRAMEWIN Delete 169 FRAMEWIN DisableMemdev 169 FRAMEWIN EnableMemdev 169 FRAMEWIN Invalidate 170 FRAMEWIN Paint 170 FRAMEWIN SetBarColor 170 FRAMEWIN SetFont 171 FRAMEWIN SetText 172 FRAMEWIN SetTextAlign 171 FRAMEWIN SetTextColor 172 FRAMEWIN SetTextPos 171 Full bus interface configuration 246 251 254 Full color mode of bitmaps 88 91 Function replacement macro 14 Function level linking 17 G Graphic library 9 11 67 86 243 2002 Micrium Technologies Corporation Grayscales 9 91 99 GUI configuration 264 265 GUI subdirectories 16 20 GUI AA DisableHiRes 209 GUI AA DrawArc 210 GUI AA DrawLine 211 GUI AA DrawPolyOutline 211 GUI AA EnableHiRes 209 GUI AA FillCircle 212
73. Simulator modified addition of use of simulator with trial version of uC GUI Section 1 7 Data types revised 3 24R3 020802 KG Additional macros added to sections 22 8 LCDMem and 22 9 LCDMemC same macros added to Chapter 20 Low Level Configuration 3 24R2 020801 KG Section 2 3 Creating a library revised table and diagram added 3 24R1 020730 KG Minor changes throughout including addition of brackets to all API functions 3 24 0 020726 KG Chapter 9 Colors revised modes 1 2 and 444 added Chapter 11 Execution Model Single Task Multitask added Chapter 1 Introduction to uC GUI revised Chapter 2 Getting Started revised Chapter 18 Time Related Functions changed to Timing and Execution Related Functions GUI Exec and GUI added Small formatting changes throughout 3 22R1 020723 020719 KG RS Chapter 18 uC GUI in Multitasking Environments merged with Chapter 22 High Level Configuration Chapter 4 Tutorial merged with Chapter 2 Getting Started Chapter 10 Colors revised color mode table added GUI X explanations added Widget description enhanced screen shots added 3 22 0 020716 KG Chapter 13 Window Objects revised SCROLLBAR SLIDER RADIO and TEXT widgets added 3 20 0 020627 020620 020618 2 KG KG Chapter 2 Getting Started revised Chapter 14 Dialogs revised
74. TOUCH Exec to return the measurement values from the A D converter for the X and the Y axes Prototypes int TOUCH X MeasureX void int TOUCH X MeasureY void Configuring the touch screen moduleu There needs to exist a separate configuration file in your config folder named GUITouchConf h The following table shows all available con ig macros for the ana log touch screen driver included with un C GUI Type Macro Default Explanation B GUI TOUCH SWAP XY 0 Set to 1 to swap the X and the Y axes B GUI TOUCH MIRROR X 0 Mirrors the X axis B GUI TOUCH MIRROR Y 0 Mirrors the Y axis N GUI TOUCH AD LEFT 30 Minimum value returned by the A D converter N GUI TOUCH AD RIGHT 220 Maximum value returned by the A D converter N GUI TOUCH AD TOP 30 Minimum value returned by the A D converter User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 274 CHAPTER 18 Input Devices Type Macro Default Explanation N GUI TOUCH AD BOTTOM 220 Maximum value returned by the A D converter N pipe ET S TAE LCD XSIZE Horizontal area covered by touch screen N GUI TOUCH YSIZE LCD YSIZE Vertical area covered by touch screen 18 2 Keyboard input A keyboard input device uses ASCII character coding in order to be able to distin guish between characters For example there is only one A key on the keyboard but an uppercase A and
75. The following example shows how to draw a polygon It can be found under Sam ples Misc DrawPolygon c RK HK HK KK A RA IR A IR A A A SK SK A kk K Sk kk ke ko ke ke I Micrium Inc Empowering embedded systems i pC GUI sample code Dk ck ck ck K ck k k k k k k k k k k ck lt k k k k ck ck ck ck k k k k k k k ck ck K K k k k K K ck k k k k ck k k k k k k k k kk k k k k amp k k k File DrawPolygon c Purpose Example for drawing a polygon include gui h RK IK HK kk k kk KC K IK K K K K K k K OK TK K K K SK SK SK SK SK SK SK SK K SK KK K SK K K Kk SK K KOK K id The points of the arrow CK Ck CK k k KKK KKK KKK KKK KKK KKK KKK KKK KKK ckck lt K k lt lt x K k ck ck ck ck ck ck ck ck ck ck ck ck ck kk static const GUI POINT aPointArrow 0 D 40 35 10 25 10 85 10 85 10 25 40 35 BK IK HK kk k K K OK SK SK YK SK RA KK SK SK SK SK Kk kk kk K Draws a polygon KKK KKK KK KKK KKK KKK KKK KKK ckck lt k k ckokckck ck K x lt lt x K K k ck ck ck ck ck k ck ck ck ck K kc ck kk static void DrawPolygon void int Cnt 0 GUI SetBkColor GUI WHITE GUI Clear GUI SetFont amp GUI Font8x16 GUI SetColor 0x0 GUI DispStringAt Polygons of arbitrary shape 0 0 G G G UI DispStri
76. a specified rectangle in the current window using the current font Prototype void GUI DispStringInRect const char GUI FAR s const GUI RECT pRect int Align Parameter Meaning S String to display PRECE Rectangle to write to in pixels of the client window Alignment flags OR combinable A flag for horizontal and a flag for vertical alignment should be combined Available flags are GUI_TA_TOP GUI_TA_BOTTOM GUI_TA_VCENTER for vertical alignment GUI_TA_LEFT GUI_TA_RIGHT GUI_TA_HCENTER for horizontal alignment Align Example Shows the word Text centered horizontally and vertically in the current window GUI RECT rClient GUI GetClientRect amp rClient GUI DispStringInRect Text amp rClient GUI TA HCENTER GUI TA VCENTER Additionnal information If the specified rectangle is too small the text will be clipped Related topics GUI DispString GUI DispStringAtCEOL GUI DispStringLen GUI DispStringLen Description Displays the string passed as parameter with a specified number of characters at the current text position in the current window using the current font Prototype void GUI DispStringLen const char GUI FAR s int Len Parameter Meaning String to display Should be a VO terminated array of 8 bit character Passing NULL as parameter is permitted Len Number of characters to display S Additionnal
77. and will therefore always be linked Define the maximum number of tasks from which p C GUI is called to access the display when multitasking support is enabled see Chapter 11 Execution Model Single Task Multitask Activate to enable multitasking support with multiple B GUI OS 0 tasks calling uC GUI see Chapter 11 Execution Model Single Task Multitask Enables optional memory device support Not using memory devices will save about 40 bytes of N GUI MAXTASK 4 GUT SU CGEM RAM for function pointers and will slightly accelerate execution B GUI_SUPPORT_TOUCH 0 Enables optional touch screen support Enables support for Unicode characters embedded in 8 m bit strings Please note Unicode characters may p E B GUL SUPPORT NICO A always be displayed as character codes are always treated as 16 bit B GUI_WINSUPPORT 0 Enables optional window manager support How to configure the GUI We recommend the following procedure 1 Make a copy of the original configuration file 2 Review all configuration switches 3 Erase unused sections of the configuration Sample configuration The following is a short sample GUI configuration file Con igsampleNGUIConf h User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 305 J KCKCKCKCkCk Ck kk kk K K K K K K K K K K K K K KOK kk KOK KOK KOK KOK Configurati
78. bitmap contains the same shade of red User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 36 CHAPTER 3 Simulator SIM HARDKEY GetNum Description Returns the number of available hardkeys Prototype int SIM HARDKEY GetNum void Return value The number of available hardkeys found in the bitmap Additionnal information The numbering order for hardkeys is standard reading order left to right then top to bottom The topmost pixel of a hardkey is therefore found first regardless of its horizontal position In the bitmap below for example the hardkeys are labeled as they would be referenced by the KeyIndex parameter in other functions It is recommended to call this function in order to verify that a bitmap is properly loaded SIM HARDKEY GetState Description Returns the state of a specified hardkey Prototype int SIM HARDKEY GetState unsigned int KeyIndex Parameter Meaning KeyIndex Index of hardkey 0 index of first key Return value State of the specified hardkey 0 unpressed 1 pressed SIM HARDKEY SetCallback Description Sets a callback routine to be executed when the state of a specified hardkey changes Prototype SIM HARDKEY CB SIM HARDKEY SetCallback unsigned int KeyIndex User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 37 SIM HARDKEY CB pfCallback Parameter Me
79. bus interface as described in Chapter 20 Low Level Configuration The following table lists the macros which must be defined for hardware access Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller READ AO Read a byte from LCD controller with A line low READ A1 Read a byte from LCD controller with A line high LCD WRITE 0 Write a byte to LCD controller with A line low LCD WRITE A1 Write a byte to LCD controller with A line high Additional configuration switches None User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 332 CHAPTER 22 LCD Drivers Special requirements for certain LCD controllers None User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 333 Chapter 23 LCD Driver API HC GUI requires a driver for the hardware This chapter explains what an LCD driver for uC GUI does and what routines it supplies to HC GUI the application program interface or API Under most circumstances you probably do not need to read this chapter as most calls to the LCD layer of uC GUI will be done through the GUI layer In fact we rec ommend that you only call LCD functions if there is no GUI equivalent for example if you wish to modify the lookup table of the LCD controller directly The reason for this is that LCD driver functions are not thread safe unlike their GUI
80. drawing Hello world ay include GUI H KK IK IK kk I Kk K K K K K K K K KOK K KOK KOK KOK KOK KOK KOK ke main CK k k K k k ck ck ck K K K KKK KKK KK KKK k k KKK KKK KKK KKK KK KKK KKK KKK K ck ck ck ck ck ck ck k ck k ck ck ck ck kk kk void main void int i 0 ToDo Make sure hardware is initilized first GUI Init GUI DispString Hello world while 1 GUI DispDecAt i 20 20 4 if 15259999 i20 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 26 CHAPTER 2 Getting Started User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 27 Chapter 3 Simulator The PC simulation of uC GUI allows you to compile the same C source on your Win dows PC using a native typically Microsoft compiler and create an executable for your own application Doing so allows the following e Design of the user interface on your PC no need for hardware e Debugging of your user interface program e Creation of demos of your application which can be used to discuss the user interface The resulting executable can be easily sent via email Www micrium com User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 28 CHAPTER 3 Simulator 3 1 Understanding the simulator The pC GUI simulator uses Microsoft Visual C version 6 00 or higher and the integrated development environment IDE wh
81. for uC GUI 2002 Micrium Technologies Corporation 348 CHAPTER 25 25 1 Font identifier naming convention User s amp reference manual for uC GUI All standard fonts are named as follows The elements of the naming convention are then explained in the table GUI_Font lt style gt lt width gt x lt height gt x lt MagX gt x lt MagY gt H B _ lt characterset gt Element Meaning GUI_Font Standard prefix for all fonts shipped with pC GUI lt style gt Specifies a non standard font style Example Comic style in GUI FontComici18B ASCII width Width of characters contained only in monspaced fonts height Height of the font in pixels MagX Factor of magnification in X contained only in magnified fonts MagY Factor of magnification in Y contained only in magnified fonts H Abbreviation for high Only used if there is more than one font with the same height It means that the font appears higher than other fonts B Abbreviation for bold Used in bold fonts lt characterset gt Specifies the contents of characters ASCII Only ASCII characters 0 20 0 7 0x7F 1 ASCII characters and European extensions OxAO OxFF HK Hiragana and Katakana 1HK ASCII European extensions Hiragana and Katakana D Digit fonts character set 0123456789 Example 1 GUI_Font16_ASCII Element Meaning GUI_Font Standard font prefix 16 Heigth in pixels
82. from entering the same critical section using a resource semaphore mutex until GUI X Unlock has been called When using a real time operating system you normally have to increment a counting resource semaphore GUI X Unlock Description Unlocks the GUI Prototype void GUI X Unlock void Additionnal information This routine is called by the GUI after accessing the display or after using a critical internal data structure When using a real time operating system you normally have to decrement a count ing resource semaphore Examples Kernel interface routines for nC OS II The following example shows an adaption of the four routines for uC OS II excerpt from file GUI X uCOS II c include INCLUDES H static OS EVENT DispSem U32 GUI X GetTaskId void return U32 OSTCBCur gt OSTCBPrio void GUI X InitOS void DispSem OSSemCreate 1 void GUI_X_Unlock void OSSemPost DispSem void GUI_X_Lock void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 144 CHAPTER 11 Execution Model Single Task Multitask INT8U err OSSemPend DispSem 0 amp err Kernel interface routines for Win32 The following is an excerpt from the Win32 simulation for uwC GUI When using the HC GUI simulation there is no need to add these routines as they are already in the library Note cleanup code has been omitted for clarity BK HK IK IK
83. gt SEG SEG SEG SEG SEG 0 1 2 3 n ra e lt lt gt lt p D D D D D D COM 0 B 7 6 5 4 2 1 1 The picture above shows the relation between the display memory and the SEG and COM lines of the LCD Additional RAM requirements of the driver This LCD driver may be used with or without a display data cache containing a com plete copy of the contents of the LCD data RAM If a cache is not used there are no additional RAM requirements It is optional but recommended to use this driver with a data cache for faster LCD access The amount of memory used by the cache may be calculated as follows Size of RAM in bytes LCD XSIZE 7 8 LCD YSIZE 2 Additional driver functions None Hardware configuration This driver accesses the hardware with a simple bus interface as described in Chapter 20 Low Level Configuration The following table lists the macros which must be defined for hardware access Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller READ AO Read a byte from LCD controller with A line low READ A1 Read a byte from LCD controller with A line high LC
84. hObj Handle of edit field pFont Pointer to the font User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Description 189 EDIT SetHexMode Enables the hexadecimal edit mode of the edit field The given value can be modified in the given range Prototype void EDIT SetHexMode EDIT Handle hObj U32 Value U32 Min 032 Parameter Meaning hObj Handle of edit field Value Value to be modified Min Minimum value Max Maximum value EDIT SetMaxLen Description Sets the maximum number of characters to be edited by the given edit field Prototype void EDIT SetMaxLen EDIT Handle hObj int MaxLen Parameter Meaning hObj Handle of edit field MaxLen Number of characters EDIT SetText Description Sets the text to be displayed in the edit field Prototype void EDIT SetText EDIT Handle hObj const char s Parameter Meaning hObj Handle of edit field S Text to display Description EDIT SetTextAlign Sets the text alignment of the edit field Prototype void EDIT SetTextAlign EDIT Handle hObj int Align Parameter Meaning hObj Handle of edit field Align Text alignment to be set see GUI SetTextAlign User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 190 CHAPTER 13 Window Objects Widgets EDIT SetTextCol
85. have been modified and need to be written to the display This hitlist uses 1 bit per byte of video memory This is an optional feature which is not supported by all LCD drivers Example The code in the following example performs drawing operations on the display which overlap In order to accelerate the update of the display and to avoid flickering the cache is locked before and unlocked after these operations User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 340 LCD ControlCache LCD CC LOCK GU GU GU GU GU GU GU GU GU I FillCircle 30 30 20 I SetDrawMode GUI DRAWMODE I FillCircle 50 30 10 I SetTextMode GUI T EXTMODE_XOR CHAPTER 23 I_DispStringAt Hello world n 0 0 I_DrawHLine 16 5 25 I_DrawHLine 18 5 25 I_DispStringAt XOR I_DispStringAt XOR Text 0 20 Text 0 60 3 LCD_ControlCache LCD_CC_UNLOCK LCD_GetXSize LCD_GetYSize Description Returns the physical X or Y size respectively of the LCD in pixels Prototypes int LCD_GetXSize vo int LCD_GetYSize vo Return value Physical X Y size of the display LCD GetVXSize LCD GetVYSize Description Returns the virtual X or Y size respectively of the LCD in pixesl In most cases the virtual size is equal to the physical size Prototype int int Return value Virtual X Y size of the display LCD GetBitsPerPix
86. i eere ene e dO 200 14 5 Message EE Der LEX ERR ERR En 202 uz 205 15 1 18414 5019 de PEE 206 15 2 er RR 209 15 3 Control f hnctions x eee ee rene cep 209 15 4 Drawing f nctiolis e e a d 210 15 5 EXAM 214 ShiftJIS Suppor nu tou abeo LOL MAS tics aste Er 219 16 1 Displaying Shift JIS strings iie ener eere nae pr d n er ER kiere 219 16 2 Creating Shift JIS 2 eee cera ee nA AE E de akaqa aqa 219 16 3 cle M 219 MANSON testo PEE ES 223 17 1 Unicode and double byte 224 17 2 EXaIMPle aa PIDE 225 UC GUI in Multitask 229 18 1 Multiple tasks accessing the display 230 18 2 Configuration 4 0420 1 6 nene 230 18 3 Kernel interface routines m ME EO Qe us 231 18 4 eA ES 233 User s amp reference manual for uC GUI 2002 Mi
87. in the sections that follow be stored in RAM This can be achieved by activation of the con switch LCD LUT IN RAM If this is enabled the API function Routine Explanation Basic color functions GUI GetBkColor Return the current background color GUI GetBkColorIndex Return the index of the current background color GUI GetColor Return the current foreground color GUI GetColorIndex Return the index of the current foreground color GUI SetBkColor Set the current background color GUI SetBkColorIndex Setthe index of the current background color GUI SetColor Set the current foreground color GUI SetColorIndex Set the index of the current foreground color Index amp color conversion GUI Color2Index Convert color into color index GUI Index2Color Convert color index into color Lookup table LUT group GUI IndthUTq Initialize the LUT hardware GUI SetLUTColor Set color of a color index both hardware and color table GUI SetLUTEntry Write a value into the LUT hardware 9 7 Basic color functions GUI GetBkColor Description Returns the current background color Prototype GUI COLOR GUI GetBkColor void Return value The current background color User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 114 CHAPTER 9 Colors GUI GetBkColorlndex Description Returns the index of
88. information The values are logical sizes X direction specifies the direction which is used as the X direction by all routines of the LCD driver Usually the X size equals the number of segments 20 3 Initializing the controller LCD INIT CONTROLLER Description Initializes the LCD controller s Type Function replacement Additionnal information This macro must be user defined to initialize some controllers It is executed during the LCD 10 Init and LCD 10 Reinit routines of the driver Please consult the data sheet of your controller for information on how to initialize your hardware Example The sample below has been written for and tested with an Epson SED1565 controller using an internal power regulator define LCD INIT CONTROLLER V LCD WRITE A0 0xe2 Internal reset X LCD WRITE 0 0 Display on off off LCD WRITE 0 0 Power save start static indicator off N LCD WRITE A0 0xa2 LCD bias select 1 9 X LCD WRITE 0 0 0 ADC select normal NN LCD WRITE 0 0 0 Common output mode normal LCD WRITE A0 0x27 V5 voltage regulator medium mu LCD WRITE A0 0x81 Enter electronic volume mode NUS UN LCD WRITE A0 0x13 Electronic volume medium NUN LCD WRITE A0 0xad Power save end static indicator on NUN LCD WRITE A0 0x03 static indicator register set
89. into LCDConf h define LCD SWAP RB LCD INIT CONTROLLER 1 Has to be set When writing or modifying the initialization macro consider the following To initialize the embedded SDRAM bit 7 of register 20 SDRAM initialization bit must be set to 1 a minimum of 200 us after reset When the SDRAM initialization bit is set the actual initialization sequence occurs at the first SDRAM refresh cycle The initialization sequence requires approxi mately 16 MCLKs to complete and memory accesses cannot be made while the initialization is in progress For more information please see the LCD controller documentation User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 316 CHAPTER 22 LCD Drivers LCD READ REG LCD WRITE REG In order for the BitBLT engine to work the data type of the offset must be unsigned long This is set with the configuration macros LCD READ REG and LCD WRITE REG as follows define LCD READ REG Off volatile U16 0x800000 U32 Off lt lt 1 define LCD WRITE REG Off Data volatile U16 0x800000 U32 Off lt lt 1 Data 22 4 LCD159A Supported hardware Controllers This driver has been tested with the following LCD controllers e Epson SED159A It should be assumed that it will also work with any controller of similar organization Bits per pixel Supported color depth is 8 bpp Inte
90. is a seperate optional software item and is not included in the pC GUI basic package The software for the window manager is located in the subdirectory GUINWM User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 146 CHAPTER 12 The Window Manager WM 12 1 Explanation of terms Windows are rectangular in shape defined by their origin the X and Y coordinates of the upper left corner as well as their X and Y sizes width and height respec tively A window in uC GUI is rectangular has a Z position may be hidden or shown may have valid and or invalid areas may or may not have transparency may or may not have a callback routine Active window The window which is currently being used for drawing operations is referred to as the active window It is not necessarily the same as the topmost window Callback routines Callback routines are defined by the user program instructing the graphic system to call a specific function when a specific event occurs Normally they are used to auto matically redraw a window when its content has changed Child parent windows siblings A child window is one that is defined relative to another window called the parent Whenever a parent window moves its child or children move correspondingly A child window is always completely contained within its parent and will be clipped if neces sary Multiple child windows with the same parent are considered sib
91. is simple and usually consists of no more than one line per macro If the LCD controller s is connected to I O pins the bus interface must be simu lated which takes about 5 10 lines of program per macro or a function call to a rou tine which simulates the bus interface The following macros are used only for LCD controllers with simple bus interface LCD READ Description Reads a byte from LCD controller with AO C D line low User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 290 CHAPTER 20 Low Level Configuration Type Function replacement Prototype define LCD READ 0 Result Parameter Meaning R it Result read This is not a pointer but a placeholder for the variable in which the TEM value will be stored LCD READ A1 Description Reads a byte from LCD controller with AO C D line high Type Function replacement Prototype define LCD READ A1 Result Parameter Meaning Result read This is not a pointer but a placeholder for the variable in which the value will be stored Result LCD WRITE 0 Description Writes a byte to LCD controller with AO C D line low Type Function replacement Prototype define LCD WRITE 0 Byte Parameter Meaning Byte Byte to write LCD WRITE A1 Description Writes a byte to LCD controller with AO C D line high Type Function replacement Prototype def
92. is used as the nwin parameter and the widget is treated like any other window The WM functions most commonly used with widgets are listed as follows Routine Explanation WM DeleteWindow Delete a window WM DisableMemdev Disable usage of memory devices for redrawing WM EnableMemdev Enable usage of memory devices for redrawing WM InvalidateWindow Invalidate a window WM Paint Draw or redraw a window immediately For a complete list of WM related functions please refer to Chapter 12 The Window Manager User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 172 CHAPTER 13 Window Objects Widgets API reference routines common to all widgets The table below lists available widget related routines in alphabetical order These functions are common to all widgets and are listed here in order to avoid repetition Detailed descriptions of the routines follow The additional member functions avail able for each widget may be found in later sections Routine Explanation WIDGET CreateIndirect Used for automatic creation in dialog boxes WM_EnableWindow Set the widget state to enabled default WM_DisableWindow Set the widget state to disabled lt WIDGET gt _Createlndirect Description Creates a widget to be used in dialog boxes Prototype lt WIDGET gt _Handle lt WIDGET gt _CreateIndirect const GUI WIDGET CREATE INFO
93. order to become more familiar with what the software can do refer to Chapter 3 Simulator e Expand your program using the rest of the manual for reference User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 15 Typographic conventions for syntax This manual uses the following typographic conventions Style Used for Body Body text Keyword Text that you enter at the command prompt or that appears on the display i e sys tem functions file or pathnames Farometer Parameters in API functions Sample Sample code in program examples New Sample Sample code that has been added to an existing program example 1 5 Screen and coordinates X The screen consists of many dots that can 0 0 be controlled individually These dots are called pixels Most of the text and drawing functions that pC GUI offers in its API to the user program can write or draw on any specified pixel The horizontal scale is called the X axis whereas the vertical scale is called the Y axis Coordinates are denoted as a pair consisting of an X and a Y value X Y Y The X coordinate is always first in routines that require X and Y coordinates The upper left corner of the display or a window has per default the coordinates 0 0 Positive X values are always to the right positive Y values are always down The above graph illustrates the coordinate system and directions of the X and Y axes
94. ors that the LCD can actually show the physical colors and uses the one that the LCD metric considers closest User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 106 CHAPTER 9 9 1 Predefined colors In addition to self defined colors some standard colors are predefined in uC GUI as shown in the following table Colors Define Color Definition GUI BLACK Black 0x000000 GUI BLUE Blue OxFF0000 GUI GREEN Green OxOOFFOO GUI CYAN Cyan OxFFFFOO GUI_RED Red 0x0000FF GUI MAGENTA Magenta 0x8B008B GUI_BROWN Brown 2 2 5 GUI DARKGRAY Dark gray 0x404040 GUI GRAY Gray 0x808080 GUI LIGHTGRAY Light gray 0xD3D3D3 GUI LIGHTBLUE Light blue OxFF8080 GUI LIGHTGREEN Light green Ox80FF80 GUI LIGHTCYAN Light cyan Ox80FFFF GUI LIGHTRED Light red 0x8080FF GUI LIGHTMAGENTA Light magenta OxFF80FF GUI YELLOW Yellow OxOOFFFF GUI_WHITE White OxFFFFFF Example Set background color to magenta GUI SetBkColor GUI MAGENTA GUI Clear 9 2 The color bar test routine The color bar program below is used to show 13 color bars as follows User s amp reference manual for uC GUI Black gt Red White gt Red Black gt Green White gt Green Black Blue White gt Blue Black gt White Black gt Yellow White gt Yellow Black gt Cyan White gt Cyan Black Magenta and White Magenta This little routine may be used on all displays in any color fo
95. pCreateInfo WM HWIN hParent int x0 int 0 WM CALLBACK cb Parameter Meaning pCreateInfo Pointer to a GUI WIDGET CREATE INFO structure see below hParent Handle of parent window x0 Leftmost pixel of the widget in desktop coordinates 0 Topmost pixel of the widget in desktop coordinates cb Pointer to a callback funtion Additionnal information Any widget may be created indirectly by using the appropriate prefix For example BUTTON CreateIndirect to indirectly create a button widget CHECKBOX CreateIndirect to indirectly create a check box widget and so on A widget only needs to be created indirectly if it is to be included in a dialog box Otherwise it may be created directly by using the WIDGET Create functions Please see Chapter 14 Dialogs for more information about dialog boxes Resource table The GUI WIDGET CREATE INFO structure is defined in the dialog resource table as fol lows typedef struct GUI_WIDGET_CREATE_FUNC pfCreateIndirect Create function const char pName Text not used for all widgets I16 Id Window ID of the widget I16 x0 y0 xSize ySize Size and position of the widget I16 Flags Widget specific flags or 0 I32 Para Widget specific parameter or 0 GUI WIDGET CREATE INFO User s amp reference manual for uC GUI 2002 Micrium Technologi
96. pu C GUI you may skip this section LCD with memory mapped LCD controller The LCD controller is connected directly to the data bus of the system which means the controller can be accessed just like a RAM This is a very efficient way of access ing the LCD controller and is most recommended The LCD addresses are defined to the segment LCDSEG and in order to be able to access the LCD the linker locator simply needs to be told where to locate this segment The location must be identical to the access address in physical address space Drivers are available for this type of interface and for different LCD controllers LCD with LCD controller connected to port buffer For slower LCD controllers used on fast processors the use of port lines may be the only solution This method of accessing the LCD has the disadvantage of being some what slower than direct bus interface but particularly with a cache that minimizes the accesses to the LCD the LCD update is not slowed down significantly All that needs to be done is to define routines or macros which set or read the hardware ports buffers that the LCD is connected to This type of interface is also supported by different drivers for the different LCD controllers Proprietary solutions LCD without LCD controller The LCD can also be connected without an LCD controller In this case the LCD data is usually supplied directly by the controller via a 4 or 8 bit shift register These pro priet
97. s EDIT c EDIT h All identifiers are prefixed EDIT Configuration options Type Macro Default Explanation GUI_TA_RIGHT irs S DIT ALIGN DEFAULT GUI TA VCENTER Alignment for edit field text N EDIT BKCOLORO DEFAUL OxcOcOcO Background color disabled state N EDIT BKCOLOR1 DEFAULT GUI WHITE Background color enabled state N EDIT BORDER DEFAULT 1 Width of border in pixels s EDIT FONT DEFAULT amp GUI Fonti3 1 Font used for edit field text N EDIT TEXTCOLORO DEFAULT GUI BLACK Text color disabled state N EDIT TEXTCOLOR1 DEFAUL GUI BLACK Text color enabled state E Distance in X to offset text from left border d 2 of edit field Available alignment flags are GUI TA LEFT GUI TA RIGHT GUI HCENTER for horizontal alignment GUI TA TOP GUI TA BOTTOM GUI TA VCENTER for vertical alignment EDIT API The table below lists the available uC GUI EDIT related routines in alphabetical order Detailed descriptions of the routines follow Routine Explanation EDIT AddKey Key input routine EDIT Create Create the edit field EDIT CreateIndi rect Create the edit field from resource table entry EDIT_GetDefaultFont Returns the default font User s amp reference manual for uC GUI 2002 Micrium Technologies Corporat
98. set as required by your application LCD SWAP XY Description Swaps the horizontal and vertical directions orientation of the display Type Binary switch 0 inactive X Y not swapped default 1 active X Y swapped Additionnal information If set to 0 not swapped SEG lines refer to columns and COM lines refer to rows If activated X gt Y When changing this switch you will also have to swap the X Y settings for the resolu tion of the display using LCD xsrzEe and LCD YSIZE LCD VXSIZE LCD VYSIZE Description Define the horizontal and vertical resolution respectively of the virtual display User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 287 Type Numerical values Additionnal information The values are logical sizes X direction specifies the direction which is used as X direction by all routines of the LCD driver If a virtual display is not used these values should be the same as the values for LCD XSIZE LCD YSIZE these the default settings The virtual display feature requires hardware support and is not available with all drivers LCD XORG n LCD YORG n Description Define the horizontal and vertical origin of the display respectively controlled by the configured driver Type Numerical values Additionnal information In a single display system both macros are usually set to 0 the default value 20 5 Color config
99. starting position x1 X end position User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 71 Additional Information With most LCD controllers this routine is executed very quickly because multiple pix els can be set at once and no calculations are needed If it is clear that horizontal lines are to be drawn this routine executes faster than the GUI DrawLine routine GUI DrawLine Description Draws a line from a specified starting point to a specified endpoint in the current win dow Prototype void GUI DrawLine int x0 int y0 int xl int yl Parameter Meaning x0 X starting position 0 Y starting position 1 X end position yl Y end position Additional Information If part of the line is not visible because it is not in the current window or if part of the current window is not visible this part is not drawn due to clipping GUI DrawLineRel Description Draws a line from the current X Y position to an endpoint specified by X distance and Y distance in the current window Prototype void GUI DrawLineRel int dx int dy Parameter Meaning dx Distance in X direction to end of line to draw dy Distance in Y direction end of line to draw GUI DrawLineTo Description Draws a line from the current X Y position to an endpoint specified by X and Y coordinates in the current window Prototype void GUI DrawLineTo in
100. strings The routine used for string output in HC GUI is usually GUI DispString Since GUI DispString uses 8 bit characters you can not directly pass a Unicode string to it as Unicode strings use 16 bit characters There are two options available e Use GUI DispString UC Which accepts a 16 bit Unicode string or e Convert to an 8 bit string by embedding Unicode as 2 byte characters This allows usage of the standard C string routines supplied with any compiler Displaying Unicode mixed with ASCII code This is the most recommended way to display Unicode You do not have to use spe cial functions to do so There are only two macros for defining the beginning and the end of a Unicode sequence within one string Macro Explanation GUI UC START Marks the start of a Unicode sequence GUI UC END Marks the end of a Unicode sequence 16 2 Unicode and double byte conversions Why use the double byte form First of all there is no need to use the double byte variant of Unicode strings How ever doing so may reduce memory consumption of text messages and can make it easier to deal with strings This is true particularly if your compiler cannot handle 16 bit strings directly How to form Unicode strings The general idea is to be able to stay 100 percent compatible with existing software while still being able to use Unicode This means that strings are still byte 8 bit arrays and that normal ASCII or West e
101. system or at least one of the lowest some statistical tasks or simple idle processing may have even lower priori ties Interrupts can but do not have to be used for real time parts of the software Advantages The real time behavior of the system is excellent The real time behavior of a task is affected only by tasks running at higher priority This means that changes to a pro gram component running in a low priority task do not affect the real time behavior at all If the user interface is executed from a low priority task this means that changes to the user interface do not affect the real time behavior This kind of system makes it easy to assign different components of the software to different members of the development team which can work to a high degree independently from each other User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 140 CHAPTER 11 Execution Model Single Task Multitask Disadvantages You need to have a real time kernel RTOS which costs money and uses up ROM and RAM for stacks In addition you will have to think about task synchronization and how to transfer information from one task to another Using p C GUI If the window manager s callback mechanism is used then an p C GUI update func tion typically GUI Exec GUI Delay has to be called regularly from the task calling uwC GUI Since pC GUI is only called by one task to uC GUI it is the same as being used in
102. the current background color Prototype int GUI GetBkColorIndex void Return value The current background color index GUI GetColor Description Returns the current foreground color Prototype GUI COLOR GUI GetColor void Return value The current foreground color GUI GetColorlndex Description Returns the index of the current foreground color Prototype int GUI GetColorIndex void Return value The current foreground color index GUI SetBkColor Description Sets the current background color Prototype GUI COLOR GUI SetBkColor GUI COLOR Color Parameter Meaning Color Color for background 24 bit RGB value Return value The selected background color GUI SetBkColorlndex Description Sets the index of the current background color User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 115 Prototype int GUI SetBkColorIndex int Index Parameter Meaning Index Index of the color to be used Return value The selected background color index GUI SetColor Description Sets the current foreground color Prototype void GUI SetColor GUI COLOR Color Parameter Meaning Color Color for foreground 24 bit RGB value Return value The selected foreground color GUI SetColorlndex Description Sets the index of the current foreground color Prototype void GUI SetColorIndex int Index Pa
103. the progress bar Prototype void PROGBAR SetText PROGBAR Handle hObj const char s Parameter Meaning hObj Handle of progress bar Text to display A NULL pointer is permitted in this case a percentage value will be 2 displayed Additionnal information If this function is not called a percentage value will be displayed as the default If you do not want to display any text at all you should set an empty string PROGBAR SetTextAlign Description Sets the text alignment Prototype void PROGBAR SetTextAlign Handle hObj int Align Parameter Meaning hObj Handle of progress bar Align Horizontal alignment attribute for the text see table below Permitted values for parameter Align GUI_TA_HCENTER Centers the title default GUI_TA_LEFT Displays the title to the left GUI_TA_RIGHT Displays the title to the right Additionnal information If this function is not called the default behavior is to display the text centered User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 213 PROGBAR SetTextPos Description Sets the text position in pixels Prototype void PROGBAR SetTextPos PROGBAR Handle hObj int XOff int YOff Parameter Meaning hObj Handle of progress bar XOff Number of pixels to move text in horizontal direction Positive number will move text to the right Yoff
104. the windows have not been changed it will be the window directly on top of the one specified WM_GetHasTrans Description Returns the current value of the has transparency flag User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 162 CHAPTER 12 The Window Manager WM Prototype U8 WM GetHasTrans WM HWIN hWin Parameter Meaning hWin Window handle Return value 0 no transparency 1 window has transparency Additionnal information When set this flag tells the window manager that a window contains sections which are not redrawn and will therefore be transparent The WM then knows that the back ground needs to be redrawn prior to redrawing the window in order to make sure the transparent sections are restored correctly WM GetParent Description Returns the handle of a specified window s parent window Prototype void WM GetParent WM HWIN hWin Parameter Meaning hWin Window handle Return value Handle of the window s parent window O if none exists Additionnal information The only case in which no parent window exists is if the handle of the desktop win dow is used as parameter WM Init Description Initializes the window manager Prototype void WM Init void Additionnal information It is no longer necessary to call this function by the user application It is called by GUI Init WM IsWindow Description Determi
105. time kernel used in order to make the HC GUI task or thread safe Detailed descriptions of the routines follow as well as examples of how they are adapted for different kernels Routine Explanation GUI X Tnitos Initialize the kernel interface module create a resource semaphore mutex GUI X GetTaskId Return a unique 32 bit identifier for the current task thread GUI X Lock Lock the GUI block resource semaphore mutex GUT X Unlock Unlock the GUI unblock resource semaphore mutex GUI X InitOS Description Creates the resource semaphore or mutex typically used by GUI X Lock and GUI X Unlock Prototype void GUI X InitOS void GUI X GetTaskID Description Returns a unique ID for the current task User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 143 Prototype U32 GUI X GetTaskID void Return value ID of the current task as a 32 bit integer Additionnal information Used with a real time operating system It does not matter which value is returned as long as it is unique for each task thread using the p C GUI API and as long as the value is always the same for each particular thread GUI X Lock Description Locks the GUI Prototype void GUI X Lock void Additionnal information This routine is called by the GUI before it accesses the display or before using a crit ical internal data structure It blocks other threads
106. unchanged in terms get of appearance but uses less memory since a pal ette of only 16 colors is used instead of the full color mode These 16 colors are the only ones actually required to display this particular image Zoom 20 Transparent Micrium Step 6 Save the bitmap as a C file Choose File Save Select a destination and a name for the C file Select the file type In this example the file is saved as C with palette Click Save The bitmap converter will create a seperate file in the specified destination containing the C source code for the bitmap Save bitmap file Save i 090 My Computer My Network Places MicriumLogoBlue c Save C with palette c B Cancel 8 5 Color conversion The primary reason for converting the color format of a bitmap is to reduce memory consumption and therefore generate a more efficient C file User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 97 The most common way of doing this is by using the option Best palette as in the above example which customizes the palette of a particular bitmap to include only the colors which are used in the image It is especially useful with full color bitmaps in order to make the palette as small as possible while still fully supporting the image Once a bitmap file has been opened in the bitmap converter simply select Image Conver
107. used by uC GUI and shown on your display User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 94 CHAPTER 8 Bitmap Converter 8 1 Introduction The bitmap converter is intended as a tool to convert bitmaps from a PC format to a C file It also enables color conversion so that the resulting C code is not unneces sarily large You would typically reduce the pixel depth in order to reduce memory consumption The bitmap converter shows the converted image A limited number of simple functions can be performed with the bitmap converter including flipping the bitmap horizontally or vertically rotating it and inverting the bitmap indices or colors these features can be found under the Image menu Any further modifications to an image must be made in a bitmap manipulation program such as Adobe Photoshop or Corel Photopaint It usually makes the most sense to perform any image modifications in such a program using the bitmap converter for converting purposes only 8 2 Supported input formats An image must first be loaded into the bitmap converter as a bmp file either directly or via the clipboard The following bmp files may be loaded e 1 4 or 8 bits per pixel bpp with palette e 24 bpp without palette RGB full color mode e RLE4 and RLES Other graphic formats may be copied to the clipboard changed to a bmp file and then loaded to the bitmap converter 8 3 Supported output formats The conve
108. user interface for any application that operates with a graphical LCD It is compatible with single task and multitask environments with a proprietary operating system or with any commercial RTOS uC GUI is shipped as C source code It may be adapted to any size physical and virtual display with any LCD con troller and CPU Its features include the following General e 8 16 32 bit CPU only an ANSI C compiler is required e Any monochrome grayscale or color LCD with any controller supported if the right driver is available e May work without LCD controller on smaller displays e Any interface supported using configuration macros User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation e Display size configurable e Characters and bitmaps may be written at any point on the LCD not just on even numbered byte addresses e Routines are optimized for both size and speed e Compile time switches allow for different optimizations e For slower LCD controllers LCD can be cached in memory reducing access to a minimum and resulting in very high speed e Clear structure e Virtual display support the virtual display can be larger than the actual display Graphic library Bitmaps of different color depths supported Bitmap converter available Absolutely no floating point usage Fast line point drawing without floating point usage Very fast drawing of circles polygons Different draw
109. using the routine GUI DispChar If the character is not available in the current font nothing is displayed Example Shows a capital A on the display in the upper left corner GUI DispCharAt A 0 0 Related topics GUI DispChar GUI DispChars GUI DispChars Description Displays a character a specified number of times at the current text position in the current window using the current font Prototype void GUI DispChars U16 c int Cnt Parameter Meaning e Character to display ead Number of repetitions 0 lt Cnt lt 32767 Additionnal information Writes the character using the routine GUI DispChar If the character is not available in the current font nothing is displayed Example Shows the line eee KKK KKK KKK KK KKK KKK KKK KEM on the display GUI DispChars 30 Related topics GUI DispChar GUI DispCharAt User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 43 GUI DispString Description Displays the string passed as parameter at the current text position in the current window using the current font Prototype void GUI DispString const char GUI FAR s Parameter Meaning S String to display Additionnal information The string can contain the control character Nn This control character moves the cur rent text position to the beginning of the next line Example Shows Hello world on the display a
110. value The current antialiasing factor GUI AA SetFactor Description Sets the antialiasing quality factor Antialiasing Prototype void GUI AA SetFactor int Factor Parameter Meaning Factor The new antialiasing factor Minimum 1 will result in no antialiasing Maximum 6 Additional Information Setting the parameter Factor to 1 though permitted will effectively disable anti aliasing and result in a standard font We recommend an antialiasing quality factor of 2 4 The default factor is 3 15 4 Drawing functions GUI AA DrawArc Description Displays an antialiased arc at a specified position in the current window using the current pen size and the current pen shape Prototype void GUI AA DrawArc int x0 int y0 int rx int ry Parameter Meaning x0 Horizontal position of the center 0 Vertical position of the center rx Horizontal radius ry Vertical radius a Starting angle degrees al Ending angle degrees Limitations Currently the ry parameter is not available The rx parameter is used instead Additional Information If working in high resolution mode position and radius must be in high resolution coordinates Otherwise they must be specified in pixels User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 247 GUI AA DrawLine Description Displays an antialiased line at a specified position in the current
111. with wC GUI Routine Explanation GUI TOUCH Calibrate Changes the calibration Activates the measurement of the X and Y axes GUT TOUCH needs to be called about 100 times second GUI TOUCH SetDefaultCalibration Restores the default calibration TOUCH X routines The following four hardware dependent functions need to be added to your project if you use the driver supplied with wC GUI as they are called by GUI TOUCH Exec when polling the touch panel A suggested place is in the file x c These func tions are as follows Routine Explanation TOUCH X ActivateX Prepares measurement for Y axis TOUCH X ActivateY Prepares measurement for X axis TOUCH X MeasureX Returns the X result of the A D converter TOUCH X MeasureY Returns the Y result of the A D converter GUI TOUCH Calibrate Description Changes the calibration at run time Prototype int GUI TOUCH Calibrate int Coord int 1040 int Logl int PhysO int Phys1 Parameter Meaning Coord 0 for X axis 1 for Y axis KOGO Logical value 0 in pixels Logl Logical value 1 in pixels PhysO A D converter value for 1040 Physl A D converter value for Log1 Additional information The function takes as parameters the axis to be calibrated two logical values in pix els for this axis and two corresponding physical values of the A D converter GUI TOUCH Exe
112. 0 i lt Entries 1 i GUI_Delay 500 LISTBOX_IncSel hListBox for i 0 i lt Entries 1 i GUI_Delay 500 LISTBOX_DecSel hListBox GUI_Delay 500 Delete listbox widget LISTBOX Delete hListBox Delete framewin widget FRAMEWIN Delete hFrame GUI_Clear AEKk kkk kk kk K K K K K K K K KOK KOK KOK KOK KOK KOK KOK AA KOK KOK KOK KOK KOK KOK k ck I K K KOK KOK KOK KOK KOK e k Demonstrates LISTBOX widget KKKKKKKKKK K K K k kk Ck k kk Ck k k Sk kk x K lt k k k K K kk ke Sk kk kk kk Sk kx kk x K KKK KK KKK KKK static void DemoListbox void GUI_SetBkColor GUI_GRAY GUI_Clear while 1 DemoListBox DemoListBoxAsChild KK IK IK IK k K K K K K K K K KOK KOK KOK KOK KOK k kk k kk main ck ck ck ck x ck x k k k k ck ck ck K k k Ck k k ck ck ck ck ck ck ck K k k ck x K x x ck ck x x kk ck kk x x kv lt x x x x ok ok void main void GUI_Init DemoListbox Screen shots of above example Deutsch Deutsch Italiano Italiano 13 8 PROGBAR Progress bar widget Progress bars are commonly used in applications for visualization for example a tank fill level indicator or an oil pressure indicator Sample screenshots can be found at the beginning of the chapter and at end of this section All PROGBAR related rou tines are in the
113. 0 Memory Devices Prototype void GUI MEMDEV SetOrg GUI MEMDEV Handle hMem int x0 int y0 Parameter Meaning hMem Handle to memory device x0 Horizontal position of the upper left pixel y0 Vertical position of the upper left pixel Additional Information This routine can be helpful when the same device is used for different areas of the screen or when the contents of the memory device are to be copied into different areas Changing the origin of the memory device is more efficient than deleting and then recreating it User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 127 Simple example for using a memory device This example demonstrates the use of a basic memory device Text is written into a memory device and then copied to the LCD It can be found under Source Misc Mem Dev c KK IK IK kk A K K K K KOK KOK KOK ke kk Micrium Inc Empowering embedded systems ie uC GUI sample code ck k k ck K KKK k x lt ck Ck x KK ck Ck x KKK KKK ck ck x x lt lt x x x kk Ck x x k x ck kk x kk kk ck x x x lt x lt lt k ko ko x File MemDev c Purpose Simple demo shows the use of memory devices include GUI H KK KK IK kk kk kk K K K K K K K K K K K K K K K K K K K K KOK KOK K A A A A A A Kk kk KOK ke ko ke ke ke ke ke ke ek Shows the use of memory d
114. 00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 Ox 11 Ox 11 Ox 11 Ox 11 Ox 11 0x11 Ox 11 0x11 Ox 11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 Ox11 Ox11 Ox11 Ox11 Ox11 0x11 Ox11 Ox11 0 11 Ox11 0x11 0x11 0x11 0x11 0 11 0 11 0x11 Ox11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 Ox11 Ox11 Ox11 Ox11 Ox11 0x11 0x11 0x11 0 11 Ox11 0x11 0x11 0 11 0x11 0 11 0 11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x1
115. 002 Micrium Technologies Corporation 130 CHAPTER 10 Memory Devices Rotate the polygon GUI RotatePolygon DrawItContext aPointsDest aPoints SIZE OF ARRAY aPoints angle dif USE BANDING MEMDEV GUI RECT Rect 0 70 320 170 Use banding memory device for drawing GUI MEMDEV Draw amp Rect amp DrawIt amp DrawItContext 0 0 else Simple drawing without using memory devices DrawIt void amp DrawItContext endif ifdef WIN32 GUI_Delay 20 Use a short delay only in the simulation endif KK IK HK KA A kk kk k k AR K K KOK ck ck ck ck KOK KOK KOK KOK KOK KOK ck ck ck KOK kk x main Dk k k k k ck ck k ck k k k k k k k k k k k ck K ck k k k K KKK K k k K lt x k k ck K ck K k x K ko ko void main void GUI Init while 1 DemoBandingMemdev Screen shot for preceeding example Banding memory dewice without Flicker ing 10 7 Auto device object Memory devices are useful when the display must be updated to reflect the move ment or changing of items since it is important in such applications to prevent the LCD from flickering An auto device object is based on the banding memory device and may be more efficient for applications such as moving indicators in which only a small part of the display is updated at a time The device automatically distinguishes which areas of the display consist of fixed ob
116. 02 Micrium Technologies Corporation 267 Chapter 18 Input Devices HC GUI provides touch screen mouse and keyboard support The basic pC GUI package includes a driver for analog touch screens and a PS2 mouse driver although other types of touch panel and mouse devices can also be used with the appropriate drivers Any type of keyboard driver is compatible with uC GUI The software for input devices is located the subdirectory GUI NCore User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 268 CHAPTER 18 Input Devices 18 1 Pointer input devices Pointer input devices include the mouse and the touch screen They share a group of common pointer input device PID routines so as to enable simultaneous mouse and touch screen use These routines are typically called automatically by the window manager which reacts accordingly to update the display If the window manager is not used your application is responsible for calling the PID routines Data structure The structure of type GUI PID STATE referenced by the parameter pState is filled by the routine with the current values The structure is defined as follows typedef struct int unsigned char Pressed GUI_PID_STATE Pointer input device API The table below lists the pointer input device routines in alphabetical order Detailed descriptions follow Routine Explanation GUI_PID_GetState
117. 0x3062 last character amp GUI FontUC13 CharInfo 3 address of first character 0 pointer to next GUI FONT PROP static const GUI FONT PROP GUI_FontUC13_Propl 0x0041 first character 0x0043 last character amp GUI FontUC13 CharInfo 0 address of first character void amp GUI FontUC13 Prop2 pointer to next GUI FONT PROP static const GUI FONT GUI FontUC13 GUI FONTTYPE PROP type of font l13 J height of font 7 13 space of font y 1 magnification x 1 magnification y void amp GUI FontUC13 Propl KK KK IK I k K K K K K K K K K KOK K K K KOK K KOK KOK KOK A kk KOK k ck KOK KOK KOK KOK k ko ke kx Definition of string containing ASCII and UNICODE characters Ck Ck k kk ck k k ck kk k x k k k ck Ck k k x ck kk x k x kk ck x x ck k lt x x k x x ck kk x k x lt kk kk KK KKK k x x KKK x x x lt lt 7 static const char sUC_ASCII ABC GUI_UC_START x30 x60 x30 x61 x30 x62 GUI_UC_END x0 KK IK IK kk kk kk K K K K ck kc k KOK KOK KOK KOK KOK KOK Demonstrates output of UNICODE characters Ck Ck ck Ck k k k k k Ck ck k Ck k k k lt Ck KKK KKK KKK KKK KKK k kk kk k k x ck kk k kk ko kk lt x lt lt K x x KKK KK x k x KKK s static void DemoUNICODE void 1 GUI SetFont amp GUI Font13HB 1 User s amp referen
118. 1 0x11 0x11 0x11 0x11 0x10 0x01 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 102 CHAPTER 8 Bitmap Converter 0 11 Ox11 Ox11 Ox11 Ox11 0 11 0 11 Ox11 Ox11 Ox11 Ox11 Ox11 Ox11 Ox11 Ox11 Ox11 Ox11 Ox11 Ox11 0 11 Ox11 Ox11 Ox11 0 11 0 11 0 11 Ox11 Ox11 Ox11 Ox11 Ox11 0 11 Ox11 Ox11 Ox11 Ox11 0 11 0 11 Ox11 Ox11 Ox11 0 11 0 11 0 11 Ox11 Ox11 Ox11 Ox11 Ox11 0 11 Ox11 Ox11 Ox11 Ox11 0x11 Ox 11 Ox 11 0x11 Ox 11 0x11 0x11 0x11 0x20 0x01 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22
119. 1 sprintf 45 Subdirectories of GUI 16 Syntax conventions used 10 T Target systems 17 Text alignment 40 41 displaying 33 38 modes 38 40 positioning 34 42 43 Time related functions 243 244 Toggle behavior of hardkeys 23 27 TOUCH X ActivateX 238 TOUCH X ActivateY 238 TOUCH X MeasureX 238 TOUCH X MeasureY 238 Touch screens 11 237 241 analog 237 configuration of 237 digital 237 Transparency 131 in device simulation 23 Transparent reversed text 39 Transparent text 39 U uC GUI 9 as object version 10 as source version 10 data types used see Data types directory structure for see Directory structure features of 10 11 in multitask environments 29 152 229 236 memory requirements 297 2002 Micrium Technologies Corporation performance benchmark 296 updating to newer versions 17 uC OS 229 232 Unicode 57 65 223 227 displaying characters in 223 displaying strings in 223 double byte conversions 224 mixed with ASCII code 223 224 V Validation of windows 130 Values displaying 45 56 Vectorized symbols 76 Viewer 11 21 22 Virtual display 11 Visual C 20 21 directory structure for 20 W Western Latin character set see ISO 8859 1 Widgets 11 151 194 243 currently available 152 drawing 152 dynamic memory usage 153 handles of 151 153 member functions of 152 usage of 152 Win32 232 Window manager 9 11 129 149 151 Window objects see Widgets Windows 129 149 properti
120. 13 ASCII MSS F13 1 c F13 ASCII c User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 353 GUI Font13H ASCII CI e wo MSPS G 001234567091 lt gt ABCDEFGHIKLM NOPORSTUMARCY2 abcdefahiiklmnmnoaparstuvwxvzt ROM Size 2232 bytes Used files F13H_ASCII c GUI Font13H 1 Cr eam e wo Meee O 0123456788 gt Fi ABCDERGHIELM ee a abcdefghijklmnopqrstuiywxyz ps rg D D 023 pM 1051413825 AA AAA E gun eB aasa3ce eeiiti no 606 eua uyb ROM Size 2291bytes size of GUI Font13H ASCII sexe sess F13H 1 c F13H ASCII c GUI Font13HB ASCII Cream e wo User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 354 CHAPTER 25 Standard Fonts atoe 0123456789 lt gt 7 ABCDEFGH DIKLMNOPORSTUYWeaY 2 abcdefghijkimnopq ROM Size Used fil 2690 bytes es F13HB_ASCII c GUI_Font13HB_1 13 11 Ba B Bz cr ag TI I 2505g 0Y 0123456789 z gt TIU ABCDEFGH IJIKLMNOPOQRSTUVMWEXEVZ S 9 abcdefghijkimnopq ROM Size 2806 bytes size of GUI Font13HB ASCII Used files F13HB 1 c F13HB ASCII c GUI Font16 ASCII User s amp reference 16 13 is B B3 Zr oun T 0123455788 2 AB CDEF GHIJKL
121. 2 basic usage of 113 disabling of 113 147 software for 111 with window manager 147 Memory reducing consumption of 88 90 Message box widget 183 186 Monospaced fonts see Fonts Multitask environments 29 152 229 2236 N NORMAL drawing mode 69 Normal text 38 Numerical value macro 14 P Palettes see Color palettes Parent window 136 Performance 295 297 Pixels 12 Polygons drawing 76 81 PROGBAR Create 187 PROGBAR Delete 187 PROGBAR DisableMemdev 188 PROGBAR EnableMemdev 188 PROGBAR Paint 188 PROGBAR SetBarColor 189 PROGBAR SetFont 189 PROGBAR SetMinMax 190 PROGBAR SetText 190 PROGBAR SetTextAlign 191 PROGBAR SetTextPos 191 PROGBAR SetValue 189 Progress bar widget 186 194 Proportional fonts see Fonts R Real bus interface 257 Redrawing mechanism 153 resource 22 Resource file 22 23 Resource semaphore 230 Resource usage 295 297 Reverse text 39 RLE compression of bitmaps 89 92 96 RTOS 229 User s amp reference manual for uC GUI S 51013806 controller 274 Sample programs 12 29 SED1386 controller 274 Selection switch macro 14 Shift JIS 219 222 creating fonts 219 displaying strings 219 Showing windows 130 SIM HARDKEY GetNum 25 SIM HARDKEY GetState 25 SIM HARDKEY SetCallback 26 SIM HARDKEY SetMode 23 26 SIM HARDKEY SetState 27 SIM SetLCDPos 24 SIM SetTransColor 23 24 Simple bus interface configuration 247 255 258 Simulator 11 19 27 22 27 directory structure for 20 usage of 2
122. 200 capital E grave accent E 201 capital E acute accent E 202 capital E circumflex accent 203 capital E dieresis or umlaut mark 204 capital I grave accent i 205 capital I acute accent i 206 capital I circumflex accent 207 capital I dieresis or umlaut mark I 208 Eth Icelandic D 209 N tilde 210 capital O grave accent 211 capital O acute accent 212 capital O circumflex accent 213 capital O tilde 214 capital O dieresis or umlaut mark 215 multiply sign x 216 capital O slash 0 217 capital U grave accent 218 capital U acute accent 219 capital U circumflex accent 220 capital U dieresis or umlaut mark 221 capital Y acute accent Y 222 THORN Icelandic b 223 sharp s German s z ligature B 224 small a grave accent 225 small a acute accent 226 small a circumflex accent 227 small a tilde a 228 small a dieresis or umlaut mark a 229 small a ring 230 small ae diphthong ligature 231 cedilla 232 small e grave accent 233 small e acute accent 234 small e circumflex accent 235 small e dieresis or umlaut mark 236 small i grave accent 1 User s amp reference manual for uC GUI Fonts 2002 Micrium Technologies Corporation 91 Code Description Char 237 small i acute accent 238 small i circumflex accent i 239 small i dieresis or umlaut mark 1 240 small eth Icelandic 241 small n tilde 242 sma
123. 6 and Fujitsu FR30 CPUs For 16 bit CPUs the ROM code size should be smaller app 30 in native memory model i e with 16 bit pointers the ROM size for data fonts is identical Short description Switch RAM bytes bytes Basic system Core software without fonts and graphic library 120 3900 Color palette management Color management support for 16 colors no cache 16 336 Color management support for 256 colors no cache 256 336 Color management support for 256 colors 1000 byte caching 1256 580 Fonts F4x6 font ASCII only AE 600 F6x8 font ISO8859 1 1536 F8x8 font 1508859 1 1536 F8x16 font 1508859 1 sem 3072 FD24x32 font big digits 1374 F4x6 font ASCII only 600 Graphic library Bitmaps cm u i Simple lines any angle u i Lines with line styles u i Polylines drawing u i Polylines filling polygons u i Circles drawing 555 u i Circles filling Ps u i Total 9500 Memory devices optional Core software depends ca 500 on area size Support for 1 bit pixel drivers PRA ca 1800 Support for 2 bit pixel drivers 2400 Support for 4 bit pixel drivers mE ca 2400 Support for 8 bit pixel drivers 1700 Graphic library antialiased u d Simple lines any angle u i User s amp reference manua
124. 9 LCD LO XorPixel 290 LCD LASTCOM 259 User s amp reference manual for uC GUI 381 LCD LASTSEG 259 LCD LUT COM 247 LCD LUT SEG 247 LCD MAX LOG COLORS 250 LCD MIRROR X 249 LCD MIRROR Y 249 LCD NUM CONTROLLERS 248 LCD READ A0 255 LCD READ A1 256 LCD READ MEM 246 LCD READ REG 252 275 LCD SUPPORT CACHECONTROL 262 LCD SWAP RB 274 LCD SWAP XY 249 LCD VXSIZE 250 LCD VYSIZE 250 LCD WRITE 0 256 LCD WRITE A1 256 LCD WRITE MEM 246 LCD WRITE REG 253 275 LCD WRITEM A1 257 LCD XMAG 246 LCD XORG 249 LCD XSIZE 248 LCD YMAG 246 LCD YORG 249 LCD YSIZE 248 LCD07X4 driver 271 272 LCD13XX driver 273 275 LCD159A driver 275 LCD15E05 driver 276 277 LCD15XX driver 278 279 LCD6642X driver 280 LCDConf h 13 14 17 29 30 105 245 LCDMem driver 281 LCDMemC driver 282 283 LCDSLin driver 284 Library creating 17 18 Linearization 110 Lines drawing 74 76 List box widget 174 183 LISTBOX Create 174 LISTBOX CreateAsChild 175 LISTBOX DecSel 178 LISTBOX Delete 176 LISTBOX DisableMemdev 176 LISTBOX EnableMemdev 176 LISTBOX GetDefaultFont 179 LISTBOX GetSel 179 LISTBOX IncSel 178 LISTBOX Invalidate 177 LISTBOX Paint 177 LISTBOX SetBackColor 177 LISTBOX SetDefaultFont 179 LISTBOX SetFont 178 2002 Micrium Technologies Corporation LISTBOX SetSel 178 LISTBOX SetTextColor 178 Lookup table LUT 102 106 110 285 for COM SEG lines 247 M Memory devices 111 127 auto 122 127 banding 120 12
125. APTER 13 Window Objects Widgets 7 include gui H include framewin h include listbox h include lt stddef h gt const GUI_ConstString ListBox English Deutsch Francais Japanese Italiano NULL define countof Array sizeof Array sizeof 0 BK KK IK kk A K K K K k k K K K K K K K K K K k ck k ck k ck kc k kck kc ck ck KOK K K Uses only the LISTBOX widget KKKKKKKKKKKKKK kk kk K x k CK Ck Ck kk Ck K k x lt x kk kk kk kk Sk lt x k k x lt x KKK ko ko KKK KK void DemoListBox void int i int Entries countof ListBox 1 LISTBOX Handle hListBox int ySize GUI GetFontSizeYOf amp GUI Font13B 1 Entries Create the listbox hListBox LISTBOX Create ListBox 10 10 120 ySize WM CF SHOW Modify listbox attributes LISTBOX SetFont hListBox amp GUI Font13B 1 LISTBOX SetBackColor hListBox 0 GUI BLUE LISTBOX SetBackColor hListBox 1 GUI LIGHTBLUE LISTBOX SetTextColor hListBox 0 GUI WHITE LISTBOX SetTextColor hListBox 1 GUI BLACK Change current selection of the listbox for i 0 i lt Entries 1 i GUI Delay 500 LISTBOX IncSel hListBox for i 0 i lt Entries 1 itt GUI Delay 500 LISTBOX_DecSel hListBox GUI_Delay 500 Delete listbox widget LISTBOX Delete hListBox GUI Clear RK KK IK IK K K K K
126. ASCII Used files F24B_ASCII c F24B_1 c GUI Font32 ASCII cr eum r e S S 012345678 9 lt gt ABCDEFGHIJK LMNOPQRSTUVWAYZI abcdefghijkilmnoparstu VWXYZi User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation CHAPTER 25 Standard Fonts Used files 7234 bytes GUI Font32 1 cr ou r I g amp 012345678 9 lt gt ABCDEFGHIJK LMNOPQRSTUVVVAYZ abcdefghijklmnoparstu wwxyZil jpEnYis Q 7 8 PF UT 19274116942 Ff os FK 7L F i ize of GUI Font32 5 ze iles F32 ASCII c F32_1 c rence manual for uC GUI 2002 Micrium Technologies Corporation GUI Font32B ASCII r r m na Ca HS amp 01234567 89 lt gt ABCDEFGHI JKLMNOPQRSTUVWXY Z M abcdefghijkimno parstuvwxyz Si 7842 29 CS F32 GUI Font32B 1 32 E 25 Ci 2H L 15 Uu 5 User s amp reference manua for wC GUI 2002 Micrium Technologies Corporation User s CHAPTER 25 Standard Fonts 3 96 amp 01234567 89 lt gt DABCDEFGHI JKLMNOPQRSTUVWAY Z _ abcdefghijklmno parstuvwxyZ j g c QaR O49 OR uq 1914134 amp AAAAAA EGEEEEIIION aadaace e 8iiiloOftio 0 000 9u u yb amp referenc f Cr au 1 e manual for uC GUI 2002 Micri
127. ASCII Font contains ASCII characters only Example 2 GUI_Font8x15B_ASCII Element Meaning GUI_Font Standard font prefix 8 Width of characters x15 Heigth in pixels B Bold font _ASCII Font contains ASCII characters only Standard Fonts 2002 Micrium Technologies Corporation 349 Example 3 GUI Font8x16x1x2 Element Meaning GUI Font Standard font prefix 8 Width of characters x16 Heigth in pixels x1 Magnification factor in X x2 Magnification factor in Y 25 2 Font file naming convention The names for the font files are similar to the names of the fonts themselves The files are named as follows F width height H B characterset Element Meaning F Standard prefix for all fonts files shipped with uC GUI width Width of characters contained only in monspaced fonts height Height of the font in pixels H Abbreviation for high Only used if there is more than one font with the same height It means that the font appears higher than other fonts B Abbreviation for bold Used in bold fonts lt characterset gt Specifies the contents of characters ASCII Only ASCII characters 0x20 0x7E 0x7F 1 ASCII characters and European extensions OxAO OxFF HK Hiragana and Katakana 1HK ASCII European extensions Hiragana and Katakana D Digit fonts 25 3 Measurement ROM size and character set of fonts The following pages describe the
128. AsSxHD ROM Size Used files This font uses the same ROM location as GUI Font6x8 F6x8 c User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation GUI Font8x8 F 88 BF BF 05 TUHSERCCU XRL 0123456789 4 GHIJELMHOPQRETU UULEVZIX1 abcdefghi klm nor er sha rds zu 155554 PRI s Hagn 0 51H BHRIECEEEETITITIDNOOOO dlc SS oditi 367 ROM Size ESL 1840 bytes es F8x8 c GUI Font8x9 TUHSXAR C XF O0OIZ23456T7T8292 x TAMnBCDEF IJKLANOPORS TUULIER V E 1 ahbcdefuh ijklm nopqrztuuuxuzilr teas agin st s Bea G Sees yug 1 E AAAAA AA CEEEE r 1 r Eli OCE GxOUG0U YbRaAa adaarcesegp irrsmodnccd goudpgu ROM Size Used fil This font uses the same ROM location as GUI Font8x8 es F8x8 c GUI Font8x10 ASCII User s amp reference manual for uC GUI F iH Bau ga Li Hr L Hi fU 9 8123456789 gt PABCDEF CHI JRLMNOPORSTOUUREZER IS nopgrstuuwxUziirz a 2002 Micrium Technologies Corporation 368 CHAPTER 25 Standard Fonts ROM Size 1770 bytes Used files F8x10 ASCII c GUI Font8x12 ASCII Crono so 49125456789 4 2 PH BCDEF GHIJKLMHOPQRSTUUUSVZI 1 ahbcdefghijklm nhopq
129. Bar 0 amp GUI_Font8x16 dif LCD BITSPERPIXEL lt 4 PROGBAR SetBarColor ahProgBar 0 0 GUI DARKGRAY PROGBAR SetBarColor ahProgBar 0 1 GUI LIGHTGRAY else PROGBAR SetBarColor ahProgBar 0 0 GUI GREEN PROGBAR SetBarColor ahProgBar 0 1 GUI RED endif for i20 i lt 100 i PROGBAR_SetValue ahProgBar 0 i PROGBAR SetValue ahProgBar 1 i GUI Delay 5 9 Gy U PO s lt p Gy GY PROGBAR_SetText ahProgBar 0 Tank empty for i gt 0 i PROGBAR_SetValue ahProgBar 0 i PROGBAR SetValue ahProgBar 1 200 1 GUI Delay 5 PROGBAR SetText ahProgBar 0 Any text PROGBAR SetTextAlign ahProgBar 0 GUI TA LEFT for i lt 100 i PROGBAR SetValue ahProgBar 0 i PROGBAR SetValue ahProgBar 1 200 414 GUI Delay 5 PROGBAR SetTextAlign ahProgBar 0 GUI TA RIGHT for i gt 0 i PROGBAR SetValue ahProgBar 0 i PROGBAR SetValue ahProgBar 1 400 1 GUI Delay 5 PROGBAR_SetFont ahProgBar 0 amp GUI FontComicl18B 1 PROGBAR SetText ahProgBar 0 Any font for i lt 100 i PROGBAR_SetValue ahProgBar 0 i PROGBAR SetValue ahProgBar 1 400 414 GUI Delay 5 GUI_Delay 1000 J KCKCKCKCKCkCk IK kk kk K K K K K K K KOK KOK KOK KOK KOK KOK KOK KOK A KOK KOK KOK KOK KOK k ck k ck k ck KOK KOK KOK KOK KOK ke User s amp
130. C Logos WiicriumLopoDlue bmp DER In this example the image uses less memory since a palette of only 4 grayscales is used instead of the full color mode If the target display sup ports only 4 grayscales there is no use in having a higher pixel depth as it would only waste mem ory Micrium done 8 6 Compressed bitmaps The bitmap converter and uC GUI support run length encoding RLE compression of bitmaps in the resulting source code files The RLE compression method works most efficiently if your bitmap contains many sequences of equal colored pixels An effi ciently compressed bitmap will save a significant amount of space However com pression is not recommended for photographic images since they do not normally have sequences of identical pixels It should also be noted that a compressed image may take slightly longer to display since it must first be decompressed If you want to save a bitmap using RLE compression you can do so by selecting one of the compressed output formats when saving as a C file C with palette com pressed or C without palette compressed There are no special functions needed for displaying compressed bitmaps it works in the same way as displaying uncom pressed bitmaps 8 7 Using a custom palette Under certain circumstances it may be desirable to use a custom palette for conver sions In these cases usually only if you have a color display using a special
131. Chapter 13 Window Objects revised CHECKBOX widgets added Chapter 14 Dialogs added 3 14R3 020618 020611 020531 020524 020507 KG KG KG KG KG Chapter 3 Simulator revised Chapter 20 Low Level Configuration revised Chapter 22 LCD Drivers revised Chapter 12 The Window Manager revised Version control table added 3 14R2 020503 KG Chapter 11 Memory Devices revised Chapter 14 Antialiasing revised Chapter 9 Bitmap Converter revised 3 14R1 020405 KG Completely revised for language grammar 1 5 Typographic conventions updated Chapter 8 changed to 7 6 Font converter Index revised User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Software versions Software Date By Explanation 3 26 020820 RS Mouse and keyboard support added 3 24 020726 RS GUI Exec and GUI added 3 22 020719 RS Support for 444 color mode added Scrollbars Radio buttons added 3 20 020618 RS Dialog boxes added Slider added Check box added 3D effects added User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Table of Contents eria eth D ex Oba dni aide 9 1 1 Wie fcil EE RT CE 9 1 2 Purpose of this document nnn nnn 9 1 3 Assulmbptions a usnu a ex steel oe ei
132. Create a group of radio buttons RADIO CreateIndirect Create a group of radio buttons from resource table entry RADIO Dec Decrement the button selection by a value of 1 RADIO GetValue Return the current button selection RADIO Inc Increment the button selection by a value of 1 RADIO SetValue Set the button selection User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 217 RADIO Create Description Creates a RADIO widget of a specified size at a specified location Prototype RADIO Handle RADIO Create int x0 int y0 int xsize int ysize WM HWIN hParent int Id int Flags unsigned Para Parameter Meaning x0 Leftmost pixel of the radio button widget in desktop coordinates 0 Topmost pixel of the radio button widget in desktop coordinates xsize Horizontal size of the radio button widget in pixels ysize Vertical size of the radio button widget in pixels hParent Handle of parent window Id ID to be returned Window create flags Typically WM CF SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values Para Number of buttons in the group Return value Handle for the created RADIO widget O if the routine fails RADIO Createlndirect Prototype explained at the beginning of the chapter The element Flags of the resource passed a
133. D EBUG LEVEL The following table lists the permitted values for GUI DEBUG LEVEL Value Explanation GUI DEBUG LEVEL NOCHECK No run time checks are performed GUI DEBUG LEVEL CHECK PARA Parameter checks are performed to avoid crashes GUI DEBUG LEVEL CHECK ALL Parameter checks and consistency checks are performed GUI DEBUG LEVEL LOG ERRORS Errors are recorded GUI DEBUG LEVEL LOG WARNINGS Errors and warnings are recorded GUI DEBUG LEVEL LOG ALL Errors warnings and messages are recorded Uu C GUI User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 308 CHAPTER 21 High Level Configuration User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 309 Chapter 22 LCD Drivers An LCD driver supports a particular family of LCD controllers and all LCDs which are equipped with one or more of these controllers The driver is essentially generic meaning it can be configured by modifying the configuration file LcDConf h This file contains all configurable options for the driver as well as multiple defines for how the hardware is accessed and how the controller s is connected to the LCD This chapter provides an overview of the LCD drivers available for wC GUI It explains the following in terms of each driver
134. D There may not be enough memory available to store the complete output area at once depending on your configuration see the cur ALLOC SIZE configuration macro in Chapter 21 High Level Configura tion A banding memory device divides the drawing area into bands in which each band covers as many lines as possible with the currently available memory GUI MEMDEV Draw Description Basic drawing function that prevents flickering of the display Prototype int GUI MEMDEV Draw GUI RECT pRect GUI CALLBACK VOID P pfDraw void pData int NumLines int Flags Parameter Meaning pRect Pointer to a GUI RECT structure for the used LCD area pfDraw Pointer to a callback function for executing the drawing pData Pointer to a data structure used as parameter for the callback function NumLines 0 recommended or number of lines for the memory device Flags 0 or GUI MEMDEV HASTRANS Return value 0 if successful 1 if the routine fails Additional Information If the parameter NumLines is 0 the number of lines in each band is calculated auto matically by the function The function then iterates over the output area band by band by moving the origin of the memory device Example for using a banding memory device The following example demonstrates the use of a banding memory device It can be found under Source Misc BandingMemdev c KEK k k k k k k k KEK k k k K KKK k k K KKK k K lt
135. D BITSPERPIXEL LCD FIXEDPALETTE Configure which common segment lines are used if necessary Test the system Reverse X Y if necessary LCD REVERSE go back to step 6 in this case Mirror X Y if necessary LCD MIRROR X LCD MIRROR Y go back to step 6 this case 9 Check all the other configuration switches 10 Erase unused sections of the configuration AU ON OU 20 2 General required configuration LCD CONTROLLER Description Defines the LCD controller used Type Selection switch Additionnal information The LCD controller used is designated by the appropriate number Please refer to Chapter 22 LCD Drivers for more information about available options Example Specifies an Epson SED1565 controller define LCD CONTROLLER 1565 Selects SED 1565 LCD controller LCD_BITSPERPIXEL Description Specifies the number of bits per pixel Type Numerical value LCD_FIXEDPALETTE Description Specifies the fixed palette mode Type Selection switch Additionnal information Set the value to O to use a color lookup table instead of a fixed palette mode The macro LCD_PHYSCOLORS must then be defined User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 285 LCD XSIZE LCD YSIZE Description Define the horizontal and vertical resolution respectively of the display used Type Numerical values Additionnal
136. D WRITE AO Write a byte to LCD controller with A line low LCD WRITE A1 Write a byte to LCD controller with A line high Additional configuration switches The following table shows optional configuration switches available for this driver Macro Explanation LCD CACHE When set to 0 no display data cache is used which slows down the i speed of the driver Default is 1 cache activated User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 323 Special requirements for certain LCD controllers None 22 8 LCDMem Using the CPU as LCD controller In systems with relatively fast CPUs and small quarter VGA or less LCDs there is no need for an LCD controller The microcontroller CPU can do the job of the LCD controller on the side refreshing the display in an interrupt service routine The CPU s memory is used as video memory Advantages of this approach include the following e Very fast update of display possible e Eliminating the LCD controller and its external RAM reduces hardware costs e Simplified hardware design levels of gray can be displayed The disadvantage is that much of the available computation time is used up Depend ing on the CPU this can be anything between 20 and almost 100 percent with slower CPUs it is really not possible at all This type of interface does not require a specific LCD driver because uC GUI simply places all the disp
137. DB3 2 DB4 DB5 DB6 y COMn t DB7 The picture above shows the relation between the display memory and the SEG and COM lines of the LCD The display memory is divided into two panes for each pixel The lower bit of each pixel is stored in pane 0 and the higher bit is stored in pane 1 Additional RAM requirements of the driver This LCD driver may be used with or without a display data cache containing a com plete copy of the contents of the LCD data RAM If a cache is not used there are no additional RAM requirements It is recommended to use this driver with a data cache for faster LCD access The amount of memory used by the cache may be calculated as follows Size of RAM in bytes LCD YSIZE 7 8 LCD XSIZE 2 Additional driver functions LCD LO ControlCache For information about this function please refer to Chapter 23 LCD Driver API Hardware configuration This driver accesses the hardware with a simple bus interface as described in Chapter 20 Low Level Configuration The following tables lists the macros which must be defined for hardware access User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Parallel mode Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller READ AO Read a byte from LCD controller with A line low READ 1 Read b
138. Description Creates a BUTTON widget as a child window Prototype BUTTON Handle BUTTON CreateAsChild int x0 int y0 int xsize int ysize WM HWIN hParent int ID int Flags Parameter Meaning x0 Leftmost pixel of the button in desktop coordinates 0 Topmost pixel of the button desktop coordinates xsize Horizontal size of the button in pixels ysize Vertical size of the button in pixels Eb ean Handle of parent window If 0 the new button window will be a child of the desktop top level window ID ID to be returned when button is pressed Flags Window create flags see BUTTON_Create Return value Handle for the created BUTTON widget O if the routine fails BUTTON Createlndirect Prototype explained at the beginning of the chapter The elements Flags and Para of the resource passed as parameter are not used BUTTON SetBitmap Description Sets the bitmap s to be used when displaying a specified button Prototype void BUTTON SetBitmap BUTTON Handle hObj int Index User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 176 CHAPTER 13 Window Objects Widgets const GUI BITMAP pBitmap Parameter Meaning hObj Handle of button Index Index for bitmap see table below pBitmap Pointer to the bitmap structure Permitted values for parameter Index Sets the bitmap to be used when button is unpressed Sets th
139. EDIT SetDecMode Description Enables the decimal edit mode of the edit field The given value can be modified in the given range Prototype void EDIT SetDecMode EDIT Handle hEdit 132 Value I32 Min 132 Max User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 188 CHAPTER 13 Window Objects Widgets int Shift U8 Flags Parameter Meaning hObj Handle of edit field Value Value to be modified Min Minimum value Max Maximum value Shift If gt 0 it specifies the position of the decimal point im 125 See table below Permitted values for parameter Flags OR combinable Edit in normal mode sign is only displayed if the value is negative GUI EDIT SIGNED and sign is displayed 0 default EDIT SetDefaultFont Description Sets the default font used for edit fields Prototype void EDIT SetDefaultFont const GUI FONT pFont Parameter Meaning pront Pointer to the font to be set as default EDIT SetDefaultTextAlign Description Sets the default text alignment for edit fields Prototype void EDIT SetDefaultTextAlign int Align Parameter Meaning Align Default text alignment see GUI Set TextAlign EDIT SetFont Description Sets the edit field font Prototype void EDIT SetFont EDIT Handle hObj const GUI FONT pfont Parameter Meaning
140. ER 23 LCD Driver API Prototype void LCD 10 SetPixellIndex int x int y int ColorIndex Parameter Meaning x X position of pixel to draw y Y position of pixel to draw ColorIndex Color to be used LCD LO XorPixel Description Inverts one pixel Prototype void LCD 10 XorPixel int x int y Parameter Meaning X position of pixel to invert y Y position of pixel to invert 23 4 Get group LCD LO GetPixellndex Description Returns the RGB color index of a specified pixel Prototype int LCD LO GetPixelIndex int x int y Parameter Meaning X position of pixel Y position of pixel Return value The index of the pixel Additionnal information For further information see Chapter 9 Colors 23 5 Lookup table LUT group LCD LO SetLUTEntry Description Modifies a single entry to the LUT of the LCD controller s User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 339 Prototype void LCD 10 SetLUTEntry U8 Pos LCD COLOR Color Parameter Meaning B Position within the lookup table Should be less than the number of colors e g 0 3 for 2bpp 0 15 for 4bpp 0 255 for 8bpp 24 bit RGB value The closest value possible will be used for the LUT If a color LUT is to be initialized all 3 components are used In monochrome modes the green com ponent is used but it is still recommended for better unders
141. Epson SED1335 1 6963 Toshiba T6963 Selecting a driver As described in Chapter 20 Low Level Configuration the macro LCD CONTROLLER defines the LCD controller used A controller is specified by its appropriate value listed in the table above The following sections discuss each of the available drivers individually User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 311 22 2 LCDO7X1 Supported hardware Controllers This driver has been tested with the following LCD controllers e Samsung 50711 e Samsung KS0741 It should be assumed that it will also work with any controller of similar organization Bits per pixel Supported color depth is 2 bpp Interfaces The chip supports three types of interfaces e 8 bit parallel simple bus interface e 4 pin serial peripheral interface or SPI e 3 pin SPI The current version of the driver supports the parallel or 4 pin SPI modes User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 312 CHAPTER 22 LCD Drivers Display data RAM organization SEG SEG SEG SEG Pane 0 2 A como DBO COM 1 DB1 com2 DB2 2 COM3 DB3 DB4 5 DBS DB6 y COM7 t DB7 ae DB1 DB2
142. Frame window widget Frame windows give your application a PC application window appearance They con sist of a surrounding frame a title bar and a user area The color of the title bar changes to show whether the window is active or inactive as seen below Active frame window Inactive frame window All FRAMEWIN related routines are located in the file s FRAMEWIN c FRAMEWIN h All identifiers are prefixed FRAMEWIN User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 194 Configuration options CHAPTER 13 Window Objects Widgets Type Macro Default Explanation FRAMEWIN BARCOLOR ACTIVE DEFAULT Oxff0000 Title bar color active state N FRAMEWIN _BARCOLOR_INACTIVE_DEFAULT 0 404040 Title bar color inactive state N FRAMEWIN BORDER DEFAULT 3 Outer border width in pixels N FRAMEWIN CLIENTCOLOR DEFAULT OxcOcOcO Color of client window area S FRAMEWIN DEFAULT FONT amp GUI Font8 1 Font used for title bar text N FRAMEWIN FRAMECOLOR DEFAULT Oxaaaaaa Frame color N FRAMEWIN IBORDER DEFAULT 1 Inner border width in pixels B FRAMEWIN USE 3D 1 Enable support for 3D effects FRAMEWIN API The table below lists the available uC GUI FRAMEWIN related routines in alphabetical order Detailed descriptions of the routines follow
143. GetKey Description Returns the current contents of the key buffer Prototype int GUI GetKey void Return value Codes of characters in key buffer 0 if no keys in buffer GUI StoreKey Description Stores a key in the buffer Prototype void GUI StoreKey int Key Parameter Meaning May be any extended ASCII character between 0x20 and OxFF or any predefined Ju C GUI character code Key Additional information This function is typically called by the driver and not by the application itself GUI WaitKey Description Waits for a key to be pressed Prototype int GUI WaitKey void Additional information The application is blocked meaning it will not return until a key is pressed User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 277 Chapter 19 Time Related Functions Some widgets as well as our demonstration code require time related functions The other parts of the uC GUI graphic library do not require a time base The demonstration code makes heavy use of the routine GUI Delay which delays for a given period of time A unit of time is referred to as a tick User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 278 CHAPTER 19 Time Related Functions Timing and execution API GUI The table below lists the available timing and execution related routines in alpha betical order Detailed descript
144. H RK IK kk K K AR A A A A A A K K K K Kk Ck kk KOK KOK kk KOK ke K KOK KOK x main ck k x K k ck ck ck ck ck ck ck ck ck k ck ck ck k ck k ck ck ck ck ck KKK ck ck ck ck ck ck ck ck ck ck ck ck ck ck K x x x ck ck ck ck ck ck k ck k ck K x kk kk QD void main void ToDo Make sure hardware is initilized first GUI Init GUI DispString Hello world while 1 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 25 Adding functionality to the Hello world program Our little program has not been doing too much so far We can now extend the func tionality a bit after displaying Hello world we would like the program to start counting on the display in order to be able to estimate how fast outputs to the LCD can be made We can simply add a bit of code to the loop at the end of the main pro gram which is essentially a call to the function that displays a value in decimal form The example is available as BASIC Hellol c in the sample folder KK IK IK kk kk K K K K K K K K K KOK kk K K TK KOK K K KOK K KOK AA AA A IA K k K KOK KOK ke ke KOK KOK ke ke ke ke e ke K Micrium Inc Empowering embedded systems uC GUI sample code i Dk k k k k k k k k k k k KK KKK KKK k k k k k lt lt k k K lt KKK k k ck ck ck ck k k k ck ck k k k ko K ko Sk k k lt lt kx ko ko File BASIC_Hellol c Purpose Simple demo
145. I 2002 Micrium Technologies Corporation 279 Prototype int GUI_Execl void Return value 0 if there were no jobs performed 1 if a job was performed Additionnal information This routine may be called repeatedly until O is returned which means all jobs have been completed This function is called automatically by GUI Exec GUI GetTime Description Returns the current system time Prototype int GUI GetTime void Return value The current system time in ticks Additionnal information This function will call X GetTime User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 280 CHAPTER 19 Time Related Functions User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 281 Chapter 20 Low Level Configuration Before you can use p C GUI on your target system you need to configure the soft ware for your application Configuring means modifying the configuration header files which usually reside in the sub directory con ig We try to keep the configura tion as simple as possible but there are some configuration macros the file LCD Conf h which you must modify in order for the system to work properly These include e LCD macros defining the size of the display as well as optional features such as mirroring etc e LCD controller macros defining how to access the controller you are using User s amp reference
146. I DispSDec GUI DispDecMin GUI DispSDec Description Displays a value in decimal form with sign with a specified number of characters at the current text position in the current window using the current font Prototype void GUI 132 v U8 Len Parameter Meaning Value to display Minimum 2147483648 2 31 maximum 2147483647 2 31 1 Len No of digits to display max 9 V Additionnal information Leading zeros are not suppressed This function is similar to GUI DispDec but a sign is always shown in front of the value even if the value is positive Related topics GUI DispDec GUI DispDecAt GUI DispDecMin GUI DispDecSpace GUI DispSDecShift Description Displays a 1ong value in decimal form with sign with a specified number of charac ters and with decimal point at the current text position in the current window using the current font User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 56 CHAPTER 5 Displaying Values Prototype void GUI DispSDecShift I132 v U8 Len U8 Shift Parameter Meaning Value to display id Minimum 2147483648 2 31 maximum 2147483647 2431 1 Len No of digits to display max 9 Shift No of digits to show to right of decimal point Additionnal information A sign is always shown in front of the value Watch the maximum number of 9 characters includin
147. I FontComici18b ASCII FComic18B 1c FComici8B ASCII c GUI Font24 ASCII 24 19 15 Cream HS amp 0123456789 lt gt ABCDEFGHIJKLMNOPQRST abcdefghijklimnopar stuvwxyzZ User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 359 ROM Size 4786 bytes Used files F24 ASCII c GUI Font24 1 Zr cium an HS amp 01234567 89 lt gt ABCDEFGHIJKLMNOPQRST abcedetghijkimnopar stuvwxyz j ox G Ba 2 19 141234 AAAAAAACEEEE aeece ai Tr fio 660 g u yp ROM Size 5022 bytes size of GUI Font24 ASCII Used files F24 ASCII c F24 1 c User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 360 CHAPTER 25 Standard Fonts GUI Font24B ASCII 24 19 15 11 Ba Croom 1 amp 0123456789 lt gt ABCDEFGHIJKLMNOPQRST UVWxXYZ abcdefghijkimnop qrstuvwxyz l ROM Size Used files F24B ASCII c 4858 bytes GUI Font24B 1 Cr oum un User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 1 amp 0123456789 lt gt ABCDEFGHIJKLMNOPQRST UVWXYZD Fr al F F M m aa uyp ROM Size 5022 bytes size of GUI_Font24B_
148. I c GUI_Font8x16 Cr uum e 0123456789 2 TBABCDEF GHIJKLMNOPQRSTUUUXTYZI 1 abcdefghijklm nopgrstuuuxuziltT 44 5 msn i 9423 7ygT 1 053555 T1 TBHNOOQU r P ROM Size 3304 bytes Used files F8x16 c GUI Font8x17 cum 0123456789 lt gt ABCDEF GHIJELHMHUPURSTUUUXYZ S 1 abcde fghi jk1m nopqgrstuuuxuztilt yda 9 2374 19255566 AnRECEEEE 1 T1T9NOOO r P User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation ROM Size This font uses the same ROM location as GUI Font8x16 Used files F8x16 c GUI Font8x18 cum 70123456789 lt gt ABCDEF GHIJKLMN PURSTUUUXYZI 1 abcdefghi nopqgrstuuuxuztilli 444 ittri m3 n 9 2374 1 9255351668 nRECEEEE I T1T9NOOQU DOxBUOOLiPbRa aaarce egiiir na on ROM Size This font uses the same ROM location as GUI Font8x16 Used files F8x16 c GUI Font8x16x1x2 xt 0123456789 CYTRABCDET GHIJKLMNOPQRSTUVUNYZIN I abcdefghi jkln nopqrstuvuxyz tT 886 2 Pp 1 111990000 fa dida Eee 1 11 18000000 Ul l User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation 372 CHAPTER 25 Stand
149. II and ShiftJIS characters ck k x K ck ckck ck k ck ck ck ck ck ck ck ck ck ck ck k ck ck ck ck ck ck x x lt k ck ck KKK ck ck ck ck ck ck ck ck ck x ck ck ck ck ck x ck ck ck k ck lt k kk kk 7 static const char aSJIS ABC x83 x50 x83 x51 x83 x52 x0 RK HK IK kk k k k K kk kk k K K K K K K K K K SK K K K K K K KOK KOK KOK K K K KOK A Demonstrates output of ShiftJIS characters CK Ck k K k k k kk x k Ck x K k k k kk K k k x x x K x kk Ck CK Sk kk Sk x x kk x K x k kk lt x K KKK KKK KK KKK A void DemoShiftJIS void GUI SetFont amp GUI Fontl13HB 1 GUI DispStringHCenterAt uC GUI sample ShiftJIS characters 160 0 Set ShiftJIS font GUI SetFont amp GUI FontSJIS13 Display string GUI DispStringHCenterAt aSJIS 160 40 RK KK IK IK I RR K K K K K K K K K K K KOK K kc k k ck k ck kck k ck KOK KOK K K KOK ok T main Ck k k k k x K k k k kk kk Kk K K k Ck x x k Sk Ck K k x Ck x k K k k x K x k Kk Sk KKK KKK KKK ko ko KKK KK pa void main void GUI Init DemoShiftJIS while 1 GUI Delay 100 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 265 Screen shot for preceeding example HC GUI sample UNICODE characters User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation 266 CHAPTER 17 Shift JIS Support User s amp reference manual for uC GUI 20
150. K IK IK kk kk K K K k K K K K K kkk K k k K KOK K K K SK K K K K K K K K KOK k Ck k ck k ck k ck kk k ck KOK KOK KOK x main CK Ck CK Ck k k k Ck Kk Ck Ck x x k kk Sk K x k Ck K x kk Ck Kk kk Sk lt x kk Sk K x k kk Sk x x k k KKK KKK KKK n void main void GUI_Init DemoRedraw User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 169 Chapter 13 Window Objects Widgets Widgets are windows with object type properties they are called controls in the win dows world and make up the elements of the user interface They can react automat ically to certain events for example a button can appear in a different state if it is pressed Widgets need to be created have properties which may be changed at any time during their existence and are then typically deleted when they are no longer needed Just like a window a widget is referenced by a handle which is returned by its create function Widgets require the window manager Once a widget is created it is treated just like any other window the WM ensures that it is properly displayed and redrawn when ever necessary Widgets are not required when writing an application or a user inter face but they can make programming much easier User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 170 CHAPTER 13 Window Objects Widgets 13 1 Some basics Available widgets The following HC GUI widget
151. K KOK KOK ke K KOK K K K Micrium Inc Empowering embedded systems i uC GUI sample code ck ck ck k k k k k k k lt ck ck k k k k ck ck k k K lt k k k K k k k K K k k k k ck ko lt k k k lt K k k k lt lt ko File DIALOG_MessageBox c Purpose Example demonstrating GUI_MessageBox include GUI h BK IK HK k K CK K K AAA AAA KK SK K K K K K kk I KOK KOK KOK KOK K K KOK K User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 239 main ck Ck ck Ck ck k k k ck KK k k KKK ck Ck Sk KK KKK KKK KKK KKK ck kk x x k kk ck kk k k x kk Sk kk ko kk lt x x lt ko KKK KKK KK void main void GUI_Init WM SetBkWindowColor GUI RED Create message box and wait until it is closed GUI MessageBox This text is shown nin a message box Caption Title GUI MESSAGEBOX CF MOVEABLE Wait for a short moment GUI Delay 500 GUI MessageBox New message Caption Title GUI MESSAGEBOX MOVEABLE Screen shot of above example Caption Title This text is shown in a message box User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 240 CHAPTER 14 Dialogs User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 241 Chapter 15 Antialiasing Lines are approximated b
152. K KOK kkk kkk k kkk kkk ck KOK KOK KOK KOK KOK KOK Demonstrates LISTBOX widget KKKKK KKK KKK ck k k k lt lt lt ckckckckck KKK k x lt lt lt x lt k lt lt lt k k ckckck ckckck k lt lt lt ck x k lt ck ck ck ck k KKK static void DemoListbox void GUI SetBkColor GUI BLUE GUI Clear while 1 DemoListBox KK IK IK kk I k K K K K K K K K KOK KOK KOK KOK KOK k k k k A A A KOK KOK KOK KOK A k ck KOK K K KOK KOK KOK KOK KOK e K main KKKKKKKKKKKKK k kk K x kk Ck kk kk lt K lt kk K x kk ke lt K k x kk lt K K lt x x K K k x KKK KKK KKK void main void GUI Init DemoListbox Screen shot of above example rancals aparnese Italiana Using the LISTBOX widget with and without frames The following example illustrates the use of the LISTBOX widget with and without a frame window It is available as WIDGET ListBox c EEKE KKK Kk kkk K K K K K K K K KOK CK KOK K K KC K KOK K KOK KOK A A A K K A A KOK K K KOK KOK ke ke ke ke ke e ke Micrium Inc Empowering embedded systems uC GUI sample code i KKK k k k k K K KKK KKK KKK KK KKK KKK KK KK k k K lt K K KKK KKK k kk K k k KKK ko kc File WIDGET ListBox c Purpose Example demonstrating the LISTBOX widget User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 208 CH
153. KKK Data User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 253 Ck Ck ck ck ck k k k ck kk ck kk k Sk ck Ck x k k x ck kk x k x kk ck Ck x k kk x x k k x ck kk x k x kk K x x kk KKK KKK KK KKK x lt lt lt Z define countof Obj sizeof Obj sizeof Obj 0 static const GUI POINT aPointer 0 3 85 1 90 0 85 1 0 3 static GUI POINT aPointerHiRes countof aPointer typedef struct GUI AUTODEV INFO AutoInfo GUI POINT aPoints countof aPointer int Factor PARAM KK IK IK I kk kk K K K K K K K KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK k Ck kc k k ck kckck ckok KOK KOK ke kx Drawing routines k k K x k x k ck ck ck ck ck ck k ck K k Ck Ck k Ck Ck k Ck Ck k CK K CK KKK k x K k x x k x K x x lt k x x K k x lt k x K x lt x k lt lt x x 27 static void DrawHiRes void p 1 PARAM pParam PARAM p if pParam AutoInfo DrawFixed GUI ClearRect 0 0 99 99 GUI_AA_FillPolygon pParam gt aPoints countof aPointer 5 pParam gt Factor 95 pParam gt Factor static void Draw void p PARAM pParam PARAM p if pParam AutoInfo DrawFixed GUI ClearRect 100 0 199 99 GUI AA FillPolygon pParam aPoints countof aPointer 105 95 J KCKCKCKCKCkCk IK K K K K K K K K KOK K K KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK k ck k ck k ck KOK K
154. M NOPORSTUSAMR Y ZI abcdefghilklmnoparetuvwx y z manual for uC GUI 2002 Micrium Technologies Corporation 355 ROM Size 2714 bytes Used files F16 ASCII c GUI Fonti6 1 rum m 2555 8 M01 25456709 lt gt GAB COEF GHIJKLM NOPORSTUSAMRY abedefghikimnoparstuvvnyz SPB 222 09 15 PAR ROM Size 3850 bytes size of GUI Fonti16 ASCII Used files F16 1 c F16 ASCII c GUI Font16 HK HAW AF22R RPMS lt Hi Z gt Chhati UIO Be Zate 5 b g SP p Vp 5 10 amp 1 P A 7 T A 4 52 u T q s 2 Z Fa Papil x et Y EEUU a AS ap Was SF 1 1 E ROM Size 6950 bytes Used files F16 HK c User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 356 GUI Font16 CHAPTER 25 1HK cr eum 25958 I 0123456789 gt NOPORSTUSANR Y ZR abc delghijkimnopqrstuworyz g as EB oe EIIPNOOOOO GUUUUY pRadddadaecedeaiiis adda s jpg amp 45 v bs 52222 T 4 TSS LEP Pere Tim k Standard Fonts ROM Size WIS cM PICS HE mu UU 1 yGata FAS oe Pees FF PS 2 ge OSE
155. Number of pixels to move text in vertical direction Positive number will move text down Additionnal information The values move the text the specified number of pixels within the widget Normally the default of 0 0 should be sufficient PROGBAR_SetValue Description Sets the value of the progress bar Prototype void PROGBAR SetValue PROGBAR Handle hObj int v Parameter Meaning hObj Handle of progress bar x Value to set Additionnal information The bar indicator will be calculated with regard to the max min values If a percent age is automatically displayed the percentage will also be calculated using the given min max values as follows p 100 v Min Max Min The default value after creation of the widget is O Examples Using the PROGBAR widget The following simple example demonstrates the use of the PROGBAR widget It is available in the samples as WIDGET SimpleProgbar c AEKk kkk k k k K K Ck K K K K K K K K K K K k K k K k k k K k K KOK SK IR A RA A KOK Ck kk KOK kk kk ke ke ke ke e ke e k Micrium Inc Empowering embedded systems uC GUI sample code kk k Ck k k k ck Ck Sk k k k KK KKK KK KKK k k k KK KKK KKK lt x k x kk kk k k k KKK x kk kk Sk kk x x lt lt lt kc x lt x KKK File WIDGET_SimpleProgbar c Purpose Demonstrates the use of the PROGBAR widget User s amp reference manual for HC GUI 2002 Micri
156. OK Ck ck k ck K K KOK KOK KOK KOK KOK ke kx is Scale bitmap KCKCkCKk kk k k kk Kk k lt Ck x x K x Ck Ck x Ck Ck x x k Kk Ck k Sk Sk Kk kk lt K x kk Sk x x KKK KKK KK KKK ua static const GUI COLOR ColorsScaleR140 0x000000 0x00AA00 0xFFFFFF 0x0000A4A OxOOFF00 0xAEAEAE 0x737373 0xD3D3D3 OxDFDFDF OxBBDFBB 0x6161DF 0x61DF61 OxBBBBDF 0xC7C7C7 0x616193 ll static const GUI LOGPALETTE PalScaleR140 15 number of entries 0 No transparency amp ColorsScaleR140 0 ll 2 static const unsigned char acScaleR140 The pixel data is not shown in the manual Please take a look at the sample source file static const GUI BITMAP bmScaleR140 200 XSize YSize 100 BytesPerLine 4 BitsPerPixel acScaleR140 Pointer to picture data indices amp PalScaleR140 Pointer to palette KK IK IK KI I A I I KOK KOK KOK KOK KOK KOK A k Ck kc k k ck KOK KOK KOK KOK KOK ke kx Shape of polygon Ck Ck ck Ck ck ck k k ck kk k Ck k k KKK KKK KKK KKK KKK KKK ck K lt x x k k lt ck kk k k x lt kk kk kk lt Ck x KKK KKK KK KKK define MAG 3 static const GUI POINT aNeedle MAG 0 MAG O 125 MAG 3 MAG 15 125 MAG 3 MAG 65 125 MAG 3 MAG 65 125 MAG 3 MAG 15 125 AA kkkkkkkkkkkkkkkkkkkk kkk kkk kkk kk
157. OK KOK KOK ok ke ke kx Demonstrate high resolution by drawing rotating pointers ck ck K ck Ck k k k ck Ck ck KC k Ck ck KKK k ck ck Ck ck k k ck koc ck k ck kk ck k k ck lt x ck ck ck x ck x lt lt x lt lt ck ko ck ko lt lt K lt x kx x ko ko x static void ShowHiresAntialiasing void ant GUI AUTODEV aAuto 2 PARAM Param Param Factor 3 GUI DispStringHCenterAt Using nhigh nresolution nmode 50 120 GUI DispStringHCenterAt Not using nhigh nresolution nmode 150 120 Create GUI AUTODEV objects for i 0 i lt countof aAuto i GUI MEMDEV CreateAuto amp aAuto il Calculate pointer for high resolution for i 0 i lt countof aPointer i aPointerHiRes i x aPointer i x Param Factor aPointerHiRes i y aPointer i y Param Factor GUI_AA_SetFactor Param Factor Set antialiasing factor while 1 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 254 CHAPTER 15 Antialiasing for i 0 i lt 1800 i float Angle i gt 900 1800 i i Angle 3 1415926f 1800 Draw pointer with high resolution GUI AA EnableHiRes GUI RotatePolygon Param aPoints aPointerHiRes countof aPointer GUI MEMDEV DrawAuto amp aAuto 0 amp Param AutoInfo DrawHiRes amp Param Draw pointer without high resolution GUI AA DisableHiRes GUI RotatePolygon Param aPoints aPointe
158. OLORO DEFAULT 0 0 0 0 Background color N SLIDER COLORO DEFAULT 0 0 0 0 Slider thumb color B SLIDER USE 3D 1 Enable 3D support SLIDER API The table below lists the available pnC GUI SLIDER related routines in alphabetical order Detailed descriptions of the routines follow Routine Explanation SLIDER Create Create the slider SLIDER CreateIndirect Create the slider from resource table entry SLIDER Dec Decrement the value of the slider bar SLIDER GetValue Return the current value of the slider bar SLIDER Ins Increment the value of the slider bar SLIDER SetRange Set the range of the slider value SLIDER SetValue Set the current value of the slider bar SLIDER SetWidth Set the width of the slider bar SLIDER Create Description Creates a SLIDER widget of a specified size at a specified location Prototype SLIDER Handle SLIDER Create int x0 int xsize int ysize WM HWIN hParent int Id int SpecialFlags int int WinFlags Parameter Meaning x0 Leftmost pixel of the slider in desktop coordinates 0 Topmost pixel of the slider in desktop coordinates xsize Horizontal size of the slider in pixels ysize Vertical size of the slider in pixels hParent Handle of the parent window Tal Id to be returned Window create flags Typically WM SHOW in order to make the widget visi
159. OX CreateAsChild Description Creates a LISTBOX widget as a child window Prototype LISTBOX Handle LISTBOX CreateAsChild const GUI ConstString ppText HBWIN hWinParent int x0 int 0 int xSize int ySize int Flags Parameter Meaning ppText Pointer to an array of string pointers containing the elements to be displayed hWinParent Handle of parent window x0 X position of the list box relative to the parent window yo Y position of the list box relative to the parent window xSize X size of the list box ySize Y size of the list box Flags Window create flags see LISTBOX Create Return value Handle for the created LISTBOX widget O if the routine fails Additionnal information If the parameter ysize is greater than the space required for drawing the contents of the widget the Y size will be reduced to the required value If ysize O the Y size of the widget will be set to the Y size of the client area from the parent window The same applies for the xsize parameter LISTBOX Createlndirect Prototype explained at the beginning of the chapter The elements Flags and Para of the resource passed as parameter are not used User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 204 CHAPTER 13 Window Objects Widgets LISTBOX DecSel Description Decrement the list box selection moves the selection bar of a specified list box up by one element
160. PS_FLAT UI Clear 1 10 x2 90 Draw lines without antialiasing UI DispStringHCenterAt nNormal 1 x2 2 10 for ty dpa OLDER aed GUI_SetPenSize i GUI DrawLine xl 40 i 15 2 40 i 15 y Gy G3 Gy s paz has xl 110 x2 190 Draw lines with antialiasing quality faktor 2 GUI AA SetFactor 2 GUI_DispStringHCenterAt Antialiased n nusing factor 2 xl x2 2 10 for quoc hp a ow RE2 GEN d GUI SetPenSize i GUI AA DrawLine xl 40 15 x2 40 i 15 y xl 210 x2 290 Draw lines with antialiasing quality faktor 6 GUI AA SetFactor 6 GUI_DispStringHCenterAt Antialiased n nusing factor 6 1 x2 2 10 for rdg Pee H GUI SetPenSize i GUI AA DrawLine xl 40 15 x2 40 i 15 y RK IK IK k k K k K K k k K k K k K K K K K K TK K SK SK A A A A A A A K K K K K K KOK KOK KOK I KOK KKK main CK k CK K k k k Ck x k k Ck x K k k k kk K K k Ck x k Kk x lt K k x Sk Kk K K x kk Sk Sk Sk Kk x lt x k k x lt lt x KKK KKK User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 251 void main void GUI_Init DemoAntialiasing while 1 GUI Delay 100 Screen shot for preceeding example Hntialiazed Hntialiazed Hormal using factor 2 III Lines placed on high resolution coordinates This example shows antialiased lines placed on
161. QAAQNQAQAQA User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 82 CHAPTER 6 2 D Graphic Library Screen shot for preceeding example User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 83 Chapter 7 Fonts uC GUIThe most common fonts are shipped with uwC GUI as standard fonts In fact you will probably find that these fonts are fully sufficient for your application For detailed information on the individual fonts please see Chapter 25 Standard Fonts which describes all fonts included with uC GUI and shows all characters as they appear on the display HC GUI supports ASCII ISO 8859 1 and Unicode Usually uC GUI is compiled for 8 bit characters allowing for a maximum of 256 different character codes out of which the first 32 are reserved as control characters The characters that are available depends on the selected font User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 84 CHAPTER 7 Fonts 7 1 Available fonts The current version of uC GUI supports 4 types of fonts monospaced bitmap fonts proportional bitmap fonts proportional bitmap fonts with 2 bpp built in antialiasing information and antialiased fonts with 4 bpp built in antialiasing information For more information on antialiased fonts see Chapter 15 Antialiasing All fonts linked with your application and declared in GUIConf h may b
162. StringAt GUI DispSFloatFix n 0 40 GUI DispSFloatFix 9 2 GUI_GotoxX 100 GUI_DispSFloatFix f 9 2 GUI DispStringAt GUI_DispFloatMin n 0 60 GUI_DispFloatMin f 3 GUI_GotoxX 100 GUI_DispFloatMin f 3 GUI DispStringAt GUI_DispSFloatMin n 0 80 GUI_DispSFloatMin f 3 GUI_GotoxX 100 GUI_DispSFloatMin f 3 GUI_SetFont amp GUI_Font6x8 GUI_DispStringAt Press any key 0 GUI_VYSIZE 8 WaitKey Screen shot of above example GUI DizpFloat 123 45678 1232 4568 GUI Dis p loath in ooo 11253 00 123 46 Diz risus 00 123 46 00 123 46 GUL DizrpFloatMin 3 457 123 457 GUI Dis 4123 45 23 457 GUI DispFloatFix Description Displays a floating point value with specified number of total characters and a speci fied number of characters to the right of the decimal point at the current text posi tion in the current window using the current font User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 58 CHAPTER 5 Displaying Values Prototype void GUI DispFloatFix float v char Len char Decs Parameter Meaning Value to display ii Minimum 1 2 E 38 maximum 3 4 E38 Len No of digits to display max 9 Decs No of digits to show to right of decimal point Additionnal information Leading zeros are not suppressed If the value is negative a minus sign is shown GUI Dis
163. TER 14 Dialogs 14 5 Message boxes A message box is actually a type of dialog which once its default properties are specifed requires only one line of code to create A message is displayed in a frame window with a title bar as well as an OK button which must be pressed in order to close the window GUI MessageBox Description Creates and displays a message box Prototype void GUI MessageBox const char sMessage const char sCaption int Flags Parameter Meaning sMessage Message to display sCaption Caption for the title bar of the frame window Flags Reserved for future extensions value does not matter Additionnal information The default properties of a message box can be changed by modifying them in the GUIConf h file The following table lists all available configuration macros Type Macro Default Explanation N MESSAGEBOX BORDER 4 Distance between the elements of a message box and the elements of the client window frame N MESSAGEBOX XSIZEOK 50 X size of the OK button MESSAGEBOX YSIZEOK 20 Y size of the OK button S MESSAGEBOX BKCOLOR GUI WHITE Color of the client window background It is possible to display messages with more than one row The example below shows how to do this Example The following example demonstrates the use of a simple message box RK IK IK k k IR kk kk KC kk K K Ck K K K K K SK K K K K K K I K K KO
164. TEXT SetDefaultFont Description Sets the default font used for text widgets Prototype void TEXT SetDefaultFont const GUI FONT pFont Parameter Meaning pFont Pointer to the font to be set as default TEXT SetFont Description Sets the font to be used for a specified text widget Prototype void TEXT SetFont TEXT Handle hObj const GUI FONT pFont Parameter Meaning hObj Handle of text widget pFont Pointer to the font to be used User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 230 CHAPTER 13 Window Objects Widgets TEXT SetText Description Sets the text to be used for a specified text widget Prototype void TEXT SetText TEXT Handle hObj const char s Parameter Meaning hObj Handle of text widget S Text to be displayed TEXT SetTextAlign Description Sets the text alignment of a specified text widget Prototype void TEXT SetTextAlign TEXT Handle hObj int Align Parameter Meaning BOLJ Handle of text widget Align Text alignment see TEXT_Create TEXT SetTextPos Description Sets the position of the text in a specified text widget Prototype void TEXT SetTextPos TEXT Handle hObj int XOff int YOff Parameter Meaning hObj Handle of text widget XOff X distance to offset text from origin of widget Y distance to offset text from origin of w
165. TEXT related routines are located in the file s TEXT c TEXT h All identifiers are prefixed TEXT User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 228 CHAPTER 13 Window Objects Widgets Configuration options Type Macro Default Explanation S TEXT FONT DEFAULT amp GUI Font13 1 Font used TEXT API The table below lists the available wC GUI TEXT related routines in alphabetical order Detailed descriptions of the routines follow Routine Explanation TEXT Create Create the text TEXT CreateIndirect Create the text from resource table entry TEXT GetDefaultFont Return the default font used for text TEXT SetDefaultFont Set the default font used for text TEXT SetFont Set the font used for a specified text widget TEXT SetText Set the text for a specified text widget TEXT SetTextAlign Set the text alignment of a specified text widget TEXT SetTextPos Set the position of the text in a specified text widget TEXT Create Description Creates a TEXT widget of a specified size at a specified location Prototype TEXT Handle TEXT Create int x0 int y0 int xsize int ysize int Id int Flags const char s int Align Parameter Meaning x0 Leftmost pixel of the slider in desktop coordinates 0 Topmost pixel of the slider in desktop coordinat
166. TTON widget include gui h include button h KK IK IK kk kk kk K K K K K K K KOK KOK K K K K K K K K K K KOK KOK A A A A A A Kk Ck KOK ko ke ke ke ke e eoe ke Bitmap data 2 phone logos KCKCkCk x k k k x ck lt x k k k lt x kc x k ck ck ko x k k x x lt lt K K k k x lt K x k lt lt x ck k k x lt ck ck ck K ck ck k ck ck ck ck ck lt KK KKK ck kk static const GUI COLOR Colors 0x000000 OxFFFFFF Jj static const GUI LOGPALETTE Palette l Colors static const unsigned char acPhoneO AD gt GM gt GM gt GM User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation 180 CHAPTER 13 NN GM gt GM gt gt GM f XXX XXXXXXXX XXXXXXXX XXX 2 XXXXX XXXXXXXX XXXXXXXX XXXXX _ XXXXXX XXXXXXXX XXXXXXXX XXXXXX _XXXXXXX X X XXXXXXX OXXXXXXX X XX XX X XXXXXXX OXXXXXXX X XX XX X XXXXXXX OXXXXXXX X XX XX X XXXXXXX XX XX X XXXXXXXX XXXXXXXX X XX XXXXXXXX XXXXXXXX XXX XXXX X X XXXX XXX XXXX XXXX X_ X XXXX XXXX __ XXXXXXXX XXXXXXXX __ 00 XXXXX XXXX X XXXX XXXXX 22 XXXXX XXXX X X XXXX XXXXX 2 XXXXX XXXXXXXX XXXXXXXX XXXXX 00 XXXXX XXXX X X XXXX XXXXX 0 XXXXX XXXX X X XXXX XXXX
167. UI MOUSE DRIVER PS2 Init void GUI MOUSE DRIVER PS2 OnRx Description Must be called from receive interrupt routines Prototype void GUI MOUSE DRIVER PS2 OnRx unsigned char Data Parameter Meaning Data Byte of data received by ISR Additional information The PS2 mouse driver is a serial driver meaning it receives 1 byte at a time You need to ensure that this function is called from your receive interrupt routine every time a byte 1 character is received 18 1 2 Touch screen driver input and configuration Touch screen support also consists of a generic layer and a driver layer Generic rou tines can be used with any type of driver analog digital etc The available driver routines will call the appropriate generic routines as necessary and may only be used with the analog touch screen driver supplied with uC GUI As with mouse support if you write your own driver it is responsible for calling the generic routines The generic mouse routines will call the corresponding PID routines The driver layer also includes a configuration module which may require modifica tions User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 271 Generic touch screen API The table below lists the generic touch screen routines in alphabetical order These functions may be used with any type of touch screen driver Detailed descriptions fol
168. WHITE GUI SetTextMode GUI TM NORMAL GUI DispStringHCenterAt GUI TM NORMAL LOO 10 GUI SetTextMode GUI TM REV GUI DispStringHCenterAt GUI TM REV 160 26 GUI SetTextMode GUI TM TRANS GUI DispStringHCenterAt GUI TM TRANS 160 42 GUI SetTextMode GUI TM XOR GUI DispStringHCenterAt GUI TM XOR 7 260 Se 4 GUI_SetTextMode GUI_TM_TRANS GUI_TM_REV GUI_DispStringHCenterAt GUI_TM_TRANS GUI_TM_REV 160 74 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 46 CHAPTER 4 Displaying Text Screen shot of above example GUI TM H RHAL GUI TM GUI SetTextMode Description Sets the text mode to the parameter specified Prototype int GUI SetTextMode int TextMode Parameter Meaning TextMode Text mode to set May be any combination of the TEXTMODE flags Permitted values for parameter TextMode OR combinable Y _ Sets normal text This is the default setting SUIT eT Ove NORMAL the value is identical to 0 GUI TEXTMODE REVERSE Sets reverse text GUI TEXTMODE TRANSPARENT Sets transparent text GUI TEXTMODE XOR Text will be inverted on the display Return value The selected text mode Example Shows The value is at position 0 0 on the display shows a value in reverse text then sets the text mode back to normal int i 20 GUI DispStringAt The v
169. X 22 XXXXX XXXXXXXX XXXXXXXX XXXXX _ XXXXX XXXXXXXX XXXXXXXX XXXXX static const unsigned char acPhonel XX X XXXX XXXXX XXXX XXXXXXX_ XXXXX XXXXXXXX X I XXXXX XXXXXXXX XXX XXX XXXX XXX XXXXX X XXXX XXXXXXX I _XXXXXXX X N XXXXX XXX XXX XXXXX X XXXXXX_ XXXXXXX_ XXXXXXX X XXXXXXXX X XXXXXXXX 2 XX OXXXXXXX XX XX XXXX XX XX XX XX X XXXXXXXX XXXXXXXX X XX XXXXXXXX XXXXXXXX XX XXX XXXX X X XXXX XXX XXXX XXXX X _ __ XXXX I XXXXX XXXXXXXX XXXXXXXX XXXXX 22 XXXXX XXXX X X XXXX XXXXX XXXXX XXXX X X XXXX XXXXX XXXXX XXXXXXXX XXXXXXXX XXXXX XXXXX XXXX X X XXXX XXXXX XXXXX XXXX X X XXXX XXXXX XXXXX XXXXXXXX XXXXXXXX XXXXX XXXXX XXXXXXXX XXXXXXXX XXXXX static const GUI BITMAP bm 1 0 32 static const GUI BITMAP bm_lbpp_1l 32 Window Objects Widgets 31 4 1 0 amp Palette 31 4 1 acPhonel amp Palette RK IK IK kk A K K K K k k k k K K K K K K K K K K kc k k ck k ck k ck k ck KOK KOK K ck ck ck ok Demonstrates the use of a BUTTON widget ck Ck k k k k ck lt lt Ck k K ck ck Ck x k k k KKK KKK KKK C
170. X routine reference When using uC GUI with your hardware there are several hardware dependent func tions which must exist in your project When using the simulation the library already contains them A sample file can be found under Sample GUI_X GUI_X c The follow ing table lists the available hardware dependent functions in alphabetical order within their respective categories Detailed description of the routines can be found in the sections that follow Routine Explanation Init routine GUI X Init Called from GUI Init can be used to initialize hardware Timing routines GUI X Delay Return after a given period GUI X ExecIdle Called only from non blocking functions of window manager GUI X GetTime Return the system time in milliseconds Kernel interface routines Initialize the kernel interface module create a resource semaphore GUI X Initos mutex GUI X GetTaskId Return a unique 32 bit identifier for the current task thread GUI X Lock Lock the GUI block resource semaphore mutex User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 306 CHAPTER 21 High Level Configuration Routine Explanation GUI X Unlockt Unlock the GUI unblock resource semaphore mutex Debugging GUI X Log Return debug information required if logging is enabled 21 3 Init routine GUI X Init Description Called fr
171. XXX static const unsigned char acFontUC13 0043 13 code 0043 XX X y X XX 7 5 X X X X y Start of unicode area lt Hiragana gt static const unsigned char acFontUC13 3060 26 code 3060 XX xX xX xX X XXX XXXX X XX XXX 5 X LX X X X X X 2 X xx XXX static const unsigned char acFontUC13_3061 26 code 3061 XX X X XXXX XX 7 XXXX 7 X X XXX X XXX LX X X User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 259 static const unsigned char acFontUC13_3062 26 code 3062 XX FAA X X XXXX X T XXXX 7 X X X LX X X X X ____ static const GUI CHARINFO GUI FontUC13 CharInfo 6 T5 d 1 void amp acFontUC13 0041 code 0041 ras 75 Jd 1 void amp acFontUC13 0042 code 0042 1 T 7 1 void amp acFontUC13 0043 code 0043 14 14 2 void amp acFontUC13 3060 code 3060 qu 14 2 void amp acFontUC13 3061 code 3061 pte 4 14 2 void amp acFontUC13 3062 code 3062 static const GUI_FONT_PROP GUI_FontUC13_Prop2 0x3060 first character
172. Y posi Color configuration Maximum number of logical colors that the N LOD NAK LOC COLORS 295 driver can support bitmap Defines the contents of the color lookup table A LCD PHYSCOLORS zu Only required if LCD FIXEDPALETTE is set to 0 Only relevant if physical colors are defined B LCD PHYSCOLORS IN RAM 0 Puts physical colors in RAM making them mod ifiable at run tiime B REVERSE 0 Activate to invert the display at compile time B LCD SWAP RB 0 Activate to swap the red and blue components Magnifying the LCD N LCD lt gt 1 Horizontal magnification factor of LCD N LCD_YMAG lt n gt 1 Vertical magnification factor of LCD Simple bus interface configuration F CD READ A0 Result Basa a byte from LCD controller with A line F CD READ 1 Result P Roh a byte from LCD controller with A line LCD WRITE AO0 Byte Write a byte to LCD controller with A line low LCD WRITE 1 Byte Write byte to LCD controller with A line high a Write multiple bytes to LCD controller with A F LCD WRITEM A1 line high User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 283 Type Macro Default Explanation Full bus interface configuration F READ MEM Index P aue the contents of video memory of control F CD READ REG Index i Read the contents
173. a lowercase a have different ASCII codes 0x41 and 0x61 respectively uC GUI predefined character codes HC GUI also defines character codes for other virtual keyboard operations These codes are listed the table below and defined an identifier table in GuI h A char acter code in p C GUI can therefore be any extended ASCII character value or any of the following predefined p C GUI values Predefined virtual key code Description GUI KEY BACKSPACE Backspace key GUI KEY TAB Tab key GUI KEY ENTER Enter return key Left arrow key Up arrow key Right arrow key GUI KEY DOW Down arrow key GUI KEY HOME Home key move to beginning of current line GUI KEY END End key move to end of current line GUI KEY SHIFT Shift key GUI KEY CONTROL Control key GUI KEY ESCAPE Escape key GUI KEY INSERT Insert key GUI KEY DELETE Delete key 18 2 1 Driver layer API The keyboard driver layer handles keyboard messaging functions These routines notify the window manager when specific keys or combinations of keys have been pressed or released User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 275 The table below lists the driver layer keyboard routines in alphabetical order Detailed descriptions follow
174. a of the available colors this mode con tains the best choice for general purpose applica tions Six levels of intensity are available for each color in addition to 16 grayscales Number of available colors 6x 6 x 6 16 232 9 4 Custom palette modes HC GUI can handle a custom hardware palette A custom palette simply lists all the available colors in the same order as they are used by the hardware This means that no matter what colors your LCD controller display combination is able to display uC GUI will be able to simulate them in the PC simulation and handle these colors cor rectly in your target system in order to define a custom palette you should do so in the configuration file LCD Cont h Example The following example part of LcDConf h would define a custom palette with 4 col ors all of which are shades of gray define LCD FIXEDPALETTE 0 define LCD PHYSCOLORS Oxffffff Oxaaaaaa 0x555555 0x000000 9 5 Modifying the color lookup table at run time The color information at each pixel is stored either in RGB mode in which the red green and blue components are kept for each pixel or in color index mode in which a single number called the color index is stored for each pixel Each color index cor responds to an entry in a lookup table or color map that defines a specific set of R G and B values If your LCD controller features a color lookup table LUT it is properly initialized by
175. a single task system The default configuration which does not support multitasking define GUI MT 0 can be used kernel interface routines are not required You can use any real time kernel commercial or proprietary un C GUI 11 4 nC GUIMultitask system multiple tasks calling uC GUI Description A real time kernel RTOS is used The user program is split into different parts which execute in different tasks with typically different priorities Normally the real time critical tasks which require a cretain reaction time will have the highest priori ties Multiple tasks are used for the user interface calling HC GUI functions These tasks typically have low priorities in the system so they do not affect the real time behaviour of the system Interrupts can but do not have to be used for real time parts of the software Advantages The real time behavior of the system is excellent The real time behavior of a task is affected only by tasks runnig at higher priority This means that changes of a pro gram component running in a low priority task do not affect the real time behavior at all If the user interface is executed from a low priority task this means that changes on the user interface do not affect the real time behavior This kind of system makes it easy to assign different components of the software to different members of the development team which can work to a high degree independently from each other Disadvantag
176. al for uC GUI 2002 Micrium Technologies Corporation 248 CHAPTER 15 Antialiasing void Sample void GUI AA DrawPolyOutline aPoints countof aPoints 3 150 40 Screen shot for preceeding example GUI AA FillCircle Description Displays a filled antialiased circle at a specified position in the current window Prototype void GUI AA FillCircle int x0 int y0 int Parameter Meaning x0 X position of the center of the circle in pixels of the client window y0 Y position of the center of the circle in pixels of the client window Radius of the circle half of the diameter Minimum 0 will result in a point Maximum 180 Additional Information If working in high resolution mode the coordinates must be in high resolution coor dinates Otherwise they must be specified in pixels GUI AA FillPolygon Description Fills an antialiased polygon defined by a list of points at a specified position in the current window Prototype void GUI AA FillPolygon const GUI POINT pPoint int NumPoints int x int y Parameter Meaning pPoint Pointer to the polygon to display NumPoints Number of points specified in the list of points x X position of origin y Y position of origin Additional Information The polyline drawn is automatically closed by connecting the endpoint to the starting point The starting point must not be specified a second time as an endpoint Use
177. allback function dialog procedure hParent Handle of parent window 0 no parent window x0 X position of the dialog relative to parent window y0 Y position of the dialog relative to parent window GUI ExecDialogBox Description Creates a blocking dialog box Prototype int GUI ExecDialogBox const GUI WIDGET CREATE INFO paWidget int NumWidgets WM CALLBACK cb WM HWIN hParent int x0 int y0 Parameter Meaning paWidget Pointer to a resource table defining the widgets to be included in the dialog NumWidgets Total number of widgets included in the dialog cb Pointer to an application specific callback function dialog procedure hParent Handle of parent window 0 no parent window x0 X position of the dialog relative to parent window 0 Y position of the dialog relative to parent window GUI EndDialog Description Ends closes a dialog box Prototype void GUI EndDialog WM HWIN hDialog int Parameter Meaning hDialog Handle to dialog box 19 Value to be returned by GUI ExecDialogBox Return value Specifies the value to be returned to the calling thread from the function that created the dialog box typically only relevant with GUI ExecDialogBox With non blocking dialogs there is no application thread waiting and the return value is ignored User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 238 CHAP
178. alue is GUI Set 71 GUI DispDec 20 3 GUI Set 71 0 r extMode GUI EXTMODE RSE r extMode GUI EXTMODE NOR 0 4 5 Selecting text alignment GUI GetTextAlign Description Returns the current text alignment mode Prototype int GUI GetTextAlign void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 47 GUI SetLBorder Description Sets the left border for line feeds in the current window Prototype void GUI SetLBorder int x Parameter Meaning x New left border in pixels 0 is left border GUI_SetTextAlign Description Sets the text alignment mode for string output in the current window Prototype int GUI_SetTextAlign int TextAlign Parameter Meaning Text alignment mode to set May be a combination of a horizontal and a vertical alignment flag TextAlign Permitted values for parameter TextAlign horizontal and vertical flags are oR combinable Horizontal alignment GUI TA LEFT Align X position left default GUI TA HCENTER Center X position GUI TA RIGHT Align X position right default Vertical alignment GUI TA TOP Align Y position with top of characters default GUI TA VCENTER Center Y position GUI TA BOTTO Align Y position with bottom pixel line of font
179. ample below and will do nothing else Keep your real time tasks which determine the behavior of your system with respect to I O interface network etc seperate from tasks that call pu C GUI This will help to assure best real time performance If possible use only one task for your user interface This helps to keep the pro gram structure simple and simplifies debugging However this is not required and may not be suitable in some systems Example This excerpt shows the dedicated uC GUI update task It is taken from the example MT Multitasking which is included in the samples shipped with p C GUI KK IK IK kk kk k k K kk K K K K K K K K K K K K K K K K K KOK AA A A A A A kk kk KOK ke ko ke ke ke ke e ke ek GUI background processing This task does the background processing The main job is to update invalid windows but other things such as evaluating mouse or touch input may also be done void GUI Task void while 1 GUI Exec Do the background work Update windows etc GUI X ExecIdle Nothing left to do for the moment Idle processing pC GUI 11 5 GUI configuration macros for multitasking support The following table shows the configuration macros used for a multitask system with multiple tasks calling uC GUI Type Macro Default Explanation N B Define the maximum number of tasks from which p C GUI is called when multitasking su
180. andle x New X position y New Y position WM MoveWindow WM Description Moves a specified window by a certain distance Prototype void WM MoveWindow WM HWIN hWin int dx int dy Parameter Meaning hWin Window handle dx Horizontal distance to move dy Vertical distance to move Paint Description Draws or redraws a specified window immediately Prototype void WM Paint WM HWIN hWin Parameter Meaning hWin Window handle Additionnal information The window is redrawn reflecting all updates made since the last time it was drawn WM ResizeWindow Description Changes the size of a specified window Prototype void WM ResizeWindow WM HWIN hWin int XSize int YSize Parameter Meaning hWin Window handle XSize X size to change window to YSize Y size to change window to User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 158 CHAPTER 12 The Window Manager WM WM SelectWindow Description Sets the active window to be used for drawing operations Prototype WM HWIN WM SelectWindow WM HWIN hWin Parameter Meaning hWin Window handle Return value The selected window Example Sets a window with handle nwin2 to the active window sets the background color and then clears the window WM SelectWindow hWin2 GUI SetBkColor OxFF00 GUI Clear WM ShowWindow Descri
181. aning KeyIndex Index of hardkey 0 index of first key pfCallback Pointer to callback routine Return value Pointer to the previous callback routine Additionnal information The callback routine must have the following prototype Prototype typedef void SIM HARDKEY CB int KeyIndex int State Parameter Meaning KeyIndex Index of hardkey 0 index of first key S State of the specified hardkey see table below Permitted values for parameter state 0 Unpressed 1 Pressed SIM_HARDKEY_SetMode Description Sets the behavior for a specified hardkey Prototype int SIM_HARDKEY_SetMode unsigned int KeyIndex int Mode Parameter Meaning KeyIndex Index of hardkey 0 index of first key Mode Behavior mode see table below Permitted values for parameter Mode 0 Normal behavior default 1 Toggle behavior Additionnal information Normal default hardkey behavior means that a key is considered pressed only as long as the mouse button is held down on it When the mouse is released or moved off of the hardkey the key is considered unpressed With toggle behavior each click of the mouse toggles the state of a hardkey to pressed or unpressed That means if you click the mouse on a hardkey and it becomes pressed it will remain pressed until you click the mouse on it again User s amp reference manual for uC GUI 2002 Micrium Technolog
182. appropriate routines Consult the reference chapters later in this manual as they dis cuss the specific uC GUI functions and configuration macros that are available 2 8 The Hello world sample program A Hello world program has been used as a starting point for C programming since the early days because it is essentially the smallest program that can be written A Hello world program with p C GUI called HELLO c is shown below and is available as BASIC HelloWorld c in the sample shipped with pC GUI The whole purpose of the program is to write Hello world in the upper left corner of the display In order to be able to do this the hardware of the application the LCD and the GUI must first be initialized uC GUI is initialized by a call to GUI Init at the start of the program as described previously In this example we assume that the hardware of your application is already initialized The Hello world program looks as follows KKKKKKKKKKKK kk k Ck k x Ck k k Ck k x Ck k k Ck K k x K k k K k x K k K K k x x lt k K x k x K k K KK lt x x lt k x x x lt Micrium Inc u Empowering embedded systems uC GUI sample code CK k k x k K ck k k k lt lt k k k k x x k k k lt ck ck x K k ck ck ck ck k k lt lt ck ckckckckck ck ck ck ck ck ck kk ck ck ck ck ck ck ck KKK KKK KKK kk File BASIC HelloWorld c Purpose Simple demo drawing Hello world m include GUI
183. ard Fonts Measurement F 32 B 24 C 20 L 14 U 6 ROM Size This font uses the same ROM location as GUI Font8x16 Used files F8x16 c GUI Font8x16x2x2 e 7012 3456789 gt lt gt TRABCDE FGH LJKLANOPORS TUUUX YZI 1 abcdefghi jk Imnopqrstuuuxuztlt Not all characters are displayed The character set is the same as that of GUI Font8x16 Measurement F 32 B 24 C 20 L 14 U 6 ROM Size This font uses the same ROM location as GUI Font8x16 Used files F8x16 c tuu ues 01z2345b 83 lt gt IBRHBCDEF aH ILJELHH PORS Not all characters are displayed The character set is the same as that of GUI Font8x16 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 373 Measurement F 48 B 36 C 30 L 21U 9 ROM Size This font uses the same ROM location as GUI Font8x16 Used files F8x16 c GUI FontD24x32 F 32 p 32 0123456 99 ROM Size 1606 bytes Used files FD24x32 c GUI FontD32 F 32 32 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 374 CHAPTER 25 Standard Fonts 0123456 8 ROM Size Used files 1574 bytes FD32 c User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 375 Chapter 26 Questions and Answers Q I usea different LCD controller Can I still use uC GUI A Yes The hardware access is done in the
184. ary hardware solutions have the advantage of being inexpensive but the disad vantage of using up much of the available computation time Depending on the CPU this can be anything between 20 and almost 100 percent with slower CPUS it is really not possible at all This type of interface does not require a specific LCD driver because UC GUI simply places all the display data into the LCD cache You must write the hardware dependent portion that periodically transfers the data in the cache memory to your LCD Sample code for transferring the video image into the display is available in both C and optimized assembler for M16C and M16C 80 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 1 7 uData types Since C does not provide data types of fixed lengths which are identical on all plat forms uC GUI uses in most cases its own data types as shown in the table below Data type Definition Explanation I8 signed char 8 bit signed value U8 unsigned char 16 bit unsigned value I16 signed short 16 bit signed value U16 unsigned short 16 bit unsigned value I32 signed long 32 bit signed value U32 unsigned long 32 bit unsigned value I16P signed short 16 bit or more signed value U16P unsigned short 16 bit or more unsigned value For most 16 32 bit controllers the settings will work fine However if you have simi lar defines in other sections of your program you might
185. as recommended The procedure for creating a library is illustrated in the flow chart to the right The Makelib bat file first calls Prep bat to prepare the environment for the tool chain Then it calls cc bat for every file to be included in the library It does this as many times as necessary CC bat adds each object file to a list that will be used by 1ib bat When all files to be added to the library have been listed Makelib bat then calls lib bat which uses a librarian to put the listed object files into the actual library No All files in library lib bat File Explanation Makelib bat Main batch file No modification required Prep bat Called by Makelib bat to prepare environment for the tool chain to be used Called by Makelib bat for every file to be added to the library creates a list of these CC bat object files which will then be used in the next step by the librarian in the lib bat file lib bat Called by Makelib bat to put the object files listed by CC bat into a library The files as shipped assume that a Microsoft compiler is installed in its default loca tion If all batch files are copied to the root directory directly above GUI and no changes are made at all a simulation library will be generated for the n C GUI simu lation In order to create a target library however it will be necessary to modify Prep bat CC bat and lib bat User s amp reference manual for uC GUI
186. as transparency contains areas that are not redrawn with the rest of the window These areas operate as though the window behind shows through them In this case it is important that the window behind is redrawn before the win dow with transparency The WM automatically handles redrawal in the correct order Validation invalidation A valid window is a fully updated window which does not need redrawing An invalid window does not yet reflect all updates and therefore needs to be redrawn either completely or partially When changes are made that affect a particular win dow the WM marks that window as invalid The next time the window is redrawn either manually or by a callback routine it will be validated Z position bottom top Although a window is displayed on a two dimensional screen in terms of X and Y the WM also manages what is known as a Z position or depth coordinate a position in a virtual third dimension which determines its placement from background to fore ground Windows can therefore appear on top of or beneath one another Setting a window to the bottom will place it underneath all of its sibling windows if any setting it to the top will place it on top of its siblings When a window is cre ated it is set to the top by default if no create flag is specified 12 2 WM API The following table lists the available routines of the uC GUI window manager API All functions are listed in alphabetical order within t
187. ation Menge oreet ee puer de EE ep UR RI ETE RE E KE ETRAS 264 22 2 API reference hardware dependent functions 265 23 GD IDV IC SRM aa u SNS A E E Pasa aaa qas suu 269 23 1 Supported LCD controllers and respective drivers 270 23 2 Ker Sm EET 271 23 3 EE QM 273 23 4 EDITS OAT esata hissed EP EE DER 275 23 5 ECDT5EO5 ede une carted dca de AUD SSS nea das 276 23 6 LED TOK cp 278 23 7 42 EE 280 23 8 LIMEN cM E 281 23 9 ED MOM 55 dte oue ed xe da ssp dese er expe ay det ess 282 23110 ECDSLI nece rid e t e da reete el eb da e v eh de apana Z NO 284 24 LOD Driver AP Ie dread uQ Q Sas a dan fotu LO ean 285 24 1 API reference 2 1 4 44 7 2 94 44 42 11 111 286 24 2 Init amp display control group 22 EEE EERE EEE EEE te 287 24 3 Drawing group ned enacted ELE EANAN eee RE LEER ne 288 24 4 GEE roU Dere LEER 290 24 5 Lookup table LUT gFOUD uu yan aa a paa AN pi EEE ni nnns 291 24 6 Miscellaneous group irranga ree nr rene E RE E C ne I P 291 25 Performance and Resource Usage a 295 25 1 Performance benchmark viii eren ozone Ren ee en oh a x i ade a 296 25 2 Memory
188. ay BUTTON SetTextColor Description Sets the button text color Prototype void BUTTON SetTextColor BUTTON Handle hObj int Index GUI COLOR Color Parameter Meaning hObj Handle of button Index Index for text color see BUTTON SetBkColor Text color to be set Examples Using the BUTTON widget The following example demonstrates how to use two bitmaps to create a simple but ton It is available as WIDGET SimpleButton c in the samples shipped with pC GUI lt k k k K K kk kk kk kk kk KC K K AAA AIA AA AIA K K kk K K ko K I KOK KOK K ke koe K K Micrium Inc Empowering embedded systems uC GUI sample code ck ck ck k k k k k k ck ko ko ck k k k K x k k lt lt ko File WIDGET SimpleButton c Purpose Example demonstrating the use of a BUTTON widget include gui h include button h OK IK k k K K K I K K K K K K K K k K K K K k K K A AA AA AA A K K K I KOK KOK KOK KOK K K KOK KKK Demonstrates the use of a BUTTON widget CK Ck k K k k k ek k k ek K K k Ck kk K lt k Kk Sk Kk kk k kk kk K Kk kk Sk K k x x x x lt K k ko ko lt x KKK ko kk static void DemoButton void BUTTON Handle hButton int Key 0 GUI Init User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 179 UI SetFont amp GUI Font8x160 UI
189. ble WinFlags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values 20152 special creation flag see indirect creation flag under SLIDER CreateIndirect Return value Handle for the created SLIDER widget 0 if the routine fails User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 225 SLIDER Createlndirect Prototype explained at the beginning of the chapter The following flag may be used as the Flags element of the resource passed as parameter Permitted indirect creation flag SLIDER CF VERTICAL Create a vertical slider default is horizontal The Para element is not used in the resource table SLIDER Description Decrements the current value of the slider bar by one item Prototype void SLIDER Dec SLIDER Handle hObj Parameter Meaning hObj Handle of slider widget SLIDER GetValue Description Returns the curent value of the slider bar Prototype int SLIDER GetValue SLIDER Handle hObj Parameter Meaning hObj Handle of slider widget Return value The current value of the slider SLIDER Inc Description Increments the current value of the slider bar by one item Prototype void SLIDER Inc SLIDER Handle hObj Parameter Meaning hObj Handle of slider widget SLIDER SetRange Des
190. ble colors are the same as those in 323 mode The result is 8 grades for red and blue and 4 grades for green Number of available colors 8 x 4x 8 256 Color sequence RRRGGBBB 332 mode 3 bits blue 3 bits green 2 bits red This mode supports 256 colors 3 bits are used for the blue and green components of the color and 2 bits for the red component As shown in the picture the result is 8 grades for green and blue and 4 grades for red Number of available colors 8 x 8 x 4 256 Color sequence BBBGGGRR 332 mode 3 bits red 3 bits green 2 bits blue red and blue swapped This mode supports 256 colors 3 bits are used for the red and green components of the color and 2 bits for the blue component The available colors are the same as those in 233 mode The result is 8 grades for red and green and only 4 grades for blue Number of available colors 8 x 8 x 2 256 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 111 Color sequence RRRGGGBB 444 mode 4 bits red 4 bits green 4 bits blue i r The red green and blue shares are each 4 bits Number of available colors 16 x 16 x 16 4096 Color sequence BBBBGGGGRRRR 555 mode 5 bits red 5 bits green 5 bits blue Use of this mode is necessary for an LCD controller that supports RGB colors with a color depth of 15 bpp such as SED1356 or SED13806 The red green and blue shares are each 5 bits Number of available colors 32 x 32
191. c Description Polls the touch screen by calling the TOUCH_x routines to activate the measurement of the X and Y axes You must ensure that this function is called for about 100 times per second Prototype void GUI TOUCH Exec void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 273 Additional information If you are using a real time operating system the easiest way to make sure this function is called is to create a separate task When not using a multitask system you can use an interrupt service routine to do the job GUI TOUCH SetDefaultCalibration Description Resets the calibration to the values set as default in the configuration file Prototype void GUI TOUCH SetDefaultCalibration void Additional information If no values are set in the configuration file the calibration will be restored to the original default values TOUCH X ActivateX TOUCH X ActivateY Description These routines are called from GUI TOUCH Exec to activate the measurement of the X and the Y axes TOUCH X ActivateXx switches the measurement voltage to the X axis TOUCH X ActivateY switches on the voltage to the Y axis Switching on the voltage in X means the value for the Y axis can be measured and vice versa Prototypes void TOUCH X ActivateX void void TOUCH X ActivateY void TOUCH X MeasureX TOUCH X MeasureY Description These routines are called from 01
192. cations 2 bytes define LCD READ REG Index U16 0xc0000 O f 1 define LCD WRITE REG Index data U16 0 0000 Off lt lt 1 data define LCD_READ_MEM Index U16 0 80000 lt lt 1 define LCD_WRITE_MEM Index data 016 0 80000 Off lt lt 1 data The following macros are used only for LCD controllers with full bus interface User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 294 CHAPTER 20 Low Level Configuration LCD READ MEM Description Reads the video memory of the LCD controller Type Function replacement Prototype define LCD READ MEM Index Parameter Meaning Index Index of video memory of controller Additionnal information This macro defines how to read the video memory of the LCD controller In order to configure this switch correctly you need to know the base address of the video memory the spacing and if 8 16 or 32 bit accesses are permitted You should also know the correct syntax for your compiler because this kind of hardware access is not defined in ANSI C and is therefore different for different compilers LCD READ REG Description Reads the register of the LCD controller Type Function replacement Prototype define LCD READ REG Index Parameter Meaning Index Index of the register to read Additionnal information This macro defin
193. ce manual for uC GUI 2002 Micrium Technologies Corporation 260 CHAPTER 16 Unicode GUI DispStringHCenterAt nC GUI sample UNICODE characters 160 0 Set ShiftJIS font GUI SetFont amp GUI FontUC13 Display string GUI DispStringHCenterAt ASCII 160 40 RK IK IK IK k K K K K K k K K kkk K K k k k K K K K K K K K K K K K K K K K K KOK K kc k KOK k ck k ck k ck KOK KOK K KOK K ok K K main kk ck K k k k k ck lt x k ck x KKK k k k lt K x ck ck k lt K x x ck k lt ck kk k kk kk ck kk lt ck ck x x x x x ck kk ko x KKK KKK KKK QD void main void GUI_Init DemoUNICODE while 1 GUI Delay 100 Screen shot for preceeding example HC GUI sample UNICODE characters 5 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 261 Chapter 17 Shift JIS Support The most common Japanese encoding method is Shift JIS Shift JIS encoding makes generous use of 8 bit characters and the value of the first byte is used to distinguish single and multiple byte characters You need no special function calls to display a Shift JIS string The main requirement is a font which contains the Shift JIS characters to be displayed User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 262 CHAPTER 17 Shift JIS Support 17 1 Creating Shift JIS fonts FontConverter can generate a Shift JIS font for HC GUI fr
194. ce manual foruC GUI 2002 Micrium Technologies Corporation 298 LCD lt gt Description Controller n last common line used Type Numerical value CHAPTER 20 Single LCD controller configuration The following block diagram shows a single LCD controlled by a single LCD controller using external COM and SEG drivers All outputs of the common driver COMO COM63 are being used but only some outputs of the segment driver SEG4 SEG91 Note that for simplicity the video RAM is not shown in the diagram LCD Controller Configuration for the above example define define define define LCD_FIRSTS CD LAS SE LCD FIRSIC LCD LAS EGO GO OMO 0 Contr Contr Contr Contr 64 Pixels vertical Low Level Configuration Segment Driver 88 Pixels horizontal first segment line used last segment line used first com line used last com line used Please also note that the above configuration is identical if the COM or SEG lines are mirrored and even if the LCD is built in sideways 90 turned X Y swapped The same applies if the COM SEG drivers are integrated into the LCD controller as is the case for some controllers designed for small LCDs A typical example for this type of controller would be the Epson SED15XX series User s amp reference manual for uC GUI 2002 Micrium Technologie
195. ch 1 Widget Subdirectories C3 wm The following table shows the contents of all GUI subdirectories Directory Contents Config Configuration files GUI AntiAlias Antialiasing support GUI ConvertMono Color conversion routines used for b w and grayscale displays GUI ConvertColor Color conversion routines used for color displays GUI Core p C GUI core files GUI Font Font files GUI LCDDriver LCD driver GUI MemDev Memory device support GUI Touch Touch panel support GUI Widget Widget library GUI WM Window manager optional Include directories You should make sure that the include path contains the following directories the order of inclusion is of no importance Config GUI Core GUI Widget if using widget library GUI WM if using window manager Warning Always make sure that you have only one version of each file It is frequently a major problem when uC GUIupdating to a new version of u C GUI if you have old files included and therefore mix different versions If you keep ui C GUI in the directories as suggested and only in these this type of problem cannot occur When updating to a newer version you should be able to keep your configuration files and leave them unchanged For safety reasons we recommend backing or at least renaming the GUr directories prior to updating User s amp reference manual for uC GUI 2002 Micrium Technologies Co
196. ch screen 238 values 46 window manager 131 Application program interface API 10 285 Arcs drawing 84 86 ASCII 34 57 62 65 223 Auto device object 122 127 B Background window 130 134 Banding memory device 120 122 Best palette option 91 93 94 Binary switch macro 14 Binary values displaying 54 55 Bitmap converter 11 87 97 command line usage 93 supported input formats 88 supported output formats 88 using for color conversion 90 92 Bitmaps 87 97 User s amp reference manual for uC GUI color conversion of 90 92 device dependent DDB 88 device independent DIB 88 drawing 72 74 full color mode 88 91 generating C files from 88 88 90 manipulating 88 RLE compressed 89 92 96 Button widget 153 162 BUTTON Create 153 BUTTON Delete 154 BUTTON DisableMemdev 154 BUTTON EnableMemdev 155 BUTTON Invalidate 155 BUTTON Paint 155 BUTTON SetBitmap 156 BUTTON SetBitmapEx 156 BUTTON SetBkColor 156 BUTTON SetFont 157 BUTTON SetState 157 BUTTON SetStreamedBitmap 158 BUTTON SetText 158 BUTTON SetTextColor 158 C compiler 9 10 19 88 C files as input for C compiler 88 converting bitmaps into 88 88 90 C files inclusion of in uC GUI 17 C programming language 9 Callback mechanism 11 132 Callback routines 24 131 using 133 134 Character sets 62 65 Child window 135 Circles drawing 81 83 Client area of windows 130 Clip area of windows 130 Clipboard 88 Clipping 67 130 Color bar test rout
197. characters A B C and the Unicode characters 0x3060 0x3061 and 0x3062 A mixed string is then drawn onto the display The source code can be found under Sample Misc Unicode c KK IK IK kk kk K K K K K K K K K KOK K KOK K K KOK K K KOK KOK KOK K K SK SK KC K K K KC K K A KOK KOK KOK KOK KOK ke ke e ke e ke Micrium Inc Empowering embedded systems uC GUI sample code Dk k ck ck ck k k k k ck k k k K ck ck k cock ck ck k k lt k k k k ck ckock k k k lt ck k k k lt ck ko Sk k k K lt ko ko ko File Unicode c Purpose Example demonstrating UNICODE capabilities of uC GUI xy include GUI H KK IK AK kk kk K K K K K K K K K KOK K K K K K KOK K K K K K AAA AA A A Kk KOK KOK ke ko ke ke ke ke ke ke e e KOK x Definition of font containing UNICODE characters Ck k k Ck ck k k k ck kk KKK k lt ck Ck Sk k ck ck Ck x k ck x ck kk ck kk x ck ck kk x kk ck ck KKK ck kk KK KKK KKK KKK KKK KK KKK User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 258 CHAPTER 16 Unicode Start of unicode area Basic Latin static const unsigned char acFontUC13 0041 13 code 0041 X X _XXXXX__ Xy X X y XXX XXX static const unsigned char acFontUC13 0042 13 1 code 0042 XXXXX 7 X ass IX X IX C o XXXX _ 0X De c LX CX uy XX
198. cription Sets the range of the slider User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 226 CHAPTER 13 Window Objects Widgets Prototype void SLIDER SetRange SLIDER Handle hObj int Min int Max Parameter Meaning hObj Handle of slider widget Min Minimum value Max Maximum value Additionnal information The default values after creating a slider are O 100 SLIDER SetValue Description Sets the current value of the slider bar Prototype void SLIDER SetValue SLIDER Handle hObj int v Parameter Meaning hObj Handle of slider widget w Value to be set SLIDER_SetWidth Description Sets the width of the slider bar Prototype void SLIDER SetWidth SLIDER Handle hObj int Width Parameter Meaning hObj Handle of slider widget Width Width to be set User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 227 Example The source of the following sample is available as DIALOG SliderColor c in the samples shipped with uC GUI Adjust calor Red R I o Green ers EZ e m Blue 13 12 TEXT Text widget Text widgets are typically used in order to display fields of text in dialog boxes as shown in the message box below This text is shown in a message box iC Shut down Restart after O30 seconds All
199. crium Technologies Corporation 165 WM SetUserClipRect Description Temporarily reduces the clip area of the current window to a specified rectangle Prototype const GUI RECT WM SetUserClipRect const GUI RECT pRect Parameter Meaning pRect Pointer to a GUI RECT structure defining the clipping region Return value Pointer to the previous clip rectangle Additionnal information A NULL pointer can be passed in order to restore the default settings The clip rectan gle will automatically be reset by the WM when callbacks are used The given rectangle must be relative to the current window You can not enlarge the clip rectangle beyond the current window rectangle Your application must ensure that the specified rectangle retains its value until it is no longer needed i e until a different clip rectangle is specified or until a NULL pointer is passed This means that the rectangle structure passed as parameter should not be an auto variable usually located on the stack if the clip rectangle remains active until after the return In this case a static variable should be used Example This example is taken from the drawing routine of a progress indicator The progress indicator must write text on top of the progress bar where the text color has to be different on the left and right parts of the bar This means that half of a digit could be in one color while the other half could be in a different co
200. crium Technologies Corporation 19 Touchscreen SUP PONE cute qu tee bn RE 237 19 1 Routines to be adapted 1 1 4 66 66 nnn nnns 238 19 2 API reference touch screen 238 19 3 sy m bobs qaa n TT 240 20 Tame Belated EutielloHs arn er atu roce te a e eed 243 21 Low Level Configuration a 245 21 1 Configuring the LED JAY Shi ioo be e x dere re e cand 246 21 2 General configuration ensem sees emen 248 21 3 Application specific Init and 2 1 250 21 4 Full bus interface configuration 0 251 21 5 Simple bus interface 255 21 6 LCD controller configuration COM SEG 2 1 258 21 7 Switches to activate routines s uuu uQ au nennen nn nnn 262 21 8 LCD configuration samples emen eene 262 22 High Level Config ratiom eni iei s et Ie no eR b aba e et com 263 22 1 GUT configur
201. croll bar SCROLLBAR CreateAttached Create a scroll bar attached to a window SCROLLBAR_CreateIndirect Create the scroll bar from resource table entry SCROLLBAR Dec Decrement the value of the scroll bar by a value of 1 SCROLLBAR GetValue Return the current item value SCROLLBAR Inc Increment the value of the scroll bar by a value of 1 SCROLLBAR_SetNumItems Set the number of items for scrolling SCROLLBAR SetPageSize Set the page size in number of items SCROLLBAR SetValue Set the current value of the scroll bar SCROLLBAR SetWidth Set the width of the scroll bar SCROLLBAR AddValue Definition Increments or decrements the value of the scroll bar by a specified value Prototype void SCROLLBAR AddValue SCROLLBAR Handle hObj int Add Parameter Meaning Handle of scroll bar Add Number of items to increment or decrement at one time User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 220 User s amp reference manual for uC GUI CHAPTER 13 Window Objects Widgets Additional information The scroll bar cannot exceed the value set in SCROLLBAR SetNumItems For exam ple if a window contains 200 items and the scroll bar is currently at value 195 incre menting the bar by 3 items will move it to value 198 However incrementing by 10 items will only move the bar as far as value 200 which is the maximum value for this particular
202. ct Prototype void BUTTON SetState BUTTON Handle hObj int State Parameter Meaning hObj Handle of button XE SEG State of button see table below Permitted values for parameter state BUTTON STATE PRESSED Button is pressed BUTTON STATE INACTIVE Button is inactive Additionnal information This routine is used by the touch panel module You will not normally have to call this function BUTTON SetStreamedBitmap Description Sets the streamed bitmap s to be used when displaying a specified button object Prototype void BUTTON SetStreamedBitmap BUTTON Handle hObj int Index const GUI BITMAP STREAM pBitmap Parameter Meaning hObj Handle of button Index Index for bitmap see BUTTON SetBitmap pBitmap Pointer to a bitmap stream Additionnal information To be able to use this function you must include the following line in LcDConf h define BUTTON SUPPORT STREAMED BITMAP 1 For details about streamed bitmaps please see GUI DrawStreamedBitmap User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 178 CHAPTER 13 Window Objects Widgets BUTTON SetText Description Sets the text to be displayed on the button Prototype void BUTTON SetText BUTTON Handle hObj const char s Parameter Meaning hObj Handle of button S Text to displ
203. ct pAutoDevInfo Pointer to a GUI AUTODEV INFO object pfDraw Pointer to the user defined drawing function which is to be executed pData Pointer to a data structure passed to the drawing function Return value 0 if successful 1 if the routine fails User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 132 CHAPTER 10 Memory Devices Additional Information The GUI AUTODEV INFO structure contains the information about what items must be drawn by the user function typedef struct char DrawFixed GUI_AUTODEV_INFO DrawFixed is set to 1 if all items have to be drawn It is set to 0 when only the mov ing or changing objects have to be drawn We recommend the following procedure when using this feature typedef struct GUI AUTODEV INFO AutoDevInfo Information about what has to be drawn Additional data used by the user function PARAM static void Draw void p PARAM pParam PARAM p if pParam AutoDevInfo DrawFixed Draw fixed background Draw moving objects if pParam AutoDevInfo DrawFixed Draw fixed foreground if needed void main void PARAM Param Parameters for drawing routine GUI_AUTODEV AutoDev Object for banding memory device Set modify informations for drawing routine GUI MEMDEV CreateAuto amp AutoDev Create GUI AUTODEV object GUI MEMDEV DrawAuto am
204. ctory contains configuration files which need to be Application Exe GUI Sample Simulation Tool CleanUp bat amp ReadMe html a SimulationTrial dsp SimulationTrial dsw modified in order to reflect your target hardware settings mainly LCD size and colors which can be displayed User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Visual C workspace The root directory shown above includes the Microsoft Visual C workspace Simula tion dsw and project files Simulation dsp The workspace allows you to modify an applica tion program and debug it before compiling it on your target system The directory structure of the Visual C work space will appear similar to that shown to the 5 9 SimulationShip files 2 Application 1 6 9 Antilias J ConvertColor Hes Workspace Simulation 1 project s 31 Compiling for your application The demo simulation contains one or more right Here the folder is open to display the UC GUI subdirectories Please note that your E ConvertMono GUI directory may not look exactly like the one e C Core pictured depending on which additional features T 20 Font of uC GUI you have The folders Core Font and E LCDDriver LCDDriver are part of the basic uC GUI package C3 MemDev and will always appear in the workspace direc T El Touch tory 8 C Widget j Lg WM 83 C
205. custom palette and you would like to use the same palette for bitmaps a custom palette may be used In the menu you would select Image Convert Into Custom palette File format for custom palette Custom palette files are simple files defining the available colors for conversion They contain the following Header 8 bytes NumColors 032 4 bytes 0 4 bytes U32 Colors NumColors NumColors 4 bytes type GUI COLOR User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 99 Total file size is therefore 16 NumColors 4 bytes A custom palette file with 8 colors would be 164 8 4 48 bytes At this point a binary editor must be used in order to create such a file The maximum number of colors supported is 256 the minimum is 2 Custom palette sample file This sample file would define a palette containg 2 colors red and white 0000 65 6d 57 69 6e 50 61 6c 02 00 00 00 00 00 00 00 0010 00 00 00 ff 00 The 8 headers make up the first eight bytes of the first line The U32 is stored LSB first big endian and represents the next four bytes followed by the four 0 bytes Colors are stored 1 byte per color where the 4th byte is O as follows RRGGBBOO The second line of code therefore defines the two colors used in this sample 8 8 Command line usage It is also possible to work with the bitmap converter using the command prompt All conversion functions available in the bitma
206. d to store one pixel Number of available colors 4 x 4x 4 64 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 110 CHAPTER 9 Colors 233 mode 2 bits blue 3 bits green 3 bits red This mode supports 256 colors 3 bits are used for the red and green components of the color and 2 bits for the blue component As shown in the picture the result is 8 grades for green and red and 4 grades for blue Number of available colors 4x 8 x 8 256 Color sequence BBGGGRRR 233 mode 2 bits red 3 bits green 3 bits blue red and blue swapped This mode supports 256 colors 3 bits are used for the red and green components of the color and 2 bits for the blue component The available colors are the same as those in 332 mode The result is 8 grades for green and blue and 4 grades for red Number of available colors 4 x 8 x 8 256 Color sequence RRGGGBBB 323 mode 3 bits blue 2 bits green 3 bits red This mode supports 256 colors 3 bits are used for the red and blue components of the color and 2 bits for the green component As shown in the picture the result is 8 grades for blue and red and 4 grades for green Number of available colors 8 x 4x 8 256 Color sequence BBBGGRRR 323 mode 3 bits red 2 bits green 3 bits blue red and blue swapped This mode supports 256 colors 3 bits are used for the red and blue components of the color and 2 bits for the green component The availa
207. d GUI DrawBitmapMag const GUI BITMAP pBM User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 70 CHAPTER 6 2 D Graphic Library int x0 int int XMul int YMul Parameter Meaning pBM Pointer to the BITMAP to display 0 X position of the upper left corner of the bitmap in the display 0 Y position of the upper left corner of the bitmap the display XMul Scale factor of X direction YMul Scale factor of Y direction GUI_DrawStreamedBitmap Description This routine draws a bitmap from a data bitmap data stream Prototype void GUI_DrawStreamedBitmap const GUI BITMAP STREAM pBMH int x int y Parameter Meaning pBMH Pointer to the data stream x X position of the upper left corner of the bitmap in the display y Y position of the upper left corner of the bitmap in the display Additional information You can use the BitmapConverter described in a later chapter to create bitmap data streams The format of these streams is not the same as the format of a BMP file 6 5 Drawing lines The most frequently used drawing routines are those that draw a line from one point to another GUI DrawHLine Description Draws a horizontal line one pixel thick from a specified starting point to a specified endpoint in the current window Prototype void GUI DrawHLine int y int x0 int x1 Parameter Meaning y Y position x0 X
208. d and then displays Hi in the same place replacing the old string GUI DispStringAt Hello world 0 0 Disp text Delay 1000 GUI DispStringAt Hi 0 0 GUI DispCEOL User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 50 CHAPTER 4 Displaying Text User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 51 Chapter 5 Displaying Values The preceding chapter explained how to show strings on the display Of course you may use strings and the functions of the standard C library to display values How ever this can sometimes be a difficult task It is usually much easier and much more efficient to call a routine that displays the value in the form that you want uC GUI supports different decimal hexadecimal and binary outputs The individual routines are explained in this chapter All functions work without the usage of a floating point library and are optimized for both speed and size Of course sprintf may also be used on any system Using the routines in this chapter can sometimes simplify things and save both ROM space and execution time User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 52 CHAPTER 5 Displaying Values 5 1 Value API The table below lists the available value related routines in alphabetical order within their respective categories Detailed descriptions of the routines can be found in the sections t
209. d colors used The available configuration options are listed for each widget in its respective section later in the chapter Dynamic memory usage for widgets In embedded applications it is usually not very desirable to use dynamic memory at all because of fragmentation effects There are a number of different strategies that can be used to avoid this but they all work in a limited way whenever memory areas are referenced by a pointer in the application program For this reason uC GUI uses a different approach all objects and all data stored at run time are stored in mem ory areas referenced by a handle This makes it possible to relocate the allocated memory areas at run time thus avoiding the long term allocation problems which occur when using pointers All widgets are thus referenced by handles 3D support Many widgets may be displayed with or without 3D effects 3D support is enabled by default but may be disabled by setting the configuration macro WIDGET USE 3D to 0 A widget will function exactly the same way whether it uses three dimensional effects or not the only difference will be in its appearance This is demonstrated below with a slider widget 3D effects enabled default 3D effects disabled 13 2 General widget API API reference WM routines used for widgets Since widgets are essentially windows they are compatible with any of the window manager API routines The handle of the widget
210. d for hardware access Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller READ AO Read a byte from LCD controller with A line low READ 1 Read a byte from LCD controller with A line high LCD WRITE 0 Write a byte to LCD controller with A line low LCD WRITE AL Write a byte to LCD controller with A line high Additional configuration switches The following table shows optional configuration switches available for this driver Macro Explanation When set to 0 no display data cache is used which slows down the Len ntn speed of the driver Default is 1 cache activated When set to 0 the cache control functions of LOD SUPPORT CACHECONTROL cn 50 ControlCache driver API are disabled Special requirements for certain LCD controllers None 22 7 LCD6642X Supported hardware Controllers This driver has been tested with the following LCD controllers e Hitachi HD66420 e Hitachi HD66421 It should be assumed that it will also work with any controller of similar organization Bits per pixel Supported color depth is 2 bpp Interfaces The driver supports 8 bit parallel simple bus interfaces User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 322 CHAPTER 22 LCD Drivers Display data RAM organization Byte 0 Byte 1 Byte n ra Lai 4 2 4
211. dditionnal information Calling this function will tell the WM that the specified window is updated Normally this function is called internally and does not need to be called by the user application 12 7 Memory device support optional When a memory device is used for redrawing a window all drawing operations are automatically routed to a memory device context and are executed in memory Only after all drawing operations have been carried out is the window redrawn on the LCD reflecting all updates at once The advantage of using memory devices is that any flickering effects which normally occur when the screen is continuously updated as drawing operations are executed are eliminated For more information on how memory devices operate see Chapter 10 Memory Devices WM DisableMemdev Description Disables the use of memory devices for redrawing a window Prototype void WM EnableMemdev WM HWIN hWin Parameter Meaning hWin Window handle User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 167 WM EnableMemdev Description Enables the use of memory devices for redrawing a window Prototype void WM EnableMemdev WM HWIN hWin Parameter Meaning hWin Window handle 12 8 Example The following example illustrates the difference between using a callback routine for redrawing the background and not having one It also shows how to set you
212. driver module and is completely indepen dent of the rest of the GUI The appropriate driver can be easily written for any controller memory mapped or bus driven Please get in touch with us Q Which CPUs can I use pC GUI with A HC GUI can be used with any CPU or MPU for which a C compiler exists Of course it will work faster on 16 32 bit CPUs than on 8 bit CPUs Q Is pC GUI flexible enough to do what I want to do in my application A HC GUI should be flexible enough for any application If for some reason you do not think it is in your case please contact us Believe it or not the source code is available Q Does uC GUI work in a multitask environment A Yes it has been designed with multitask kernels in mind User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 376 CHAPTER 26 Questions and Answers User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 377 Index A Access addresses defining 29 Access routines defining 29 Active window 130 Alias macro 14 Aliasing 205 ANSI 9 10 253 Antialiasing 195 205 218 of fonts 205 207 qualities 205 206 software for 205 237 with high resolution coordinates 205 207 208 API reference uC GUI LCD 286 antialising 209 BUTTON 153 colors 100 EDIT 162 fonts 58 FRAMEWIN 168 graphics 68 hardware dependent functions 265 LISTBOX 174 memory devices 113 MESSAGEBOX 183 PROGBAR 186 simulator 24 text 33 tou
213. e void WM ClrHasTrans WM HWIN hWin Parameter Meaning hWin Window handle Additionnal information When set this flag tells the window manager that a window contains sections which are not redrawn and will therefore be transparent The WM then knows that the back ground needs to be redrawn prior to redrawing the window in order to make sure the transparent sections are restored correctly When the flag is cleared with ClrHasTrans the WM will not automatically redraw the background before redrawing the window User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 160 CHAPTER 12 The Window Manager WM WM Deactivate Description Deactivates the window manager Prototype void WM Deactivate void Additionnal information After calling this function the clip area is set to the complete LCD area and the WM will not execute window callback functions WM DefaultProc Description Default message handler Prototype void WM DefaultProc WM MESSAGE pMsg Parameter Meaning pMsg Pointer to message Additionnal information Use this function to handle unprocessed messages as in the following example static WM RESULT cbBackgroundWin WM MESSAGE pMsg switch pMsg MsgId 1 case WM PAINT GUI Clear default WM DefaultProc pMsg WM_GetActiveWindow Description Returns the handle of the active window used for draw
214. e Epson SED1335 e Toshiba T6963 It should be assumed that it will also work with any controller of similar organization Bits per pixel Supported color depth is 1 bpp Interfaces The driver supports 8 bit parallel simple bus interfaces User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 331 Display data RAM organization Byte 0 Byte 1 T Byten lt gt a pec Di 86 65 6 6 56 5 5 5 5 G 012 3 4 56 7 n lt gt etd ot t d lt p ip p p pip _p pD COM 0 B B B B B B B B 7 6 5 4 3 2 11 0 COM 1 The picture above shows the relation between the display memory and the SEG and COM lines of the LCD Additional RAM requirement This LCD driver may be used with or without a display data cache containing a com plete copy of the contents of the LCD data RAM If a cache is not used there are no additional RAM requirements It is recommended to use this driver with a data cache for faster LCD access The amount of memory used by the cache may be calculated as follows Size of RAM in bytes LCD XSIZE 7 8 LCD YSIZE Additional driver functions None Hardware configuration This driver accesses the hardware with a simple
215. e a full address bus which means they are connected to at least 14 address bits In a full bus interface configuration video memory is directly accessible by the CPU the full address bus is connected to the LCD controller User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 293 The only knowledge required when configuring a full bus interface is information about the address range which will generate a CHIP SELECT signal for the LCD con troller and whether 8 or 16 bit accesses should be used bus width to the LCD con troller In other words you need to know the following Base address for video memory access Base address for register access Distance between adjacent video memory locations usually 1 2 4 byte Distance between adjacent register locations usually 1 2 4 byte Type of access 8 16 32 bit for video memory Type of access 8 16 32 bit for registers Typical block diagram for LCD controllers with full bus interface 0 15 21 DO D7 D15 LCD Video 7 Controller memory Control signals Segment Driver Common Driver Configuration example The example assumes the following Base address video memory 0x80000 Base address registers 0 0000 Access to video RAM 16 bit Access to register 16 bit Distance between adjacent video memory loca 2 bytes tions Distance between adjacent register lo
216. e below Other values are not permitted Color Color to set 24 bit RGB value Permitted values for parameter Index 0 Left portion of the progress bar 1 Right portion of the progress bar PROGBAR SetFont Description Selects the font for the text display inside the progress bar Prototype void PROGBAR SetFont PROGBAR Handle hObj const GUI FONT pFont Parameter Meaning Handle of progress bar pFont Pointer to the font Additionnal information If this function is not called the default font for progress bars the GUI default font will be used However the progress bar default font may be changed in the GUIConf h file Simply define the default font as follows example define PROGBAR DEFAULT FONT amp GUI_Font13_ASCII PROGBAR SetMinMax Description Sets the minimum and maximum values used for the progress bar User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 212 CHAPTER 13 Window Objects Widgets Prototype void PROGBAR SetMinMax PROGBAR Handle hObj int Min int Max Parameter Meaning hObj Handle of progress bar Mi Minimum value 55 16383 lt lt 16383 Maximum value Max Range 16383 Max lt 16383 Additionnal information If this function is not called the default values of Min 0 Max 100 will be used PROGBAR SetText Description Sets the text displayed inside
217. e bitmap to be used when button is pressed BUTTON SetBitmapEx Description Sets the bitmap s to be used when displaying a specified button Prototype void BUTTON SetBitmapl x BUTTON Handle hObj int Index const GUI BITMAP pBitmap int x int y Parameter Meaning hObj Handle of button Index Index for bitmap see BUTTON SetBitmap pBitmap Pointer to the bitmap structure x X position for the bitmap relative to the button y Y position for the bitmap relative to the button BUTTON SetBkColor Description Sets the button background color Prototype void BUTTON SetBkColor BUTTON Handle hObj int Index GUI COLOR Color Parameter Meaning hObj Handle of button Index Index for color see table below Color Background color to be set Permitted values for parameter Index Sets the color to be used when button is unpressed Sets the color to be used when button is pressed BUTTON SetFont Description Sets the button font User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 177 Prototype void BUTTON SetFont BUTTON Handle hObj const GUI FONT pFont Parameter Meaning Handle of button pFont Pointer to the font Additionnal information If no font is selected BUTTON FONT DEF will be used BUTTON SetState Description Sets the state of a specified button obje
218. e does not yet contain code that initializes the individual elements The initial values of the widgets the actions caused by them and the interactions between them need to be defined in the dialog procedure Initializing the dialog The typical next step is to initialize the widgets with their respective initial values This is normally done in the dialog procedure as a reaction to the INIT DIALOG message The program excert below illustrates things RK HK IK IK A A A A A A A A K K K K K KOK I kk KOK KOK K KOK KOK KK Dialog procedure static void cbCallback WM MESSAGE pMsg int NCode Id WM HWIN hEditO0 hEditl hEdit2 hEdit3 hListBox WM HWIN hWin pMsg gt hWin switch pMsg MsgId case WM INIT DIALOG Get window handles for all widgets hEditO WM GetDialogItem hWin GUI ID EDITO hEditl WM GetDialogItem hWin GUI ID EDIT1 hEdit2 WM GetDialogItem hWin GUI ID EDIT2 hEdit3 WM GetDialogItem hWin GUI ID EDIT3 hListBox WM GetDialogItem hWin GUI ID LISTBOXO0 Initialize all widgets EDIT SetText hEditO EDIT widget 0 EDIT SetText hEditl EDIT widget 1 EDIT SetTextAlign hEditl GUI TA LEFT EDIT SetHexMode hEdit2 0x1234 0 Oxffff EDIT SetBinMode hEdit3 0x1234 0 Oxffff LISTBOX SetText hListBox _apListBox WM DisableWindow WM GetDialogItem hWin GUI ID CHECKBOX Check WM GetDial
219. e manual for uC GUI 2002 Micrium Technologies Corporation 223 Prototype void SCROLLBAR SetPageSize SCROLLBAR Handle hObj int PageSize Parameter Meaning hobj Handle of scroll bar PageSize Page size in number of items Additional information Page size is specified as the number of items to one page If the user pages up or down either with the keyboard or by mouse clicking in the scroll bar area the win dow will be scrolled up or down by the number of items specified to be one page SCROLLBAR SetValue Description Sets the current value of the scroll bar Prototype void SCROLLBAR SetValue SCROLLBAR Handle hObj int v Parameter Meaning hObj Handle of scroll bar Vv Value to be set SCROLLBAR SetWidth Description Sets the width of the scroll bar Prototype void SCROLLBAR SetWidth SCROLLBAR Handle hObj int Width Parameter Meaning hObj Handle of scroll bar Width Width to be set 13 11 SLIDER Slider widget Slider widgets are commonly used for modifying values through the use of a slider bar All SLIDER related routines are located in the file s SLIDER c SLIDER h All identi fiers are prefixed SLIDER User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 224 CHAPTER 13 Window Objects Widgets Configuration options Type Macro Default Explanation N SLIDER BKC
220. e opti mized for speed as much as possible For example the horizontal and vertical line functions do not require the use of single dot routines GUI ClearRect Description Clears a rectangular area at a specified position in the current window by filling it with the background color Prototype void GUI_ClearRect int x0 int y0 int xl int yl Parameter Meaning x0 Upper left X position 0 Upper left Y position x1 Lower right X position Spa Lower right Y position Related topics GUI InvertRect GUI FillRect GUI DrawPixel Description Draws a pixel at a specified position in the current window User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 67 Prototype void GUI DrawPixel int x int y Parameter Meaning X position of pixel y Y position of pixel Related topics GUI DrawPoint GUI DrawPoint Description Draws a point with the current pen size at a specified position in the current window Prototype void GUI DrawPoint int x int y Parameter Meaning X position of point y Y position of point Related topics GUI DrawPixel GUI FillRect Description Draws a filled rectangular area at a specified position in the current window Prototype void GUI FillRect int x0 int y0 int xl int yl Parameter Meaning x0 Upper left X position y0 Upper left Y position x1 Lower right X position yl
221. e poly gon is redrawn in the new position and a string with the new label is written In the second case with a memory device the same operations are performed in memory but the screen is not updated during this time The only update occurs when the rou tine GUI MEMDEV CopyToLCD is called and this update reflects all the operations at once Note that the initial states and final outputs of both procedures are identical API function Without memory device With memory device Step 0 Initial state Step 1 GUI Clear Step 2 GUI DrawPolygon Step 3 GUI DispString Step 4 GUI MEMDEV CopyToLCD only when using memory device User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 10 2 Basic functions 121 The following routines are those that are normally called when using memory devices Basic usage is rather simple 1 Create the memory device using GUI MEMDEV Create 2 Activate it using GUI MEMDEV Select 3 Execute drawing operations 4 5 Copy the result into the display using GUI M Delete the memory device if you no longer need it using GUI M EMD EV CopyToLCD EMD EV Delete 10 3 In order to be able to use memory devices Memory devices are enabled by default In order to optimize performance of the soft ware support for memory devices can be switched off i
222. e port access macros listed at the top of each example and to map them in your LCDConf h a similar manner to that shown below void LCD X WriteO0 char c void LCD X WriteO1 char c char LCD X Read00 void char LCD X Read01 void define LCD WRITE 1 LCD X Write01 Byte define LCD WRITE AO Byte LCD_X_Write00 Byte define LCD READ 1 Result Result LCD X Read01 define LCD READ AO Result Result LCD X Read00 Note that not all LCD controllers handle the AO or C D bit in the same way For exam ple a Toshiba controller requires that this bit be low when accessing data and an Epson SED1565 requires it to be high User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 292 CHAPTER 20 Low Level Configuration Hardware access for multiple LCD controllers If more than one LCD controller is used for the LCD you must define access macros for each of them individually according to your hardware Four macros are needed per LCD controller The macros for the additional controllers are often very similar to those for the first one With a direct bus connection usually only the addresses are different When I O pins are used the sequence for the access is the same except for the CHIP SELECT signal When using more than one controller add an underscore and the index of the con troller as the postfix For example Controller 0 LCD READ AO 0 Controller
223. e selected We recommend compiling all available fonts and linking them as library modules or putting all of the font object files in a library which you can link with your application This way you can be sure that only the fonts which are needed by your application are actually linked The font converter described in a seperate manual may be used to create additional fonts In order to be able to use a font in your application the following requirements must be met e The font is in a form compatible with n C GUI as either C file object file or library e The font file is linked with your application e The font declaration is contained in GUIConf h this is necessary in order to avoid compiler warnings due to undeclared externals Adding fonts Once you have linked a font file as described above declare the linked font as extern const GUI FONT as shown in the example below Example extern const GUI FONT GUI FontNew int main void GUI Init GUI Clear GUI SetFont amp GUI FontNew GUI DispString Hello world n return 0 Selecting the font HC GUI offers different fonts one of which is always selected This selection can be changed by calling the function GUI SetFont which selects the font to use for all text output to follow for the current task If no font has been selected by your application the default font is used This default is configured in GUIConf h and can be changed You should make s
224. ed denotes which source code in which LCD driver is used to generate object code Alias A A macro which operates like a simple text substitute An example would be the define U8 in which the preprocessor would replace with unsigned char Function replacements F Macros can basically be treated like regular functions although certain limitations apply as a macro is still put into the code as simple text replacement Function replacements are mainly used to add specific functionality to a module such as the access to an LCD which is highly hardware dependent This type of macro is always declared using brackets and optional parameters u C GUI 2 6 wC GUllnitializing pwC GUI The routine GUI Init initializes the LCD and the internal data structures of GUI and must be called before any other p C GUI function This is done by placing the following line into the init sequence of your program GUI Init If this call is left out the entire graphics system will not be initialized and will there fore not be ready 2 7 Using pC GUI with target hardware The following is just a basic outline of the general steps that should be taken when starting to program with pC GUI All steps are explained further in subsequent chap ters Step 1 Customizing pC GUI The first step is usually to customize uC GUI by modifying the header file LcDConf h You must define the basic data types U8 U16 etc and mandatory configuration switc
225. el Description Returns the number of bits per pixel Prototype int LCD GetBitsPerPixel void Return value Number of bits per pixel LCD GetNumColors Description Returns the number of currently available colors on the LCD id id LCD GetVXSize void LCD GetVYSize void User s amp reference manual for uC GUI LCD Driver API 2002 Micrium Technologies Corporation 341 Prototype int LCD GetNumColors void Return value Number of available colors LCD GetFixedPalette Description Returns the fixed palette mode Prototype int LCD GetFixedPalette void Return value The fixed palette mode See Chapter 9 Colors for more information on fixed pal ette modes User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 342 CHAPTER 23 LCD Driver API User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 343 Chapter 24 Performance and Resource Usage High performance combined with low resource usage has always been a major design consideration wC GUI runs 8 16 32 bit CPUs Depending on which modules are being used even single chip systems with less than 64kb ROM and 2kb RAM can be supported by pu C GUI The actual performance and resource usage depends on many factors CPU compiler memory model optimization configuration interface to LCD controller etc This chapter contains benchmarks and information about re
226. ello world program 30 31 Hexadecimal values displaying 55 56 Hiding windows 130 High resolution coordinates 205 207 208 pins connection to 257 Interrupt service routines 237 Invalidation of windows 130 132 ISO 8859 1 57 63 65 2002 Micrium Technologies Corporation K Kernel interface routines 231 233 L LCD caching in memory 11 configuration of 99 245 246 250 connecting to microcontroller 12 13 initialization of 30 magnifying 246 simulated 22 simultaneous task access 230 without LCD controller 13 LCD controller configuration of 245 262 configuring additional 260 262 connected to port buffer 13 initialization of 246 250 251 memory mapped 13 support for 12 270 with LUT hardware 110 LCD driver 20 269 284 API 285 293 availability selection 270 customization of 13 LCD BUSWIDTH 254 LCD CACHE 250 LCD CONTROLLER 248 258 270 LCD ENABLE MEM ACCESS 254 LCD ENABLE REG ACCESS 254 LCD FIRSTCOM 259 LCD FIRSTSEG 259 LCD GetBitsPerPixel 292 LCD GetFixedPalette 293 LCD GetNumColors 293 LCD GetVXSize 292 LCD GetVYSize 292 LCD GetXSize 292 LCD GetYSize 292 LCD INIT CONTROLLER 250 274 LCD LO ControlCache 272 279 291 LCD LO DrawBitMap 288 LCD LO DrawHLine 288 LCD LO DrawPixel 288 LCD LO DrawVLine 289 LCD 10 FillRect 289 LCD LO GetPixellndex 290 LCD LO Init 287 LCD LO Off 287 LCD LO On 287 LCD LO Relnit 287 LCD LO SetLUTEntry 291 LCD LO SetPixellndex 28
227. equivalents They should therefore not be called directly in multitask environments User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 334 23 1 LCD driver API The table below lists the available uC GUI LCD related routines in alphabetical order Detailed descriptions of the routines can be found in the sections that follow LCD 10 Driver routines CHAPTER 23 LCD Driver API Routine Explanation Init amp display control group CD LO In itt Initialize the display CD LO ReInit i Reinitialize LCD without erasing the contents CD TO OFF 0 Switch LCD off LO Ont Switch LCD on Drawing group CD LO DrawBitmap Universal draw bitmap routine LO DrawHLine Draw a horizontal line LO DrawPixel Draw a pixel in the current foreground color LO DrawVLine Draw a vertical line CD LO pPillRecti Fill a rectangular area 10 SetPixelIndex Draw pixel a specified color LO XorPixel Invert a pixel Get group LO GetPixelIndex Returs the index of the color of a specific pixel Set group CD LO SetOrg Not yet used reserved for future use must exist in driver Lookup table group CD LO SetLU TEntry i Modifiy a single entry of LUT Misc group optional CD LO ControlcCachei Lock unlock flush LCD cac
228. er accesses the hardware with a simple bus interface as described in Chapter 20 Low Level Configuration The following table lists the macros which must be defined for hardware access Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller READ AO Read a byte from LCD controller with A line low iCD_READ 1 Read a byte from LCD controller with A line high LCD_WRITE_AO Write a byte to LCD controller with A line low LCD WRITE A1 Write a byte to LCD controller with A line high Additional configuration switches The following table shows optional configuration switches available for this driver Macro Explanation LCD CACHE When set to 0 no display data cache is used which slows down the i speed of the driver Default is 1 cache activated Special requirements for certain LCD controllers None 22 6 LCD15XX Supported hardware Controllers This driver has been tested with the following LCD controllers Samsung 50713 Epson SED1560 Epson SED1565 Epson SED1566 Epson SED1567 Epson SED1568 Epson SED1569 Epson SED1575 It should be assumed that it will also work with any controller of similar organization Bits per pixel Supported color depth is 1 bpp Interfaces Both 8 bit parallel simple bus and serial SPI interfaces are supported User s amp reference manual for uC GUI 2002 Micrium Technologies Corporat
229. erence manual for uC GUI 2002 Micrium Technologies Corporation 201 Create frame window FRAMEWIN Handle hFrame FRAMEWIN Create Frame window NULL WM CF SHOW 10 10 150 60 RAMEWIN SetFont hFrame amp GUI Font16B ASCII RAMEWIN SetTextColor hFrame GUI RED RAMEWIN SetBarColor hFrame 0 GUI GREEN RAMEWIN SetTextAlign hFrame GUI TA HCENTER Create client window CreateWindowAsChild 0 0 0 0 hFrame WM CF SHOW CallbackChild 0 Hj nj nj nj 8K IK HK IK Ck K K K K K K K K K K K K KOK KOK KOK KOK KOK KOK A KOK kkk kkk Ck k kc k kckck KOK KOK KOK KOK KOK KOK main kk ck k k lt k k k k K k k k KKK k k k k K lt KKK K lt k K K x KKK lt k x lt k K k K x x lt k x lt k lt lt k KKK x ko ko k x lt k ko lt ko ay void main void GUI Init DemoFramewin while 1 GUI Delay 100 Screen shot of above example Child window 13 7 LISTBOX List box widget List boxes are used to select one element of a list A list box can be created without a surrounding frame window as shown below or as a child window of a FRAMEWIN widget see the additional screen shots at the end of the section As items in a list box are selected they appear highlighted Note that the background color of a selected item depends on whether the list box window has input focus List box with focus List box without focus
230. es xsize Horizontal size of the slider in pixels ysize Vertical size of the slider in pixels Tu ID to be returned Window create flags Typically WM SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values s Pointer to the text to be displayed Ag ene attribute for the text see indirect creation flags under aar essere T ni lat e e J Return value Handle for the created TEXT widget 0 if the routine fails User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 229 TEXT Createlndirect Prototype explained at the beginning of the chapter The following flags may be used as the Flags element of the resource passed as parameter Permitted indirect creation flags oR combinable EXT CF LEFT Horizontal alignment left EXT RIGHT Horizontal alignment right EXT CF HCENTER Horizontal alignment center EXT CF TOP Vertical alignment top EXT CF BOTTO Vertical alignment bottom EXT CF VCENTER Vertical alignment center The Para element is not used in the resource table TEXT GetDefaultFont Description Retruns the default font used for text widgets Prototype const GUI FONT TEXT GetDefaultFont void Return value Pointer to the default font used for text widgets
231. es You have to have a real time kernel RTOS which costs money and uses up some ROM and RAM for stacks In addition you will have to think about task synchroni zation and how to transfer information from one task to another Using p C GUI If the window manager s callback mechanism is used then an p C GUI update func tion typically GUI Exec GUI Delay has to be called regularly from one or more tasks calling uC GUI The default configuration which does not support multitasking define GUI MT 0 can NOT be used The configuration needs to enable multitasking support and define a maximum number of tasks from which p C GUI is called excerpt from GUIConf h User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 141 define GUI MT 1 Enable multitasking support define GUI MAX TASK 5 Max number of tasks that may call guC GUI Kernel interface routines are required and need to match the kernel being used You can use any real time kernel commercial or proprietary Both the macros and the routines are discussed in the following chapter sections Recommendations Call the uC GUI update functions i e GUI Exec GUI Delay from just one task It will help to keep the program structure clear If you have sufficient RAM in your system dedicate one task with the lowest priority to updating wC GUI This task will continuously call GUI Exec as shown in the ex
232. es Corporation 173 Widget flags and parameters are optional and vary depending on the type of widget The available flags and parameters for each widget if any will be listed under the appropriate section later in the chapter WM EnableWindow Description Set a specified widget to an active usable state Prototype void WM EnableWindow WM Handle hObj Parameter Meaning hObj Handle of widget Additionnal information This is the default setting for any widget WM DisableWindow Description Set a specified widget to an inactive non usable state Prototype void WM DisableWindow WM Handle hObj Parameter Meaning hObj Handle of widget Additionnal information A widget that is disabled will typically appear gray and will not accept input from the user However the actual appearance may vary depends on widget configuration settings etc 13 3 BUTTON Button widget Button widgets are commonly used as the primary user interface element for touch screens Buttons may be displayed with text as shown below or with a bitmap All BUTTON related routines are located in the file s BUTTON c BUTTON h All iden tifiers are prefixed BUTTON User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 174 Configuration options CHAPTER 13 Window Objects Widgets
233. es how to read the registers of the LCD controller Usually the regis ters are memory mapped In this case the macro can normally be written as a single line In order to configure this switch correctly you need to know the address the regis ters are mapped to the spacing and if 8 16 or 32 bit accesses are permitted You should also know the correct syntax for your compiler because this kind of hardware access is not defined in ANSI C and is therefore different for different compilers However the syntax shown below works with the majority of them Example If the registers are mapped to a memory area starting at 0xc0000 the spacing is 2 and 16 bit accesses should be used with most compilers the define should look as follows define LCD READ Index U16 0 0000 O 1 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 295 LCD WRITE MEM Description Writes data to the video memory of the LCD controller Type Function replacement Prototype LCD WRITE MEM Index Data Parameter Meaning Index Index of video memory of controller Data Data to write to the register Additionnal information This macro defines how to write to the video memory of the LCD controller In order to configure this switch correctly you need to know the base address of the rvideo memory the spacing and if 8 16 or 32 bit accesses are permitted as well a
234. es of 130 terms associated with 130 131 Windows clearing 43 44 WM Activate 141 WM_ClrHasTrans 141 WM CREATE 134 WM CreateWindow 134 WM CreateWindowAsChild 135 WM Deactivate 142 WM DefaultProc 142 WM DELETE 134 WM DeleteWindow 136 WM DisableMemdev 147 WM EnableMemdev 147 WM Execldle 134 136 152 WM GetActiveWindow 142 WM GetBackgroundWindow 143 WM GetClientRect 137 WM GetForegroundWindow 143 WM GetHasTrans 143 WM GetOrgX 137 WM GetOrgY 137 WM GetWindowOrgX 137 WM GetWindowOrgY 137 User s amp reference manual for uC GUI 383 WM GetWindowRect 137 WM GetWindowSizeX 138 WM GetWindowSizeY 138 WM HIDE 134 WM HideWindow 138 WM Init 134 143 WM InvalidateArea 138 WM InvalidateRect 139 WM InvalidateWindow 139 WM MESSAGE 134 WM MOVE 134 WM MoveTo 139 WM MoveWindow 139 WM PAINT 134 WM Paint 140 WM ResizeWindow 140 WM SelectWindow 140 WM SendMessage 144 WM SetBackgroundWindow 144 WM SetCallback 144 WM SetForegroundWindow 144 WM SetHasTrans 145 WM SetUserClipRect 145 WM SHOW 134 WM ShowWindow 141 WM SIZE 134 WM TOUCH 134 WM USER 134 WM ValidateRect 146 WM ValidateWindow 146 X X axis 12 238 XOR drawing mode 69 XOR text 39 Y Y axis 12 238 Z Z position 130 2002 Micrium Technologies Corporation
235. etFont amp GUI Font8x8 GUI DispDec 42 2 Disp value Screen shot of above example The result 42 7 4 Font related functions GUI GetCharDistX Description Returns the width in pixels X size used to display a specified character in the cur rently selected font Prototype int GUI GetCharDistX U16 c Parameter Meaning Character to calculate width from GUI GetFontDistY Description Returns the Y spacing of the currently selected font Prototype int GUI GetFontDistY void Additionnal information The Y spacing is the vertical distance in pixels between two adjacent lines of text The returned value is the yDist value of the entry for the currently selected font The returned value is valid for both proportional and monospaced fonts User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 87 GUI GetFontlnfo Description Calculates a pointer to a GUI FONTINFO structure of a particular font Prototype void GUI GetFontInfo const GUI FONT pFont GUI FONTINFO pfi Parameter Meaning pFont Pointer to the font aL Pointer to a GUI FONTINFO structure Additionnal information The definition of the GUI_FONTINFO structure is as follows typedef struct 016 Flags GUI FONTINFO The member variable flags can take the following values GUI FONTINFO FLAG PROP GUI FONTINFO FLAG MONO GUI FONTINFO FLAG AA GUI FONTINFO
236. evice The bitmap can be dragged over the screen and may in certain appli cations be used to simulate the behavior of the entire target device In order to simulate the appearance of the device a bitmap is required This bitmap is usually a photo top view of the device and must be named Device bmp It may be a seperate file in the same directory as the executable or it may be included as a resource in the application by including the following line in the resource file extension rc User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 33 145 BITMAP DISCARDABLE Device bmp For more information please refer to the Win32 documentation The size of the bitmap should be such that the size of the area in which the LCD will be shown equals the resolution of the simulated LCD This is best seen in the follow ing example Device including simulated LCD as Device bitmap Device bmp visible on screen uC GUI mbedded appli Version of uC GUI V3 14h 4 J www micrium com The red area is automatically made transparent The transparent areas do not have to be rectangular they can have an arbitrary shape up to a certain complexity which is limited by your operating system but is normally sufficient Bright red OxFF0000 is the default color for transparent areas mainly because it is not usually contained in most bitmaps To use a bitmap with bright red the default transparency
237. evices Ck Ck ck Ck ck k k k ck kk k kk k k ck Ck x k K lt kk K k x ck kk ck x x K x lt x x x kk Ck x x k x lt kk ck kk lt kk KKK KKK KK KK x lt lt E static void DemoMemDev void GUI_MEMDEV_Handle hMem while 1 Create the memory device em GUI_MEMDEV_Create 0 0 110 18 and select it for drawing operations UI MEMDEV Select hMem Draw text to memory device UI SetFont amp GUI FontComicl18B ASCII UI DispStringAt Memory device 0 0 Copy memory device contents to LCD I MEMDEV CopyToLCD hMem Select LCD and destroy memory device EMDEV Select 0 MEMDEV Delete hMem _Delay 1000 _Clear _Delay 500 0 0 0 0 0 0 0 E HH HHH KK KK IK I kk kk K K K K K K K KOK K K K K K K K K K K KOK KOK A A A A KOK A A kk KOK ko ke ke ke ke e e ek main KKKKKKKKKKK KKK KKK ck x k lt k ck x k k k x lt lt K k k k x x K x k lt lt x K K k kck ck lt x K ck ck ck ck ck x ck ck kc KK ck k k ck kk void main void GUI_Init DemoMemDev User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 128 CHAPTER 10 Memory Devices 10 6 Banding memory device A memory device is first filled by executing the specified drawing functions After fill ing the device the contents are drawn to the LC
238. f characters sev eral different ones exist The one used on the Internet and by most Windows pro grams is ISO 8859 1 a superset of the ASCII set of characters ISO 8859 1 Western Latin character set Uu C GUI supports the ISO 8859 1 which defines characters as listed below Code Description Char 160 non breaking space 161 inverted exclamation i 162 cent sign 163 pound sterling 164 general currency sign x 165 yen sign y 166 broken vertical bar 167 section sign 8 168 umlaut dieresis 7 169 copyright 9 170 feminine ordinal a 171 left angle quote guillemotleft 172 not sign A 173 soft hyphen 174 registered trademark 175 macron accent z 176 degree sign 2 177 plus or minus 178 superscript two 2 179 superscript three 3 180 acute accent 181 micro sign H 182 paragraph sign q 183 middle dot User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation 90 CHAPTER 7 Code Description Char 184 cedilla 5 185 superscript one 186 masculine ordinal o 187 right angle quote guillemot right 188 fraction one fourth 1 4 189 fraction one half 1 2 190 fraction three fourth 3 4 191 inverted question mark 192 capital A grave accent 193 capital A acute accent 194 capital A circumflex accent 195 capital A tilde A 196 capital A dieresis or umlaut mark A 197 capital A ring A 198 capital A diphthong ligature FE 199 capital C cedilla
239. file s PROGBAR c PROGBAR h All identifiers are prefixed PROGBAR User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 210 Configuration options CHAPTER 13 Window Objects Widgets Type Macro Default Explanation S PROGBAR DEFAUL FONT GUI DEFAULT FONT Font used PROGBAR DEFAULT BARCOLORO 0x555555 dark gray Left bar color N PROGBAR DEFAULT BARCOLOR1 light gray Right bar color N PROGBAR DEFAULT TEXTCOLORO OxFFFFFF Text color left bar N PROGBAR DEFAULT 1 0 000000 Text color right bar PROGBAR API The table below lists the available uC GUI PROGBAR related routines in alphabetical order Detailed descriptions of the routines follow Routine Explanation D ROGBA R Create Create the progress bar U ROGBA R CreateIndirect Create the progress bar from resource table entry 12 ROGBA R SetBarColor Sets the color s for the bar R SetFont Select the font for the text 749 ROGBA R SetMinMax Set the minimum and maximum values used for the bar D ROGBA R_SetText Set the optional text for the bargraph U ROGBA R SetTextAlign Set text alignment default is centered 9 ROGBA R SetTextColor Set the color s for the text
240. g P Position within the lookup table Should be less than the number of colors e g in 0 3 for 2 bpp 0 15 for 4 bpp 0 255 for 8 bpp Colon 24 bit RGB value User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 117 Additionnal information The closest value possible will be used for the LUT If a color LUT is to be initialized all 3 components are used In monochrome modes the green component is used but it is still recommended for better understanding of the program code to set all 3 colors to the same value such as 0x555555 or 0 0 0 The lookup table needs to be enabled by the LCD INITCONTROLLER macro for this function to have any effect This function is always available but has an effect only if a The LUT is used b The color table is located in RAM LCD PHYSCOLORS IN RAM GUI SetLUTEntry Description Modifies a single entry to the LUT of the LCD controller s Prototype void GUI SetLUTEntry U8 Pos GUI COLOR Color Parameter Meaning P Position within the lookup table Should be less than the number of colors e g iu 0 3 for 2 bpp 0 15 for 4 bpp 0 255 for 8 bpp Collor 24 bit RGB value Additionnal information The closest value possible will be used for the LUT If a color LUT is to be initialized all 3 components are used In monochrome modes the green component is used but it is still recommended for better understanding of t
241. g LISTBOX widgets Prototype void LISTBOX_SetDefaultFont const GUI FONT pFont Parameter Meaning pFont Pointer to the font LISTBOX_SetFont Description Sets the list box font Prototype void LISTBOX SetFont LISTBOX Handle hObj const GUI FONT pfont Parameter Meaning hObj Handle of list box pFont Pointer to the font LISTBOX SetSel Description Sets the selected element of a specified list box User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 206 CHAPTER 13 Window Objects Widgets Prototype void LISTBOX SetSel LISTBOX Handle hObj int Sel Parameter Meaning hObj Handle of list box Sel Elenent to be selected LISTBOX SetTextColor Description Sets the list box text color Prototype void LISTBOX SetTextColor LISTBOX Handle hObj int Index GUI COLOR Color Parameter Meaning hObj Handle of list box Index Index for text color see LISTBOX SetBackColor Color Color to be set Examples Using the LISTBOX widget The following example demonstrates the simple use of the LISTBOX widget It is available in the samples as WIDGET SimpleListBox c RK HK HK KR KC KC KC kk KC KK K K SK SK IR A IRA IR SK SK Kk K SK Ck kk ke kk Micrium Inc Empowering embedded systems uC GUI sample code ck k k x k k k k k k k k x k k k KKK k k k KK KKK KKK ck k ck
242. g may be used as the Flags element of the resource passed as parameter Permitted indirect creation flag FRAMEWIN_CF_MOVEABLE Makes the frame window moveable default is fixed The Para element is not used in the resource table User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 196 CHAPTER 13 Window Objects Widgets FRAMEWIN GetDefaultBorderSize Description Returns the default size of a frame window border Prototype int FRAMEWIN GetDefaultBorderSize void Return value Default size for a frame window border FRAMEWIN_GetDefaultCaptionSize Description Returns the default height of the title bar of frame windows Prototype int FRAMEWIN_GetDefaultCaptionSize void Return value Default height of the title bar FRAMEWIN_GetDefaultFont Description Returns the default font used for frame window captions Prototype const GUI FONT FRAMEWIN GetDefaultFont void Return value Default font used for frame window captions FRAMEWIN SetActive Description Sets the state of frame window Depending on the state the color of the title bar will change Prototype void FRAMEWIN SetActive FRAMEWIN Handle hObj int State Parameter Meaning hObj Handle of frame window State State of frame window see table below Permitted values for parameter state 0 Frame window is inactive
243. g multitask support in the configuration and adapting the kernel interface routines For popular kernels the kernel interface routines are readily available 11 2 Single task system superloop Description The entire program runs in one superloop Normally all components of the software are peridocally called No real time kernel is used so interrupts must be used for real time parts of the software This type of system is primarily used in smaller systems or if real time behavior is not critical Superloop example without pC GUI void main void HARDWARE Init Init software components XXX Init YYY Init Superloop call all software components regularily while 1 Exec all compontents of the software XXX Exec YYY Exec Advantages No real time kernel is used gt smaller ROM size just one stack gt less RAM for stacks no preemption synchronization problems Disadvantages The superloop type of program can become hard to maintain if it exceeds a certain program size Real time behavior is poor since one software component cannot be interrupted by any other component only by interrupts This means that the reac tion time of one software component depends on the exectution time of all other components in the system User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 139 Using p C GUI There are no real restrictions regarding t
244. g sign and decimal point Example void DemoDec void long 1 12345 GUI Clear GUI SetFont amp GUI Font8x8 GUI DispStringAt GUI_DispDecShift n 0 0 GUI DispSDecShift l 7 3 GUI SetFont amp GUI Font6x8 GUI DispStringAt Press any key 0 GUI VYSIZE 8 WaitKey Screen shot of above example SUF Disp Decthift 12 345 Fress anu key 5 3 Displaying floating point values GUI DispFloat Description Displays a floating point value with a specified number of characters at the current text position in the current window using the current font Prototype void GUI DispFloat float v char Len Parameter Meaning Value to display Minimum 1 2 E 38 maximum 3 4 E38 Len No of digits to display max 9 V Additionnal information Leading zeros are suppressed The decimal point counts as one character User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 57 If the value is negative a minus sign is shown Example do Shows all features for displaying floating point values void DemoFloat void float f 123 45678 GUI Clear GUI SetFont amp GUI Font8x8 GUI DispStringAt GUI DispFloat Nn 0 0 GUI DispFloat f 9 GUI_GotoxX 100 GUI DispFloat f 9 GUI DispStringAt GUI DispFloatFix Nn 0 20 GUI DispFloatFix f 9 2 GUI GotoX 100 GUI DispFloatFix 9 2 GUI Disp
245. gItem hWin GUI ID EDIT1 hEdit2 WM GetDialogItem hWin GUI ID EDIT2 hEdit3 WM GetDialogItem hWin GUI ID EDIT3 hListBox WM GetDialogItem hWin GUI ID LISTBOXO0 Initialize all widgets EDIT SetText hEditO EDIT widget 0 EDIT SetText hEditl EDIT widget 1 EDIT SetTextAlign hEditl GUI TA LEFT EDIT SetHexMode hEdit2 0x1234 0 Oxffff EDIT SetBinMode hEdit3 0x1234 0 Oxffff LISTBOX SetText hListBox apListBox WM DisableWindow WM GetDialogItem hWin GUI CHECKBOX Check WM GetDialogItem hWin GUI ID C CHECKBOX Check WM GetDialogItem hWin GUI ID C SLIDER SetWidth WM GetDialogItem hWin GUI ID S SLIDER SetValue WM GetDialogItem hWin GUI ID S break case WM KEY switch WM KEY INFO pMsg Data p 5Key case GUI ID ESCAPE GUI EndDialog hWin 1 break case GUI ID ENTER GUI EndDialog hWin 0 User s amp reference manual for uC GUI CH HE HE iT iT 2002 Micrium Technologies Corporation 236 CHAPTER 14 Dialogs break break case WM_NOTIFY_PARENT Id WM_GetId pMsg gt hWinSrc Id of widget NCode pMsg gt Data v Notification code switch NCode case WM_NOTIFICATION_RELEASED React only if released if Id GUI_ID_OK OK Button GUI_EndDialog hWin 0 if Id GUI ID CANCEL
246. go into a C bitmap Take a look at the sample bitmap pictured The bitmap is loaded into the bitmap converter converted to Best palette and saved as C with palette The resulting C source code is displayed below some data is not shown to conserve space User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 101 Resulting C code generated by bitmap converter fF C file generated by uC BmpCvt V2 30b compiled May 8 2002 10 05 37 c 2002 Micrium Inc www micrium com c 1998 2002 Segger Microcontroller Systeme GmbH www seggercom Source file MicriumLogoBlue Dimensions 269 76 NumColors 10 E include stdlib h include GULH Palette The following are the entries of the palette table Every entry is a 32 bit value of which 24 bits are actually used the lower 8 bits represent the Red component the middle 6 bits represent the Green component the highest 8 bits of the 24 bits used represent the Blue component as follows OxBBGGRR ki const GUI COLOR ColorsMicriumLogoBlue 0xBFBFBE OxFFFFFF 0xB5B5B5 0x000000 0xFF004C 0xB5002B 0x888888 0xCF0038 0x CFCFCF 0xCOCOCO const GUI LOGPALETTE PalMicriumLogoBlue 10 number of entries 0 No transparency amp ColorsMicriumLogoBlue 0 h const unsigned char acMicriumLogoBlue 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x
247. hat follow Routine Explanation Displaying decimal values Display value in decimal form at current position with specified number eee of characters Display value in decimal form at specified position with specified num tee QS ber of characters Display value in decimal form at current position with minimum number GUI_DispDecMin of characters Display long value in decimal form with decimal point at current posi el iia tion with specified number of characters Display value in decimal form at current position with specified number GET DispbescpacE T of characters replace leading zeros with spaces Display value in decimal form at current position with specified number nsspas of characters and sign Display long value in decimal form with decimal point at current posi tion with specified number of characters and sign Displaying floating point values GUI DispFloat Display floating point value with specified number of characters GUI DispFloatFixi Display floating point value with fixed no of digits to the right of deci mal point GUI DispFloatMin Display floating point value with minimum number of characters GUI DispSFloatFix Display floating point value with fixed no of digits to the right of deci mal point and sign GUI DispSFloatMin Display floating point value with minimum number of characters and
248. he User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 335 LCD LCD layer routines Routine Explanation LCD GetXSize Return physical X size of LCD in pixels LCD GetYSize Return physical Y size of LCD in pixels LCD GetVXSize Return virtual X size of LCD in pixels LCD GetVYSize Return virtual Y size of LCD in pixels LCD GetBitsPerPixel Return the number of bits per pixel LCD_GetNumColors Return the number of available colors LCD GetFixedPalette Return the fixed palette mode 23 2 Init amp display control group LCD LO Init Description Initializes the LCD using the configuration settings in LcDConf h This routine is called automatically by Irnit if the upper GUI layer is used and therefore should not need to be called manually Prototype void LCD LO Init void LCD LO Relnit Description Reinitializes the LCD using the configuration settings without erasing the display contents Prototype void LCD 10 ReInit LCD INITINFO pInitInfo LCD LO Off LCD LO On Description Switch the display off or on respectively Prototypes void LCD L0 Off void void LCD L0 On void Additionnal information Use of these routines does not affect the contents of the video memory or other set tings You may therefore safely switch off the display and switch it back on with
249. he button SetBitmapEx Set the bitmap used when displaying the button ON SetBkColor Set the background color of the button ON SetFont Select the font for the text SetState Set the button state handled automatically by touch module ON SetStreamedBitmap Set the bitmap used when displaying the button SetText Set the text mj m uu w w w w ON SetTextColor Set the color s for the text BUTTON Create Description Creates a BUTTON widget of a specified size at a specified location Prototype BUTTON Handle BUTTON Create int x0 User s amp reference manual for uC GUI int yO int xsize int ysize 2002 Micrium Technologies Corporation 175 int ID int Flags Parameter Meaning x0 Leftmost pixel of the button in desktop coordinates 0 Topmost pixel of the button desktop coordinates xsize Horizontal size of the button in pixels ysize Vertical size of the button in pixels ID ID to be returned when button is pressed Window create flags Typically WM SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values Return value Handle for the created BUTTON widget O if the routine fails BUTTON CreateAsChild
250. he current text position GUI GotoX sets the X component of the current text position the Y component remains unchanged GUI GotoY sets the Y component of the current text position the X component remains unchanged Example Shows 20 20 at position 20 20 on the display GUI GotoXY 20 20 GUI DispString The value is 4 7 Retrieving the current text position GUI GetDispPosX Description Returns the current X position Prototype int GUI GetDispPosX void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 49 GUI GetDispPosY Description Returns the current Y position Prototype int GUI GetDispPosY void 4 8 Routines to clear a window or parts of it GUI Clear Description Clears the current window Prototype void GUI_Clear void Additionnal information If no window has been defined the current window is the entire display In this case the entire display is cleared Example Shows Hello world on the display waits 1 second and then clears the display GUI_DispStringAt Hello world 0 0 Disp text GUI Delay 1000 Wait 1 second not part of wC GUT GUI Clear Clear screen GUI DispCEOL Description Clears the current window or the display from the current text position to the end of the line using the height of the current font Prototype void GUI DispCEOL void Example Shows Hello world on the display waits 1 secon
251. he program code to set all 3 colors to the same value such as 0x555555 or 0xa0a0a0 The lookup table needs to be enabled by the LCD INITCONTROLLER macro for this function to have any effect This function is often used to ensure that the colors actu ally displayed match the logical colors linearization Example Linearize the palette of a 4 grayscale LCD 724 GUI SetLUTEntry 0 0 000000 GUI SetLUTEntry 1 0 777777 GUI SetLUTEntry 2 Oxbbbbbb GUI SetLUTEntry 3 Oxffffff 555555 would be linear aaaaaa would be linear User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 118 CHAPTER 9 Colors User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 119 Chapter 10 Memory Devices Memory devices can be used in a variety of situations mainly to prevent the display from flickering when using drawing operations for overlapping items The basic idea is quite simple Without the use of a memory device drawing operations write directly to the display The screen is updated as drawing operations are executed which gives it a flickering appearance as the various updates are made For example if you wanted to draw a bitmap in the background and some transparent text in the foreground you would first have to draw the bitmap and then the text The effect would be a flickering of the text If a memory device is used for such a pr
252. he use of uC GUI As always GUI Init has to be called before you can use the software From there on any API function be used If the window manager s callback mechanism is used then an yC GUI update function has to be called regularly This is typically done by calling the GUI Exec from within the superloop Blocking functions such as GUI Delay and GUI ExecDialog should not be used in the loop since they would block the other software modules The default configuration which does not support multitasking define GUI MT 0 can be used kernel interface routines are not required Superloop example with pC GUI void main void HARDWARE Init Init software components XXX Init YYY Init GUI Init Init gCc GUI Superloop call all software components regularily while 1 Exec all compontents of the software XXX Exec YYY Exec GUI Exec Exec pC GUI for functionality like updating windows 11 3 pwC GUIMultitask system one task calling pC GUI Description A real time kernel RTOS is used The user program is split into different parts which execute in different tasks and typically have different priorities Normally the real time critical tasks which require a certain reaction time will have the highest priorities One single task is used for the user interface which calls uC GUI func tions This task usually has the lowest priority in the
253. heir respective categories Detailed descriptions of the routines can be found later in the chapter Routine Explanation Basic functions WM CreateWindow Create a window WM CreateWindowAsChild Create a child window WM DeleteWindow Delete a window WM Exec Redraw invalid windows by executing callbacks all jobs WM one invalid window by executing one callback one job WM GetClientRect Return the size of the active window WM GetDialogItem Return the window handle of a dialog box item widget WM GetOrgX Return the origin in X of the active window WM GetOrgY Return the origin in Y of the active window WM GetWindowOrgX Return the origin in X of a window WM GetWindowOrgY Return the origin in Y of a window WM GetWindowRect Return the screen coordinates of the active window WM GetWindowSizeX Return the horizontal size width of a window WM GetWindowSizeY Return the vertical size height of a window WM HideWindow Make a window invisible WM InvalidateArea Invalidate a certain section of the display WM InvalidateRect Invalidate part of a window WM InvalidateWindow Invalidate a window WM MoveTo Set the position of a window User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 148 CHAPTER 12 The Window Manager WM Routine Explanation MoveWindow
254. hes regarding resolution of the display and the LCD controller used Step 2 Defining access addresses or access routines For memory mapped LCDs the access addresses of the LCD simply need to be defined in LCDConf h For port buffer accessed LCDs interface routines must be defined Samples of the required routines are available under Samples LCD X or on our website in the down load area Step 3 Compiling linking and testing the sample code HC GUI comes with sample code for both single and multitask environments Com pile link and test these little sample programs until you feel comfortable doing so User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 24 CHAPTER 2 Getting Started Step 4 Modifying the sample program Make simple modifications to the sample programs Add additional commands such as displaying text in different sizes on the display showing lines and so on Step 5 uC GUIIn multitask applications adapt to your OS if necessary If multiple tasks should be able to access the display simultaneously the macros GUI MAXTASK and GUI OS come into play as well as the file GUITask c For details and sample adaptations please refer to Chapter 21 High Level Configuration Step 6 Write your own application using pnC GUI By now you should have a clearer understanding of how to use uC GUI Think about how to structure the program your application requires and use uC GUI by calling the
255. high resolution coordinates It can be found under Sample Misc HiResPixel c J KCKCKCKCKCkCk IK kk k K K K K K K K K K K K K K k K K K k k k k k KOK A A A A A A A K K K K KOK kk KOK KOK ke ke KOK e Micrium Inc Empowering embedded systems X uC GUI sample code Dk lt Ck ck Ck k k k ck Ck ck k k k Ck ck ck Ck k lt ck ck k ck lt ck ck ck ck x x x lt k K lt ck ck ck x K ck lt x x x k kk ck kk ck x lt lt Sk k x x lt ko ko ko File HiResPixel c Purpose Demonstrates high resolution pixels include GUI H KK IK kk kk kk kk K K K K K K K K K K K K K K K K K K K K K KOK A A A A KOK SK KC K K Kk kk KOK KOK ke koe ke ke e ek Show lines placed on high resolution pixels ck ck ck ck K ck k k k k ck Ck ck ck k k K k k ck ck ck ck k k k ck x lt k k K Ck ck k k ck K lt lt k k K k lt k ck k kk ck k k k k k k kv k k k ko void ShowHiResPixel void int i Factor 5 GUI SetBkColor GUI WHITE GUI SetColor GUI BLACK GUI Clear GUI SetPenSize 2 GUI SetPenShape GUI PS FLAT GUI AA EnableHiRes Enable high resolution User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 252 CHAPTER 15 GUI AA SetFactor Factor Set quality factor Drawing lines using the virtual resolution for i 0 i lt Factor i int x i 1 5 Factor ii 1 GUI AA DrawLine x 50 x 199
256. ich comes with it You will see a simu lation of your LCD on your PC screen which will have the same resolution in X and Y and can display the exact same colors as your LCD once it has been properly config ured The entire graphic library API and window manager API of the simulation are identical to those on your target system all functions will behave in the very same way as on the target hardware since the simulation uses the same C source code as the target system The difference lies only in the lower level of the software the LCD driver Instead of using the actual LCD driver the PC simulation uses a simulation driver which writes into a bitmap The bitmap is then displayed on your screen using a second thread of the simulation This second thread is invisible to the application it behaves just as if the LCD routines were writing directly to the display 3 2 Using the simulator in the trial uC GUI version The trial version of uwC GUI contains a full library which allows you to evaluate all available features of uC GUI It also includes the uC GUI viewer used for debugging applications as well as demo versions of the font converter and the bitmap con verter Keep in mind that being a trial version you will not be able to change any configuration settings or view the source code but you will still be able to become familiar with what uC GUI can do Directory structure The directory structure of the simulator in the trial version w
257. idget User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 231 Chapter 14 Dialogs Widgets may be created and used on their own as they are by nature windows them selves However it is often desirable to use dialog boxes which are windows that contain one or more widgets A dialog box or dialog is normally a window that appears in order to request input from the user It may contain multiple widgets requesting information from the user through various selections or it may take the form of a message box which simply provides information such as a note or warning to the user and an OK button User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 232 CHAPTER 14 Dialogs 14 1 Dialog basics Input focus The window manager remembers the window or window object that was last selected by the user with the touch screen mouse keyboard or other means This window receives keyboard input messages and is said to have the input focus The primary reason for keeping track of input focus is to determine where to send keyboard commands The window which has input focus will receive events gener ated by the keyboard Blocking vs non blocking dialogs Dialog windows can be blocking or non blocking A blocking dialog blocks the thread of execution It has input focus by default and must be closed by the user before the thread can continue A non blocking dia
258. ies Corporation 38 SIM HARDKEY SetState CHAPTER 3 Simulator Description Sets the state for a specified hardkey Prototype int SIM HARDKEY SetState unsigned int KeyIndex int State Parameter Meaning KeyIndex Index of hardkey 0 index of first key State State of the specified hardkey see table below Additionnal information Permitted values for parameter state 0 Unpressed 1 Pressed This function is only usable when SIM HARDKEY SetMode is set to 1 toggle mode User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 39 Chapter 4 Displaying Text It is very easy to display text with uC GUI Knowledge of only a few routines already allows you to write any text in any available font at any point on the display We first provide a short introduction to displaying text followed by more detailed expla nations of the individual routines that are available User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 40 CHAPTER 4 Displaying Text 4 1 Basic routines In order to display text on the LCD simply call the routine GUI DispString with the text you want to display as parameters For example GUI DispString Hello world The above code will display the text Hello world at the current text position How ever as you will see there are routines to display text in a different font or i
259. ill C3 Application appear as pictured to the right CiExe The Application directory contains the source of the demo pro gram The Exe directory contains a ready to use demo program CI Sample directory contains library files and include files needed to C simulation use the library C Tool The sample directory contains simulation samples and their l cleanup bat sources amp ReadMe html The Simulation directory contains the files needed for the simu SimulationTrial dsp lation 2 SimulationTrial dsw The Tool directory contains the uC GUI viewer a demo version of the bitmap converter and a demo version of the font converter User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 29 Visual C workspace The root directory shown above includes the al Microsoft Visual C workspace Simulation Trial dsw and project files Simulation BE Workspace simulation nal projectis Trial dsp Double click the workspace file to open the Microsoft IDE Application directory structure of the Visual C work 31 8g Exe space will look like the one shown to the right 00 GUI Simulation Compiling the demo program The source files for the demo program are located in the application directory as a _ ready to go simulation meaning that you need ClaseView E FileView only to rebuild and start it Plea
260. in order to select them Color mode No available colors LCD FIXEDPALETTE LCD SWAP RB 1 2 black and white 1 0 2 4 grayscales 2 0 4 16 grayscales 4 0 111 8 111 0 222 64 222 0 233 256 233 0 233 256 233 1 323 256 323 0 323 256 323 1 332 256 332 0 332 256 332 1 444 4096 444 0 555 32768 555 0 555 32768 555 1 565 65536 565 0 565 65536 565 1 8666 232 8666 0 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 109 1 mode 1 bpp black and white Fixed palette 1 Use of this mode is necessary for monochrome dis plays with 1 bit per pixel Number of available colors 2 2 mode 2 bpp 4 grayscales Use of this mode is necessary for monochrome dis plays with 2 bits per pixel Number of available colors 2 x 2 4 4 mode 4 bpp 16 grayscales Use of this mode is necessary for monochrome dis plays with 4 bits per pixel Number of available colors 2x 2x 2x 2 16 111 mode 3 bpp 2 levels per color Use this mode if the basic 8 colors are enough if your hardware supports only one bit per pixel and color or if you do not have sufficient video memory for a higher color depth Number of available colors 2x 2x 2 8 222 mode 6 bpp 4 levels per color This mode is a good choice if your hardware does not have a palette for every individual color 2 bits per pixel and color are reserved usually 1 byte is use
261. ine 101 102 Color conversion of bitmaps 88 90 92 Color palettes best palette option 91 93 94 custom 92 93 fixed 91 Colors 9 99 110 2002 Micrium Technologies Corporation 378 converting 99 logical 99 physical 99 predefined 100 COM SEG lines configuration 247 258 262 lookup table 247 Command line usage of bitmap converter 93 94 Compile time switches 10 Config folder 17 20 237 Configuration of wC GUI 17 30 for multitask access 230 for touch screens 237 high level 263 268 low level 245 262 Configuration of uC GUI macro types 14 Control characters 34 57 Controls see Widgets Coordinates 12 207 208 high resolution 205 207 208 Custom palettes defining 105 106 file formats for color conversion 92 for color conversion 92 93 D Data types 13 245 Decimal values displaying 46 50 Demos 12 Depth coordinate 130 Device simulation 22 23 22 24 Device bmp 22 23 Device1 bmp 22 23 Device dependent bitmap DDB 88 Device independent bitmap DIB 88 Directories inclusion of 16 Directory structure 16 for simulator 20 for Visual C workspace 20 Double byte form 224 Drawing modes 69 70 E Edit widget 162 168 EDIT AddKey 165 EDIT Create 163 EDIT Delete 163 EDIT DisableMemdev 163 EDIT EnableMemdev 164 EDIT GetText 165 EDIT Invalidate 164 EDIT Paint 164 EDIT SetBkColor 165 User s amp reference manual for uC GUI EDIT SetFont 166 EDIT SetText 166 EDIT
262. ine LCD WRITE A1 Byte Parameter Meaning Byte Byte to write User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 291 LCD WRITEM A1 Description Writes several bytes to the LCD controller with AO C D line high Type Function replacement Prototype define LCD WRITEM A1 paBytes NumberOfBytes Parameter Meaning paBytes Placeholder for the pointer to the first data byte NumberOfBytes Number of data bytes to be written Example of real bus interface The following example demonstrates how to access the LCD by a real bus interface void WriteM Al char paBytes int NummerOfBytes int i for i 0 i lt NummerOfBytes i volatile char 0xc0001 paBytes i define LCD READ 1 Result Result volatile char 0xc0000 define LCD READ AO Result Result volatile char 0xc0001 define LCD_WRITE_A1 Byte volatile char 0xc0000 Byte define LCD_WRITE_AO Byte volatile char 0xc0001 Byte define LCD WRITEM Al paBytes NummerOfBytes WriteM Al paBytes NummerOfBytes Sample routines for connection I O pins Several examples can be found in the folder sampleNLCD X Port routines for 6800 interface Port routines for 8080 interface Simple port routines for a serial interface Port routines for a simple I2C bus interface These samples can be used directly All you need to do is to define th
263. ine of a polygon defined by a list of points in the current window User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 73 Prototype void GUI DrawPolygon const GUI POINT pPoint int NumPoints int x int y Parameter Meaning pPoint Pointer to the polygon to display NumPoints Number of points specified in the list of points x X position of origin y Y position of origin Additional Information The polyline drawn is automatically closed by connecting the endpoint to the starting point GUI EnlargePolygon Description Enlarges a polygon on all sides by a specified length in pixels Prototype void GUI EnlargePolygon GUI POINT pDest const GUI POINT pSrc int NumPoints int Len Parameter Meaning pDest Pointer to the destination polygon pSrc Pointer to the source polygon NumPoints Number of points specified in the list of points Len Length in pixels by which to enlarge the polygon Additional Information Make sure the destination array of points is equal to or larger than the source array Example define countof Array sizeof Array sizeof Array 0 const GUI POINT aPoints 0 20 40 20 20 0 GUI POINT aEnlargedPoints countof aPoints void Sample void int i GUI Clear GUI SetDrawMode GUI DM XOR GUI FillPolygon aPoints countof aPoints 140 110 for i 1 i lt 10 i GUI En
264. ine routine LCD LO DrawPixel Description Draws one pixel at a specified position using the current foreground color User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 337 Prototype void LCD 10 DrawPixel int x int y Parameter Meaning X position of pixel to draw y Y position of pixel to draw LCD LO DrawVLine Description Draws a vertical line one pixel thick at a specified position using the current fore ground color Prototype void LCD 10 DrawVLine int x int y0 int yl Parameter Meaning x X position of line to draw yO Start position of line yl End position of line Additionnal information With most LCD controllers this routine executes very quickly because multiple pixels can be set at once and no calculations are needed If it is clear that horizontal lines are to be drawn this routine executes faster than the DrawLine routine LCD LO FillRect Description Draws a filled rectangle at a specified position using the current foreground color Prototype void LCD 10 FillRect int x0 int y0 int xl int yl Parameter Meaning x0 Upper left X position yo Upper left Y position x1 Lower right X position yl Lower right Y position LCD LO SetPixellndex Description Draws one pixel using a specified color User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 338 CHAPT
265. information If the string has less characters than specified is shorter it is padded with spaces If the string has more characters than specified is longer then only the given num ber of characters is actually displayed This function is especially useful if text messages can be displayed in different lan guages and will naturally differ in length but only a certain number of characters can be displayed Related topics GUI DispString GUI DispStringAt GUI DispStringAtCEOL User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 45 4 4 Selecting text drawing modes Normally text is written into the selected window at the current text position using the selected font in normal text Normal text means that the text overwrites what ever is already displayed where the bits set in the character mask are set on the dis play In this mode active bits are written using the foreground color while inactive bits are written with the background color However in some situations it may be desirable to change this default behavior uC GUI offers four flags for this purpose one default plus three modifiers which may be combined Normal text Text can be displayed normally by specifying GUI TEXTMODE NORMAL or 0 Reverse text Text can be displayed in reverse by specifying GUI TEXTMODE REVERSE What is usu ally displayed as white on black will be displayed as black on white
266. ing modes Fonts e uA variety of different fonts are shipped with the basic software 4 6 6 8 6 9 8 8 8 9 8 16 8 17 8 18 24 32 and proportional fonts with pixel heights of 8 10 13 16 For more information see Chapter 25 Standard Fonts e New fonts can be defined and simply linked in e Only the fonts used by the application are actually linked to the resulting execut able resulting in minimum ROM usage e Fonts are fully scalable separately in X and Y e Font converter available any font available on your host system i e Microsoft Windows can be converted String value output routines e Routines to show values in decimal binary hexadecimal any font e Routines to edit values in decimal binary hexadecimal any font Window manager WM e Complete window management including clipping Overwriting of areas outside a window s client area is impossible e Windows can be moved and resized e Callback routines supported usage optional e WM uses minimum RAM app 20 bytes per window Optional widgets for PC look and feel e Widgets window objects also known as controls are available They generally operate automatically and are simple to use Touch screen amp mouse support e For window objects such as the button widget uC GUI offers touch screen and mouse support PC tools e Simulation plus viewer e Bitmap converter e Font converter u User s amp reference manual for uC GUI 2002 Micri
267. ing operations Prototype WM HWIN WM GetActiveWindow void Return value The handle of the active window WM GetDesktopWindow Description Returns the handle of the desktop window Prototype WM HWIN WM GetDesktopWindow void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 161 Return value The handle of the desktop window Additionnal information The desktop window is always the bottommost window and any further created win dows are its descendants WM GetFirstChild Description Returns the handle of a specified window s first child window Prototype void WM GetFirstChild WM HWIN hWin Parameter Meaning hWin Window handle Return value Handle of the window s first child window O if no child window exists Additionnal information A window s first child window is the first child created to that particular parent If the Z positions of the windows have not been changed it will be the window directly on top of the specified parent WM GetNextSibling Description Returns the handle of a specified window s next sibling Prototype void WM GetNextSibling WM HWIN hWin Parameter Meaning hWin Window handle Return value Handle of the window s next sibling O if none exists Additionnal information A window s next sibling is the next child window that was created relative to the same parent If the Z positions of
268. ion D D D D D D D D D D D D D D D COMO B B B B B B B B B B B B B B B B 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 COM 1 Byte order 8 bit databus Byte 16 bit databus not swapped E H Byte sla L Byte 16 bit databus swapped p L Byte P H Byte Display mode r0 S SS S I 1 bit pixel G GG G 0 12 n lt gt lt rq T lt 2 bit pixel SEG SEG SEG SEG p 0 1 2 n gt lt gt lt Wee 4 bit pixel SEG 0 SEG 1 SEG2 D SEGn lt so EEE Da 8 bit pixel SEG 0 e SEG n lt s 16 bit pixel SEG 0 The picture above shows the relation between the display memory and the SEG and COM lines of the LCD in terms of the color depth Additional RAM requirements of the driver None Additional driver functions None User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Hardware configuration This driver requires a full bus interface for hardware access as described in Chapter 20 Low Level Configuration The following table lists the macros which must be defined for hardware access 315 Macro Explanation LCD INIT CONTROLLI Pel W Initialization sequence for the LCD controller READ ME Read the contents of video memory
269. ion 185 Routine Explanation EDIT GetText Get user input EDIT GetValue Returns the current value EDIT SetBinMode Enables the binary edit mode EDIT SetBkColor Set the background color of the edit field EDIT SetDecMode Enables the decimal edit mode EDIT SetDefaultFont Sets the default font used for edit fields EDIT_SetDefaultTextAlign Sets the default text alignment for edit fields EDIT_SetFont Select the font for the text EDIT_SetHexMode Enables the hexadecimal edit mode EDIT SetMaxLen Sets the maximum number of characters of the edit field EDIT SetText Set the text EDIT SetTextAlign Sets the text alignment for the edit field EDIT SetTextColor Set the color s for the text EDIT SetValue Sets the current value GUI EditbBin i Edits a binary value at the current cursor position GUI EditDec Edits a decimal value at the current cursor position GUI EditHex Edits a hexadecimal value at the current cursor position GUI EditString Edits a string at the current cursor position EDIT AddKey Description Adds user input to a specified edit field Prototype void EDIT AddKey EDIT Handle hObj int Key Parameter Meaning hobj Handle of edit field Key Character to be added Additionnal information The specified character is added to the use
270. ion 320 CHAPTER 22 LCD Drivers Display data RAM organization SEG SEG SEG SEG 0 1 2 ra gt 4 gt a a t DBO COM 1 1 DB1 COM 2 1 DB2 A COM3 DB3 8 COM4j DB4 COM 5 i DB5 COM 6 i DB6 A y com7 DB7 A DBO DB1 DB2 zm DB3 9 5 DB4 DB5 DB6 y COMn t DB7 The picture above shows the relation between the display memory and the SEG and COM lines of the LCD Additional RAM requirements of the driver This LCD driver may be used with or without a display data cache containing a com plete copy of the contents of the LCD data RAM If a cache is not used there are no additional RAM requirements It is recommended to use this driver with a data cache for faster LCD access The amount of memory used by the cache may be calculated as follows Size of RAM in bytes LCD_YSIZE 7 8 LCD XSIZE Additional driver functions LCD LO ControlCache For information about this function please refer to Chapter 23 LCD Driver API User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 321 Hardware configuration This driver accesses the hardware with a simple bus interface as described in Chapter 20 Low Level Configuration The following table lists the macros which must be define
271. ion file GuUIConf h need to be changed This file is usually located in the config subdirectory of your project s root directory Use the file GUIConf h for any high level configuration The second thing to do when using uC GUI on your hardware is to change the hard ware dependent functions located in the file Sample GUI_X GUI_X c User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 304 CHAPTER 21 High Level Configuration 21 1 Available GUI configuration macros The following table shows the available macros used for high level configuration of Uu C GUI Type Macro Default Explanation Define the size number of bytes available for optional dynamic memory Dynamic memory is required only for N GUI ALLOC SIZE 1000 windows and memory devices This memory will only be used if the GUIAlloc module is linked which should happen only if dynamic memory is required Define which information has to be transmitted by S GUI DEBUG LEVEL GUI X Log You will find a detailed description later in the chapter under GUI X Log N GUI DEFAULT BKCOLOR GUI BLACK Define the default background color N GUI DEFAULT COLOR GUI WHITE Define the default foreground color Define which font is used as default after GUI Init If you do not use the default font it S GUI DEFAULT FONT amp GUI Font6x8 makes sense to change to a different default as the default font is referenced by the code
272. ions of the routines follow Routine Explanation GUI Delay Delay for a specified period of time GUI Exec Execute callback functions all jobs GUI Execl Execute one callback function one job only GUI_Get Time Return the current system time Delay Description Delays for a specified period of time Prototype void GUI_Delay int Period Parameter Explanation Period Period in ticks until function should return Additionnal information The time unit tick is usually milliseconds depending x functions GUI Delay only executes idle functions for the given period If the window man ager is used the delay time is used for the updating of invalid windows through exe cution of wM Exec This function will call x Delay GUI Exec Description Executes callback functions typically redrawing of windows Prototype int GUI Exec void Return value if there were no jobs performed 1 if a job was performed Additionnal information This function will automatically call GUI Exec1 repeatedly until it has completed all jobs essentially until a O value is returned Normally this function does not need to be called by the user application It is called automatically by GUI Delay GUI Exec1 Description Executes a callback function one job only typically redrawing a window User s amp reference manual for uC GU
273. iptions of the routines can be found in the sections that follow Routine Explanation Routines to display text GUI DispChar Display single character at current position GUI DispCharAt Display single character at specified position GUI DispChars Display character a specified number of times GUI DispString Display string at current position GUI DispStringAt Display string at specified position User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 41 Routine Explanation GUI DispStringAtCEOL Display string at specified position then clear to end of line GUI DispStringInRect Display string in specified rectangle GUI DispStringLen Display string at current position with specified number of characters Selecting text drawing modes GUI SetTextMode Set text drawing mode Selecting text alignment GUI GetTextAlign Return current text alignment mode GUI SetLBorder Set left border after line feed GUI SetTextAlign Set text alignment mode Setting the current text position GUI GotoX Set current X position GUI GotoXY Set current X Y position GUI GotoY Set current Y position Retrieving the current text position GUI GetDispPosX Return current X position GUI GetDispPosY Return current Y position Routines to clear a window or parts of it OUI Plsari e window or entire di
274. ius u gu kuyu qu qapa pa che PR qaqa EYE EE kausaq 101 10 4 Fixed palette modes on color displays r 102 10 5 Custom palette odes scele eed sa bee ao ua SE x ER FREE RR EE asal 105 10 6 Modifying the color lookup table at run time csse mmn 106 10 7 Basic color functions 107 10 8 Index color conversion functions 109 10 9 Lookup table LUT 444 4 lt 110 11 Memory Devies e 111 11 1 Using memory devices an rr 112 11 2 Basie FUNCTIONS Spa x er ete meleste Withee cia 113 11 3 In order to be able to use memory devices 1 2 113 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 12 13 14 15 16 17 18 11 4 API reference memory devices 1 66 nnns 113 11 5 Advanced features ose meo EROR etel a e Pede ed a e E RC a na 116 11 6 Banding memory device 0 cece cece eee eee 120 11 7 Auto device objectives pP He EHE MR REA MR UD UE 122 The Window Manager WM 129 12 1 Explanatio
275. jects and which areas consist of moving or changing objects that must be updated When the drawing function is called for the first time all items are drawn Each fur User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 131 ther call updates only the space used by the moving or changing objects The actual drawing operation uses the banding memory device but only within the necessary space The main advantage of using an auto device object versus direct usage of a banding memory device is that it saves computation time since it does not keep updating the entire display GUI MEMDEV CreateAuto Description Creates an auto device object Prototype int GUI MEMDEV CreateAuto GUI AUTODEV pAutoDev Parameter Meaning pAutoDev Pointer to a GUI AUTODEV object Return value Currently 0 reserved for later use GUI MEMDEV DeleteAuto Description Deletes an auto device object Prototype void GUI MEMDEV DeleteAuto GUI AUTODEV pAutoDev Parameter Meaning pAutoDev Pointer to a GUI AUTODEV object GUI MEMDEV DrawAuto Description Executes a specified drawing routine using a banding memory device Prototype int GUI MEMDEV DrawAuto GUI AUTODEV pAutoDev GUI AUTODEV INFO pAutoDevInfo GUI CALLBACK VOID P pfDraw void pData Parameter Meaning pAutoDev Pointer to a GUI AUTODEV obje
276. k K K K K K K K K k k K K KOK K K K K K K K K K K K K KOK KOK A A k ck k ck k ck k ck KOK KOK KOK K K K Uses LISTBOX widget as child of a FRAMEWIN widget kk KK k k I I k I k k K I k x II K I k K I kk K k kk k x K x x Ck k Ck Ck Ck Ck Ck Ck Ck Ck Ck Ck Ck Ck k Ck Ck x x lt k A lt lt x x x lt void DemoListBoxAsChild void int i int Entries countof ListBox 1 FRAMEWIN Handle hFrame LISTBOX Handle hListBox int ySize GUI GetFontSizeYOf amp GUI Font13B 1 Entries GUI GetFontSizeYOf amp GUI Font16B ASCII Create the frame window hFrame FRAMEWIN Create List box NULL WM CF SHOW 10 10 120 ySize Modify frame window attributes FRAMEWIN SetFont hFrame amp GUI_Font16B ASCII FRAMEWIN SetTextColor hFrame GUI RED FRAMEWIN SetBarColor hFrame 0 GUI GREEN FRAMEWIN SetTextAlign hFrame GUI TA HCENTER Create the listbox hListBox LISTBOX CreateAsChild ListBox hFrame 0 0 0 0 WM CF SHOW Modify listbox attributes User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 209 LISTBOX SetBackColor hListBox 0 GUI BLUE LISTBOX SetBackColor hListBox 1 GUI LIGHTBLUE LISTBOX SetTextColor hListBox 0 GUI WHITE LISTBOX SetTextColor hListBox 1 GUI BLACK LISTBOX SetFont hListBox amp GUI _Font13B _ 1 Change current selection of the listbox for i
277. k Sk kk Sk kk Sk kk kk x K x KKK KK KKK KKK void ShowColorBar void int x0 60 yO 40 yStep 15 i int NumColors LCD_GetDevCap LCD_DEVCAP_NUMCOLORS int xsiz LCD_GetDevCap LCD_DEVCAP_XSIZE x0 GUI_SetFont amp GUI_Font13HB_1 GUI_DispStringHCenterAt uC GUI sample Show color bars 160 0 GUI SetFont amp GUI Font8x8 GUI SetColor GUI WHITE GUI SetBkColor GUI BLACK if LCD FIXEDPALETTE GUI DispString Fixed palette GUI DispDecMin LCD FIXEDPALETTE GUI DispStringAt Red 0 yO yStep GUI DispStringAt Green 0 yO 3 yStep GUI DispStringAt Blue 0 yO 5 yStep GUI_DispStringAt Grey 0 yO 6 yStep GUI DispStringAt Yellow 0 yO 8 yStep GUI_DispStringAt Cyan 0 yO 10 yStep GUI_DispStringAt Magenta 0 yO 12 yStep for i 0 i lt xsize i 016 cs 255 U32 i xsize U16 x x0 i Red GUI_SetColor cs GUI_DrawVLine x y0 yO yStep 1 GUI SetColor Oxff 255 cs 0 101001 GUI_DrawVLine x yO yStep yO 2 yStep 1 Green GUI SetColor cs 8 GUI DrawVLine x yO 2 yStep yO 3 yStep 1 GUI SetColor Oxff00 255 cs 0 100011 GUI DrawVLine x yO 3 yStep yO 4 yStep 1 Blue GUI SetColor cs 0 100001 GUI DrawVLine x yO 4 yStep yO 5 yStep 1 GUI SetColor
278. k x k K KKK KKK KKK ck kk kk ck x x x x x ck lt lt x x x lt x x KK KKK y static void DemoButton void BUTTON_Handle hButton int Stat 0 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 181 UI Init UI SetFont amp GUI Font8x16 UI DispStringHCenterAt Click on phone button 160 0 Create the button Button BUTTON Create 142 20 36 40 GUI ID OK WM CF SHOW Modify the button attributes UTTON SetBkColor hButton 1 GUI RED UTTON SetBitmapEx hButton 0 amp bm lbpp 0 2 4 UTTON SetBitmapEx hButton 1 amp bm lbpp 1 2 4 Loop until button is pressed hile GUI GetKey GUI ID OK if Stat 1 BUTTON SetState hButton BUTTON STATE HASFOCUS BUTTON STATE INACTIVE 00 J D r G else BUTTON_SetState hButton BUTTON STATE HASFOCUS BUTTON STATE PRESSED GUI Delay 500 Delete button object BUTTON Delete hButton 8K IK HK k k K K K K K K K K K K K K K KOK KOK KOK KOK KOK KOK A kCKCkCK kc k kc k k ck kckck ckckckck ckck ckok ckok ko main koc ck k k lt k k k k K k KKK lt k K k k k k K K k x k k lt k K K x lt lt k x K k K k K K K lt k x lt k KK k K x x lt ko ko k x lt k ko ko lt void main void 4 GUI Init DemoButton
279. kkk kkk kkk KOK KOK KOK KOK k ck k ck KOK KOK KOK KOK k KK Structure containing information for drawing routine ck k ck ck ck k ck k ck Ck Ck k Ck k Ck Ck Ck k K CC x K k x x k CC lt k CC x x KKK KKK KKK KKK KKK KKK KKK k x x x x x x x lt E typedef struct Information about what has to be displayed GUI AUTODEV INFO AutoDevInfo User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 134 CHAPTER 10 Memory Devices Polygon data GUI POINT aPoints 7 float Angle PARAM RK KK IK kk AR K K K K K K K K K K KOK KOK K K k ck k ck k ck kck kck KOK KOK K GetAngle k k k K ck ck Ck k ck Ck ck k k k x lt ck ck ck x K ck ck ck k x k Ck ck ck ck k k x ck Ck ck k k x ck x k k k k ck ck k k ck k amp k k ko ko This routine returns the value value to indicate In a real application this value would somehow be measured x static float GetAngle int tDiff if tDiff 15000 return 225 0 0006 tDiftf tDiff 15000 if tDiff 7500 return 225 90 0 012 tDiff tDiff 7000 return 225 RK IK IK kk KKK kk kkk kkk kkk k k k k kk K K K K K K K K K K K K KOK k Ck k ck k ck k ck kk KOK KOK KOK ck KOK K K Drawing routine ck ckckckck ck ck k ck ck k ck ck ck k ck ck ck ck ck k ck ck ck K ck ck ck ck ck k ck ck ck ck ck k ck ck ck ck ck ck x x ck ck x x K x x x ck ck k ck lt k kk kk
280. l for uC GUI 2002 Micrium Technologies Corporation 346 CHAPTER 24 Performance and Resource Usage Short description Switch bytes bytes Polygons u i Circles u i Driver SED1565 single LCD controller core 12 1600 SED1565 additionnal support for palette management ca 100 SED1565 additionnal support for 4 color bitmaps for driver ca 800 SED1565 additionnal support for 16 color bitmaps for driver ca 600 SED1565 additionnal support for 256 color bitmaps for driver ca 520 SED1565 additionnal support for scaled bitmaps for driver ca 260 SED1565 additionnal support for antialiasing for driver ca 80 SED1352 single LCD controller core SED1352 dual LCD controller core Window manager Core software Additional window ca 40 222 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 347 Chapter 25 Standard Fonts HC GUI is shipped with various fonts which should cover most of your needs The standard font package contains monospaced and proportional fonts in different sizes and styles This chapter provides an overview of these fonts Monospaced fonts Fonts with a fixed character width All characters have the same width in pixels Proportional fonts Each character has an individual width in pixels This chapter provides an overview of the standard n C GUI fonts User s amp reference manual
281. largePolygon aEnlargedPoints aPoints countof aPoints i 5 GUI FillPolygon aEnlargedPoints countof aPoints 140 110 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 74 CHAPTER 6 2 D Graphic Library Screen shot for preceeding example GUI FillPolygon Description Draws a filled polygon defined by a list of points in the current window Prototype void GUI FillPolygon const GUI POINT pPoint int NumPoints int x int y Parameter Meaning pPoint Pointer to the polygon to display and to fill NumPoints Number of points specified in the list of points x X position of origin y Y position of origin Additional Information The polyline drawn is automatically closed by connecting the endpoint to the starting point The endpoint must not touch the outline of the polygon GUI MagnifyPolygon Description Magnifies a polygon by a specified factor Prototype void GUI MagnifyPolygon GUI POINT pDest const GUI POINT pSrc int NumPoints int Mag Parameter Meaning pDest Pointer to the destination polygon F r Pointer to the source polygon NumPoints Number of points specified in the list of points Mag Factor used to magnify the polygon User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation 75 Additional Information Make sure the destination array of points is equal to or larger than the source a
282. lassView Z FileView application C files located in the Application directory which can be modified You may also add files to or remove files from the project Typically you would want to at least change the bitmap to your own company logo or image of choice You should then rebuild the program within the Visual C workspace in order to test debug it Once you have reached a point where you are satisfied with the result and want to use the program in your application you should be able to compile these same files on your target system and get the same result on the target display The general procedure for using the simulator would be as follows User s amp reference manual for uC GUI Step 1 Open the Visual C workspace by double clicking on Simulation dsw Step 2 Compile the project by choosing Build Rebuild A11 from the menu or by pressing F7 Step 3 Run the simulation by choosing Build Start Debug Go from the menu or by pressing F5 Step 4 Replace the bitmap with your own logo or image Step 5 Make further modifications to the application program as you wish by editing the source code or adding deleting files Step 6 Compile and run the application program within Visual C to test the results Continue to modify and debug as needed Step 7 Compile and run the application program on your target system 2002 Micrium Technologies Corporation 32 CHAPTER 3 Simulator 3 4 The viewer If you use the simula
283. lay data into the LCD cache You yourself must write the hardware dependent portion that periodically transfers the data in the cache memory to your LCD Sample code for transferring the video image into the display is available in both C and optimized assembler for M16C and M16C 80 How to connect the CPU to the row column drivers It is quite easy to connect the microcontroller to the row column drivers Five control lines are needed as well as either 4 or 8 data lines depending on whether the col umn drivers are able to operate in 8 bit mode 8 bit mode is recommended as it is User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 324 CHAPTER 22 LCD Drivers more efficient saving calculation time of the CPU AII data lines should be on a single port using port bits 0 3 or 0 7 in order to guarantee efficient access This setup is illustrated below LCD MODULE com aver n ep Segment driver 5 bit control port 4 8 bit data port DO D3 D7 CPU load The CPU load depends on the hardware and controller used as well as on the size of the display For example Mitsubishi M16C62 Controller 16MHz 160 100 display 8 bit interface 80 Hz update app 12 CPU load Mitsubishi M16C62 Controller 16MHz 240 128 display 8 bit interface 80 Hz update app 22 CPU load Supported hardware Controllers None Bits per pixel Supported color depth is 2 bpp In
284. les O UI DrawCircle Draw a circle GUI FillCircle Draw a filled circle Drawing ellipses GUI DrawEllipse Draw an ellipse LE GUI FillEllipse Draw a filled ellipse Drawing arcs GUI DrawArc Draw an arc User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 65 6 2 Drawing modes HC GUI can draw in NORMAL mode or in XOR mode The default is NORMAL mode in which the content of the display is overdrawn by the graphic In XOR mode the con tent of the display is inverted when it is overdrawn Restrictions associated with GUI DRAWMODE XOR e XOR mode is only useful when using two displayed colors inside the active win dow or screen e Some drawing functions of uC GUI do not work precisely with this drawing mode Generally this mode works only with a pen size of one pixel That means before using functions like GUI DrawLine GUI DrawCircle GUI DrawRect and so on you must make sure that the pen size is set to 1 when you are working in XOR mode e When drawing bitmaps with a color depth greater than 1 bit per pixel bpp this drawing mode has no effect e When using drawing functions such as GUI DrawPolyLine or multiple calls of GUI DrawLineTo the fulcrums are inverted twice The result is that these pixels remain in the background color GUI SetDrawMode Description Selects the specified drawing mode Prot
285. liasing the same coordinates are used as for regular non antialiasing drawing routines This is the default mode You do not need to consider the antialiasing factor in the function arguments For example to draw an antialiased line from 50 100 to 100 50 you would write GUI AA DrawLine 50 100 100 50 The high resolution feature of uC GUI lets you use the virtual space determined by the antialiasing factor and your display size High resolution coordinates must be enabled with the routine GUI AA EnableHiRes and may be disabled with GUI AA DisableHiRes Both functions are explained later in the chapter The advan User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 244 CHAPTER 15 Antialiasing tage of using high resolution coordinates is that items can be placed not only at physical positions of your display but also between them The virtual space of a high resolution pixel is illustrated below based on an antialiasing factor of 3 High resolution pixel i ss Physical pixel To draw a line from pixel 50 100 to 100 50 in high resolution mode with anti aliasing factor 3 you would write GUI AA DrawLine 150 300 300 150 For sample programs using the high resolution feature see the examples at the end of this chapter User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation
286. lings to one another Client area The client area of a window is simply its usable area If a window contains a frame or title bar then the client area is the rectangular inner area If there is no such frame then the coordinates of the client area are identical to those of the window itself Clipping clip area Clipping is the process of limiting output to a window or part of it The clip area of a window is its visible area This is the window area minus the area obstructed by siblings of higher Z order minus any part that does not fit into the vis ible area of the parent window Desktop window The desktop window is automatically created by the window manager and always covers the entire display area It is always the bottommost window and when no other window has been defined it is the default active window All windows are descendants children grandchildren etc of the desktop window Handle When a new window is created the WM assigns it a unique identifier called a handle The handle is used in any further operations performed on that particular window Hiding showing windows A hidden window is not visible although it still exists has a handle When a window is created it is hidden by default if no create flag is specified Showing a window makes it visible hiding it makes it invisible User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 147 Transparency A window that h
287. ll o grave accent 243 small o acute accent 244 small o circumflex accent 6 245 small o tilde 6 246 small o dieresis or umlaut mark 6 247 division sign 248 small o slash 249 small grave accent 250 small u acute accent 251 small u circumflex accent 252 small u dieresis or umlaut mark 253 small y acute accent y 254 small thorn Icelandic b 255 small y dieresis or umlaut mark y Unicode Unicode is the ultimate in character coding It is an international standard based on ASCII and ISO 8859 1 Contrary to ASCII UNICODE requires 16 bit characters because all characters have their own code Currently more than 30 000 different characters are defined However not all of the character images are defined in GUI It is the responsibility of the user to define these additional characters Please contact Micrium Inc or your distributor as we may already have the character set that you need 7 6 Font converter Fonts which be used with uC GUI must be defined as FONT structures in C The structures or rather the font data which is referenced by these structures can be rather large It is very time consuming and inefficient to generate these fonts manually We therefore recommend using the font converter which automatically generates C files from fonts The font converter is a simple Windows program You need only to load an installed Windows font into the program edit it if you want
288. llipse half the diameter Minimum 0 Maximum 180 ry Y radius of the ellipse half the diameter Minimum 0 Maximum 180 Additional Information This routine cannot handle rx ry parameters in excess of 180 because it uses integer calculations that would otherwise produce an overflow Example See the GUI FillEllipse example GUI FillEllipse Description Draws a filled ellipse of the given dimensions User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 80 Prototype CHAPTER 6 2 D Graphic Library void GUI FillEllipse int x0 int yO int rx int ry Parameter Meaning x0 X position of the center of the circle in pixels of the client window 0 Y position of the center of the circle pixels of the client window rx X radius of the ellipse half the diameter Minimum 0 Maximum 180 ry Y radius of the ellipse half the diameter Minimum 0 Maximum 180 Additional Information This routine cannot handle a rx ry parameters in excess of 180 Example Demo ellipses GUI SetColor 0xff GUI FillEllipse 100 180 50 70 GUI SetColor 0x0 GUI DrawEllipse 100 180 50 70 GUI SetColor 0x000000 GUI FillEllipse 100 180 10 50 Screen shot for preceeding example 6 9 Drawing arcs GUI DrawArc Description Draws an arc of specified dimensions at a specified position in the current window An arc is a sectio
289. log on the other hand does not block the calling thread it allows the task to continue while it is displayed Please note that in some other environments blocking and non blocking dialogs may be referred to as modal and modeless respectively Dialog messages A dialog box is a window and it receives messages just like all other windows in the system do Most messages are handled by the dialog box automatically the others are passed to the callback routine specified upon creation of the dialog box also known as the dialog procedure There are two types of additional messages which are sent to the dialog window pro cedure INIT DIALOG and NOTIFY PARENT WM INIT DIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed Dialog pro cedures typically use this message to initialize widgets and carry out any other ini tialization tasks that affect the appearance of the dialog box The NOTIFY PARENT message is sent to the dialog box by its child windows in order to notify the parent of any events in order to ensure sychronization The events sent by a child depend on its type and are documented seperately for every type of widget 14 2 Creating a dialog Two basic things are required to create a dialog box a resource table that defines the widgets to be included and a dialog procedure which defines the initial values for the widgets as well as their behavior Once both ite
290. lor The best way to do this is to temporarily reduce the clip area when drawing each part of the bar as shown below Draw left part of the bar r x020 1 1 r y0 20 r yl GUI YMAX SetUserClipRect amp r I SetBkColor pThis ColorBar I SetColor pThis ColorText 0 I Clear I GotoXY xText yText GUI DispDecMin pThis v GUI DispChar w right part of the bar X0 r x1 r x1 GUI XMAX SetUserClipRect amp r UI SetBkColor pThis ColorBar UI SetColor pThis ColorText 1 UI Clear 01 GotoXY xText yText GUI DispDecMin pThis v GUI DispChar 01 1 ci cie fe E 1 Ly QAAADEAKKAAAASEZ Screen shot of progress bar WM_ValidateRect Description Validates a specfied rectangular area of a window User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 166 CHAPTER 12 The Window Manager WM Prototype void WM ValidateRect WM HWIN hWin GUI RECT pRect Parameter Meaning hWin Window handle PRECE Pointer to a GUI_RECT structure Additionnal information Calling this function will tell the WM that the specified area is updated Normally this function is called internally and does not need to be called by the user application WM ValidateWindow Description Validates a specified window Prototype void WM ValidateWindow HWIN hWin Parameter Meaning hWin Window handle A
291. manual for uC GUI 2002 Micrium Technologies Corporation 282 CHAPTER 20 Low Level Configuration 20 1 Available configuration macros The following table shows the available macros used for low level configuration of UJ C GUI Type Macro Default Explanation General required configuration S LCD CONTROLLER Select LCD controller N LCD BITSPERPIXEL Sus Specify bits per pixel Specify fixed palette mode Set to 0 for a user S LCD FIXEDPALETTE Soc defined color lookup table then LCD PHYSCOLORS must be defined N LCD XSIZE wm Define horizontal resolution of LCD N ILC ID S MAE Define vertical resolution of LCD Initializing the controller Initialization sequence for the LCD control 5 LOD INTI CONTROLLER ler s Not applicable with all controllers Display orientation LCD MIRROR X 0 Activate to mirror X axis LCD MIRROR Y 0 Activate to mirror Y axis Activate to swap X and Y axes If set to 0 SEG B LCD SWAP XY 0 lines refer to columns and COM lines refer to rows N LCD VXSIZE LCD XSIZE Horizontal resolution of virtual display Not applicable with all drivers lt Vertical resolution of virtual display Not appli X LED VYSTAR LCD_YSIZE cable with all drivers N LCD XORG lt n gt 0 uon controller n leftmost lowest X posi N LCD YORG n 0 m controller n topmost lowest
292. marks of their respec tive holders Registration Please register the software via email This way we can make sure you will receive updates or notifications of updates as soon as they become available For registration please provide the following information Your full name and the name of your supervisor Your company name Your job title Your email address and telephone number Company name and address Your company s main phone number Your company s web site address Name and version of the product Please send this information to licensing micrium com Contact address Micrium Inc 949 Crestview Circle Weston FL 33327 1848 U S A Phone 1 954 217 2036 FAX 1 954 217 2037 WEB www micrium com Email support micrium com Manual versions This manual describes the software version 3 26 If any error occurs please inform us and we will try to help you as soon as possible User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation For further information on topics or routines not yet specified please contact us Print date 8 28 02 Manual version Date By Explanation 3 26RO 020820 KG Chapter 18 Touch Screen Support changed to Input Devices mouse and keyboard support added chapter restructured Slight modifications to section 13 10 Scroll bar widget 3 24R4 020809 KG Additional macros added to Chapter 18 Touch Screen Sup port Chapter 3
293. ms exist you need only a single func tion call GUI CreateDialogBox Or GUI ExecDialogBox to actually create the dia log Resource table Dialog boxes may be created in a blocking manner using GUI ExecDialogBox or as non blocking using GUI CreateDialogBox A resource table must first be defined which specifies all widgets to be included in the dialog The example shown below creates a resource table This particular sample was created manually although it could also be done by a GUI builder User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 233 static const GUI WIDGET CREATE INFO _aDialogCreate FRAMEWIN CreateIndirect Dialog 0 10 10 180 230 0 0 BUTTON CreateIndirect ORT GUI ID OK 100 Sy 60 20 0 0 BUTTON CreateIndirect Cancel GUI ID CANCEL 100 30 60 20 0 0 TEXT CreateIndirect LText 0 10 55 48 15 0 GUI TA LEFT TEXT CreateIndirect RText 0 10 80 48 15 0 GUI TA RIGHT EDIT CreateIndirect ULL GUI ID EDITO 60 55 100 15 0 50 k EDIT CreateIndirect ULL GUI ID EDITI 60 80 00 15 0 50 F TEXT CreateIndirect Hex 0 10 100 48 15 0 GUI TA RIGHT EDIT CreateIndirect ULL GUI ID EDITI2 60 100 00 15 0 6 Y TEXT CreateIndirect Bin 0 10 120 48 15 0 GUI TA RIGHT EDIT CreateIndirect NULL GUI ID EDIT3 60 120 00 1554 Q hy LISTBOX CreateIndirec
294. n Step 4 Double click on the Sample folder A ClassView J FileView and select one of the sample files inside Your workspace directory should now appear similar to the one on the right Of course the file name may be different the important thing here is that the Application folder contains only the C file of the sample you want to compile and nothing else e Step 5 Rebuild the sample by choosing Build Rebuild 11 from the menu by pressing F7 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 30 CHAPTER 3 Simulator e Step 6 Start the simulation by choosing Build Start Debug Go from the menu or by pressing F5 The result of the sample selected above is pictured below 3 3 Using the simulator with the uC GUI source Directory structure The root directory of the simulator can be anywhere on your PC e g workNGSCSim The directory structure will appear as shown to the right This structure is very similar to that which we recom mend for your target application see Chapter 2 Getting Started for more information The subdirectories containing p C GUI pro gram files are the Gur folder and should contain the exact same files as the directories of the same names which you are using for your target cross compiler You should not make any changes to the GuI subdirectories as this would make updating to a newer ver sion of uC GUI more difficult The Config dire
295. n a cer tain position In addition it is possible to write not only strings but also decimal hexadecimal and binary values to the display Even though the graphic displays are usually byte oriented the text can be positioned at any pixel of the display not only at byte positions Control characters Control characters are characters with a character code of less than 32 The control characters are defined as part of ASCII uC GUI ignores all control characters except for the following Char ASCII Code code 9 Line feed 10 LF The current text position is changed to the beginning of the next line Per n default this is X 0 Y font distance in pixels as delivered by GUI GetFontDistY Carriage return 13 CR r The current text position is changed to the beginning of the current line Per default this is X 0 Usage of the control character LF can be very convenient in strings A line feed can be made part of a string so that a string spanning multiple lines can be displayed with a single routine call Positioning text at a selected position This be done by using the routine GUI_Gotoxy as shown in the following example GUI GotoXY 10 10 Set text position in pixels GUI DispString Hello world Show text 4 2 Text API The table below lists the available text related routines in alphabetical order within their respective categories Detailed descr
296. n of terms oci csse tease hock Ease CX PN pq TRY ere pana iy taeda 130 12 2 APL reference emite e e seri ak Tw yr ka e Leiva ea a ii 131 12 3 Callback mechanism of the window 132 12 4 Using callback routines er ner nene cnn eene n rne ni n e n E kae 133 12 5 Basic functions cese periere Re pe re LP er Re bU Rat EX NP aquy ASTA EE A and 134 12 6 Advanced f hctioFisi e rante eer tsp ecu ed ami yond 141 12 7 Memory device Support optional emen 147 12 8 EXAM DIO EE 147 Window Objects 151 13 1 Some BASICS m e e x Un ddp ee d ees Uva D vo d a Ded vi n d 152 13 2 BUTTON Button Widget u a aguas 153 13 3 Edit Edit EE Hed ee Eas ele uu qa sa 162 13 4 FRAMEWIN Frame window widget rr 168 13 5 LISTBOX List box widget creer Deed e x Nea e D n 174 13 6 MESSAGEBOX Message box widget r eene 183 13 7 PROGBAR Progress bar widget 02224 41 186 cere n At MA Ar LA M De E MEA Ash 195 14 1 Dialog DaSICS ELN 196 14 2 Creating a dialog oco potro ee 196 14 3 API reference dialOgS ciui conuiuia YR orcad doen FOE DR sans uwihata apa Ue 200 14 4 Dialog DOX65
297. n of the outline of a circle User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Prototype void GL DrawArc int xCenter int yCenter 81 int rx int ry int a0 int a1 Parameter Meaning xCenter Horizontal position of the center in pixels of the client window yCenter Vertical position of the center in pixels of the client window rx X radius pixels ry Y radius pixels a0 Starting angle degrees ei Ending angle degrees Limitations Currently the ry parameter is not used and the rx parameter is used instead Additional Information GUI DrawArc uses the floating point library It cannot handle rx ry parameters in excess of 180 because it uses integer calculations that would otherwise produce an overflow Example void DrawArcScale void int x0 160 int yO 180 int i har ac 4 UI SetBkColor GUI WHITE UI Clear UI SetPenSize 5 UI SetTextMode GUI TM TRANS UI SetFont amp GUI FontComic18B ASCII UI SetColor GUI BLACK UI DrawArc x0 y0 150 150 30 210 UI Delay 1000 for i20 1 lt 23 i float a 3041 10 3 1415926 180 int x 141 cos a x0 int y 141 sin a y0 if 1 2 0 GUI SetPenSize 5 else GUI SetPenSize 4 GUI DrawPoint x y if 1 2 0 x 123 cos a x0 y 130 sin a y0 sprintf ac Sd 10 1 GUI SetTextAlign GUI TA VCENTER GUI DispStringHCenterAt ac x y AQA
298. n task when configuring p C GUI For details please see Chapter 20 Low Level Configuration If uC GUI is not configured correctly because you did not select the right display res olution or chose the wrong LCD controller it will probably not display anything at all or display something that does not resemble what you expected So take care to tai lor LCDConf h to your needs If you do not wish to deal with this process Micrium can do it for you as well as test uC GUI in your application with your hardware and your LCD uC GUITypes of configuration macros The following types of configuration macros exist Binary switches B Switches can have a value of either 0 or 1 where 0 means deactivated and 1 means activated actually anything other than 0 would work but using 1 makes it easier to read a config file These switches can enable or disable a certain functionality or behavior Switches are the simplest form of configuration macro Numerical values N Numerical values are used somewhere in the code in place of a numerical constant Typical examples are in the configuration of the resolution of an LCD User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 23 Selection switches S Selection switches are used to select one out of multiple options where only one of those options can be selected A typical example might be the selection of the type of LCD controller used where the number select
299. n the configuration file GUIConf h by including the following line define GUI SUPPORT MEMDEV 0 If this line is in the configuration file and you want to use memory devices either delete the line or change the define to 1 10 4 Memory device API The table below lists the available routines of the uC GUI memory device All functions are listed in alphabetical order within their respective categories Detailed descriptions of the routines can be found in the sections that follow Routine Explanation Basic functions GUI MEMDEV Create Create the memory device first step GUI MEMDEV CopyToLCD Copy contents of memory device to LCD GUI MEMDEV Delete Free the memory used by the memory device GUI MEMDEV Select Select a memory device as target for drawing operations Advanced features GUI MEMDEV Clear Mark the memory device contents as unchanged GUI MEMDEV CopyFromLCD Copy contents of LCD to memory device GUI MEMDEV CopyToLCDAA Copy the contents of memory device antialiased GUI MEMDEV GetYSize Return the Y size of memory device GUI MEMDEV ReduceYSize Reduce Y size of memory device GUI MEMDEV SetOrg Change the origin of the memory device on the LCD Banding memory device GUI MEMDEV Draw Use a memory device for drawing Auto device object functions
300. n value Handle for the created CHECKBOX widget O if the routine fails CHECKBOX Createlndirect Prototype explained at the beginning of the chapter The elements Flags and Para of the resource passed as parameter are not used CHECKBOX IsChecked Description Returns the current state checked or not checked of a specified CHECKBOX widget Prototype int CHECKBOX IsChecked CHECKBOX Handle hObj Parameter Meaning Handle of check box Return value 0 not checked 1 checked CHECKBOX Uncheck Description Sets a specified check box to an unchecked state Prototype void CHECKBOX Uncheck CHECKBOX Handle hObj Parameter Meaning hObj Handle of check box Additionnal information This is the default setting for check boxes User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 184 CHAPTER 13 Window Objects Widgets 13 5 EDIT Edit widget Edit fields are commonly used as the primary user interface for text input Blank edit field Edit field with user input EDIT widget 1 You can also use edit fields for entering values in binary decimal or hexadecimal modes A decimal mode edit field might appear similar to those in the following table Like a check box an edit field will appear gray if disabled Edit field with user input decimal Disabled edit field All EDIT related routines are located in the file
301. nable Has transparency flag Must be defined for windows 5 whose client area is not entirely filled WM CF HIDE Hide window after creation default WM SHOW Show window after creation WM FGND Put window in foreground after creation default WM CF BGND Put window in background after creation WM CF STAYONTOP Make sure window stays on top of all siblings created with out this flag Automatically use a memory device when redrawing This will avoid flicker and also improve the output speed in most cases as clipping is simplified Note that the memory device package is required and needs to be enabled in the configuratioon in order to be able to use this flag If mem ory devices are not enabled this flag is ignored WM CF MEMDEV Handle for created window Additionnal information Several create flags can be combined by using the operator Negative position coordinates may be used Examples Creates a window with callback hWin2 WM CreateWindow 100 10 180 100 WM CF SHOW amp WinHandler 0 Creates a window without callback hWin2 WM CreateWindow 100 10 180 100 WM CF SHOW NULL 0 WM CreateWindowAsChild Description Creates a window as a child window Prototype WM HWIN WM CreateWindowAsChild int x0 int int width int height WM HWIN hWinParent User s amp reference manual fo
302. nd Next line on the next line GUI DispString Hello world Disp text GUI_DispString nNext line Disp text Related topics GUI DispStringAt GUI DispStringAtCEOL GUI DispStringLen GUI DispStringAt Description Displays the string passed as parameter at a specified position in the current window using the current font Prototype void GUI DispStringAt const char GUI FAR s int x int y Parameter Meaning String to display X position to write to in pixels of the client window Y position to write to in pixels of the client window Example Shows Position 50 20 at position 50 20 on the display GUI DispStringAt Position 50 20 50 20 Disp text Related topics GUI DispString GUI DispStringAtCEOL GUI DispStringLen GUI DispStringAtCEOL Description This routine uses the exact same parameters as GUI DispStringAt It does the same thing displays a given string at a specified position However after doing so it clears the remaining part of the line to the end by calling the routine GUI DispCEOL This routine can be handy if one string is to overwrite another and the overwriting string is or may be shorter than the previous one User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 44 CHAPTER 4 Displaying Text GUI DispStringInRect Description Displays the string passed as parameter at a specified position within
303. ndian modes not swapped default 1 active endian modes swapped 20 9 LCD controller configuration common segment lines For most LCDs the setup of common COM and segment SEG lines is straightfor ward and neither special settings for COM SEG lines nor the configuration macros in this section are required This section explains how the LCD controller s is physically connected to your dis play The direction does not matter it is only assumed that continuous COM and SEG lines are used If the direction of SEGs or COMs is reversed use LCD MIRROR X LCD MIRROR Y to set them in the direction required by your application If non con tinuous COM SEG lines have been used you have to modify the driver putting in a translation table will do or even better go back to the hardware LCD module designer and ask him her to start over LCD XORG n LCD YORG n Description Define the horizontal and vertical origin of the display respectively controlled by the configured driver Type Numerical value Additionnal information In a single display system both macros are usually set to 0 the default value LCD FIRSTSEG n Description Controller n first segment line used Type Numerical value LCD LASTSEG n Description Controller n last segment line used Type Numerical value LCD FIRSTCOM n Description Controller n first common line used Type Numerical value User s amp referen
304. nes whether or not a specified handle is a valid window handle User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 163 Prototype void WM IsWindow WM HWIN hWin Parameter Meaning hWin Window handle Return value 0 handle is not a valid window handle 1 handle is a valid window handle WM_SendMessage Description Sends a message to a specified window Prototype void WM SendMessage WM HWIN hWin WM MESSAGE pMsg Parameter Meaning hWin Window handle pMsg Pointer to message WM SetDesktopColor Description Sets the color for the desktop window Prototype GUI COLOR WM SetDesktopColor GUI COLOR Color Parameter Meaning Color Color for desktop window 24 bit RGB value Return value The previously selected desktop window color Additionnal information The default setting for the desktop window is not to repaint itself If this function is not called the desktop window will not be redrawn at all therefore other windows will remain visible even after they are deleted Once a color is specified with this function the desktop window will repaint itself In order to restore the default call this function and specify GUI_INVALID_COLOR WM_SetCallback Description Sets a callback routine to be executed by the window manager User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation
305. ngAt in any color 120 20 UI SetColor GUI BLUE Draw filled polygon UI FillPolygon amp aPointArrow 0 7 100 100 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 77 KK IK IK kk kk k K K K K K K K KOK KOK KOK KOK KOK KOK KOK K KOK A KOK KOK KOK AA k ck k ck k ck KOK KOK KOK KOK KOK e k main Ck k ck Ck k k k x lt K k k x k x ck Ck x k k x Ck kk x k x KK KKK k k x x x x kk ck kk k kk kk Sk kk ko kk kk x x k ko x kc KKK KK void main void GUI Init DrawPolygon while 1 GUI Delay 100 Screen shot for preceeding example Polygons of arbitrary shape in any color 6 7 Drawing circles GUI DrawCircle Description Draws a circle of specified dimensions at a specified position in the current window Prototype void GUI DrawCircle int x0 int y0 int r Parameter Meaning x0 X position of the center of the circle in pixels of the client window y0 Y position of the center of the circle in pixels of the client window r Radius of the circle half the diameter Minimum 0 will result in a point Maximum 180 Additional Information This routine cannot handle a radius in excess of 180 because it uses integer calcula tions that would otherwise produce an overflow However for most embedded appli cations this is not a problem since a circle with diameter 360 is larger than the display anyh
306. nroller and CPU Its design is modular consisting of different layers in different modules One layer called the LCD driver covers all access to the LCD uC GUI works with all CPUs since it is written in 10096 ANSI C uC GUI is well suited for most applications using black white and color LCDs It has a very good color management which allows it to handles grayscales uC GUI also features an extensive 2 D graphic library and a window manager which supports windows while using a minimum of RAM Purpose of this document This guide describes how to install configure and use the uC GUI graphical user interface for embedded applications It also explains the internal structure of the software Assumptions This guide assumes that you already possess a solid knowledge of the C program ming language If you feel that your knowledge of C is not sufficient we recommend The C Program ming Language by Kernighan and Richie which describes the programming standard and in newer editions also covers the ANSI C standard Knowledge of assembly pro gramming is not required User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 12 CHAPTER 1 Introduction to uC GUI 1 1 Requirements A target system is not required in order to develop software with uC GUI most of the software can be developed using the simulator However the final purpose is usually to be able to run the software on a target system Target s
307. nst unsigned char acFontSJIS13 0041 13 code 0041 X X OX x OX x XX _ X OX X XXX XXX f LATIN CAPITAL LETTER B static const unsigned char acFontSJIS13 0042 13 code 0042 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 263 XXXX 0X 0X Wy XXXXX LATIN CAPITAL LETTER C static const unsigned char acFontSJIS13 0043 13 code 0043 XX_X__ LX X X X X X pa XXX KATAKANA LETTER KE static const unsigned char acFontSJIS13 8350 26 code 8350 XX y X 4 X F XXXXX XXXX X X X X X X X FK X X F f X XX 5 KATAKANA LETTER GE static const unsigned char acFontSJIS13 8351 26 code 8351 XX X LX OX X LOXXXXXX XXX _ X X X X X X X X X F X F XX i KATAKANA LETTER KO static const unsigned char acFontSJIS13 8352 26 code 8352 f 2 XXXXXX XX gt lt gt gt lt OOXXXXXXX XXXX
308. nt13H_ ASCII 304 GUI Font13HB 1 306 GUL Font13HB ASCII 305 GUI Fonti6 1 307 GUI Fonti6 1HK 308 GUI Fonti6 ASCII 306 GUI Font16 HK 307 GUI Fonti6B 1 309 GUI Font16B ASCII 308 GUI Font24 1311 GUI Font24 ASCII 310 GUI Font24B 1312 GUI Font24B ASCII 312 GUI Font32 1314 GUL Font32_ASCII 313 GUI Font32B 1315 GUI Font32B_ ASCII 315 GUI Font4x6 318 GUI Font6x8 318 GUI Font6x9 318 GUI 8 1 302 GUI Font8 ASCII 301 GUI Font8x10 ASCII 319 GUL Font8x12 ASCII 320 GUI Font8x13 1 320 GUL Font8x13 ASCII 320 GUI Font8x15B 1 321 GUI Font8x15B ASCII 321 GUI Font8x16 322 GUI Font8x16x1x2 323 GUI Font8x16x2x2 324 2002 Micrium Technologies Corporation GUI Font8x16x3x3 324 GUI Font8x17 322 GUI Font8x18 323 GUI Font8x8 319 GUI Font8x9 319 GUL FontComic18B 1 310 GUI FontComic18B ASCII 309 GUL FontComic24B 1 317 GUI FontComic24B ASCII 316 GUL FontD24x32 325 GUL FontD32 325 GUI GetBkColor 107 GUI GetBkColorindex 107 GUI GetCharDistX 59 GUI GetColor 107 GUI GetColorindex 107 GUI GetDispPosX 43 GUI GetDispPosY 43 GUI GetFont 58 GUI GetFontDistY 60 GUI GetFontlInfo 60 GUI GetFontSizeY 61 GUI GetStringDistX 61 GUI GetTextAlign 40 GUI GetTime 244 GUI GETTIME 264 GUI GetYDistOfFont 61 GUI GetYSizeOfFont 61 GUI GotoX 42 GUI GotoXY 42 GUI GotoY 42 GUI Index2Color 109 GUI Init 30 GUI InvertRect 72 GUI IsInFont 62 GUI MagnifyPolygon 78 GUI MAXTASK 230 GUI MEMDEV Clear 116
309. ntrollers This driver has been tested with the following LCD controllers e Philips PCF8810 e Philips PCF8811 It should be assumed that it will also work with any controller of similar organization Bits per pixel Supported color depth is 1bpp User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 329 Interfaces Both 8 bit parallel simple bus and serial SPI interfaces are supported Display data RAM organization SEG SEG SEG SEG 0 1 2 ra P lt 4 2 lt jp DBO COM 1 1 DB1 COM 2 1 DB2 A COM3 8 DB4 COM 5 i DBS COM 6 i DB6 A y com7 DB7 A DBO DB1 DB2 DB3 S 5 DB4 DB5 DB6 y COMn DB7 The picture above shows the relation between the display memory and the SEG and COM lines of the LCD Additional RAM requirements of the driver This LCD driver may be used with or without a display data cache containing a com plete copy of the contents of the LCD data RAM If a cache is not used there are no additional RAM requirements It is recommended to use this driver with a data cache for faster LCD access The amount of memory used by the cache may be calculated as follows Size of RAM in bytes LCD_YSIZE 7 8 LCD_XSIZE Additional dri
310. nual for uC GUI 2002 Micrium Technologies Corporation 156 CHAPTER 12 The Window Manager WM Prototype void WM InvalidateArea GUI RECT pRect Parameter Meaning pRect Pointer to a GUI RECT structure Additionnal information Calling this function will tell the WM that the specified area is not updated This function can be used to invalidate any windows or parts of windows that overlap or intersect the area WM InvalidateRect Description Invalidates a specfied rectangular area of a window Prototype void WM InvalidateRect WM HWIN hWin GUI RECT pRect Parameter Meaning hWin Window handle PRECE Pointer to a GUI_RECT structure Additionnal information Calling this function will tell the WM that the specified area is not updated The next time wM_Paint is called to redraw the window the area will be redrawn as well WM_invalidateWindow Description Invalidates a specified window Prototype void WM_InvalidateWindow WM_HWIN hWin Parameter Meaning hWin Window handle Additionnal information Calling this function will tell the WM that the specified window is not updated WM MoveTor Description Moves a specified window to a certain position User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 157 Prototype void WM MoveTo WM HWIN hWin int dx int dy Parameter Meaning hWin Window h
311. ocedure however all drawing operations are executed in memory The final result is displayed on the screen only when all opera tions have been carried out with the advantage of no flickering This difference can be seen in the example in the following section which illustrates a sequence of draw ing operations both with and without the use of a memory device The distinction may be summarized as follows If no memory device is used the effects of drawing operations can be seen step by step with the disadvantage of a flickering display With a memory device the effects of all routines are made visible as a single operation No intermediate steps can actually be seen The advantage as explained above is that display flickering is completely eliminated and this is often desirable Memory devices are an additional optional software item and are not shipped with the uC GUI basic package The software for memory devices is located in the subdi rectory GUI Memdev User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 120 CHAPTER 10 Memory Devices 10 1 Using memory devices an illustration The following table shows screen shots of the same operations handled with and without a memory device The objective in both cases is identical a workpiece is to be rotated and labeled with the respective angle of rotation here 10 degrees In the first case without a memory device the screen must be cleared then th
312. of a configuration register of controller A Write to video memory display data RAM of F LCD WRITE MEM Index Data c ntroller F LCD_WRITE_REG Index Data Write to a configuration register of controller S LCD BUSWIDTH 16 Select bus width 8 16 of LCD controller CPU interface 2 2 Switch the M R signal to register access Not CD ENABLE ATC ACCESS applicable with all controllers PER Switch the M R signal to memory access Not 5 CDI ENABLE MEM ARCHES applicable with all controllers Activate to invert the endian mode swap the B LCD_SWAP_BYTE_ORDER 0 high and low bytes between CPU and LCD con troller when using a 16 bit bus interface LCD controller configuration common segment lines LCD controller lt n gt leftmost lowest X posi N LCD_XORG lt n gt 0 Hon N LCD YORG n 0 LCD controller n topmost lowest Y posi tion N LCD_FIRSTSEG lt n gt 0 LCD controller lt n gt first segment line used N iCD_LASTSEG lt n gt LCD XSIZE 1 LCD controller n last segment line used N LCD FIRSTCOM c n 0 LCD controller n first common line used N LASTCOM n LCD YSIZE 1 LCD controller n last common line used COM SEG lookup tables A LUT COM COM lookup table for controller iCD_LUT_SEG eem SEG lookup table for controller Miscellaneous N LCD NUM CONTROLLERS 1 Numbe
313. of controller CD READ REG Read the contents of a configuration register of controller LCD WRITE EM Write to video memory display data RAM of controller LCD WRITE REG Write to a configuration register of controller Additional configuration switches The following table shows optional configuration switches available for this driver Macro Explanation LCD BUSWIDTH Select bus width 8 16 of LCD controller CPU interface Default is 16 a Switch the M R signal to memory access Only used for SED1356 and CD ENABLE ACCESS SED1386 LCD controllers u Switch the M R signal to register access Only used for SED1356 and CD ENABLE REG ACCESS SED1386 LCD controllers s Inverts the endian mode swaps the high and low bytes between CPU LOB SWAP BEIE ORDER and LCD controller when using a 16 bit bus interface If set to 0 it disables the BitBLT engine If set to 1 the default value DOE BITBLT the driver will use all available hardware acceleration LCD ON Function replacement macro which switches the LCD on LCD Function replacement macro which switches the LCD off Special requirements for certain LCD controllers SED1386 or S1D13806 LCD SWAP RB The configuration switch LCD_SWAP_RB Swaps the red and blue components must be activated set to 1 by inserting the following line
314. ogItem hWin GUI CHECKBOX Check WM GetDialogItem hWin GUI ID CHECK1 SLIDER SetWidth WM GetDialogItem hWin GUI ID SLIDERO 5 SLIDER SetValue WM GetDialogItem hWin GUI ID SLIDERI 502 break default WM DefaultProc pMsg User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 235 The initialized dialog box now appears as follows with all widgets containing their initial values Dialog notification received LText EDIT widget RText EDIT widget 1 Hex 001234 Bin pontonionot 10100 VE Defining dialog behavior Once the dialog has been initialized all that remains is to add code to the dialog pro cedure which will define the behavior of the widgets making them fully operable Continuing with the same example the final dialog procedure is shown below KK IK HK KK K K K K K K K K K K K K K K K K K K k K k K K k k KOK SK SK K k SK K SK CK K K Ck kk KOK KOK kk ke ke KOK e ke e e K Dialog procedure static void cbCallback WM MESSAGE pMsg int NCode Id WM HWIN hEdit0 hEditl hEdit2 hEdit3 hListBox WM HWIN hWin pMsg gt hWin switch pMsg MsgId case WM INIT DIALOG Get window handles for all widgets hEditO WM GetDialogItem hWin GUI ID EDITO hEditl WM GetDialo
315. oid GUI DispHexAt U32 v I16P x I16P y U8 Len Parameter Meaning Value to display 16 bit x X position to write to in pixels of the client window Y position to write to in pixels of the client window Len No of digits to display Additionnal information As with decimal and binary values the least significant bit is rightmost Example Show value of AD converter at specified position 0 4 Related topics GUI DispDec GUI DispBin GUI DispHex 5 6 Version of wC GUI GUI GetVersionString Description Returns a string containing the current version of uC GUI Prototype const char GUI GetVersionString void Example Displays the current version at the current cursor position GUI_DispString GUI_GetVersionString User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 62 CHAPTER 5 Displaying Values User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 63 Chapter 6 2 D Graphic Library HC GUI contains a complete 2 D graphic library which should be sufficient for most applications The routines supplied with uC GUI can be used with or without clipping refer to Chapter 12 Window Manager and are based on fast and efficient algo rithms Currently only the DrawArc set of functions requires floating point calcula tions User s amp reference manual for uC GUI 2002 Micrium Technologies C
316. om GUI Init can be used to initialize hardware Prototype void GUI X Init void 21 4 Timing routines GUI X Delay Description Returns after a specified time period in milliseconds Prototype void GUI X Delay int Period Parameter Meaning Period Period in milliseconds GUI X Execldle Description Called only from non blocking functions of the window manager Prototype void GUI X ExecIdle void Additionnal information Called when there are no longer any messages which require processing In this case the GUI is up to date GUI X_GetTime Description Used by GUI GetTime to return the current system time in milliseconds Prototype int GUI X GetTime void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Return value 307 The current system time in milliseconds of type integer 21 5 Kernel interface routines Detailed descriptions for these routines may be found in Chapter 11 Execution Model Single Task Multitask 21 6 Debugging GUI X Description Returns debug information from p C GUI Prototype void GUI X Log const char s Parameter Meaning S Pointer to the string to be sent Additionnal information This routine is called by pC GUI to tramsmit error messages or warnings and is required if logging is enabled The GUI calls this function depending on the configura tion macro GUI
317. om any Windows font When using a Shift JIS font the functions used to display Shift JIS characters are linked automatically with the library For detailed information on how to create Shift JIS fonts please contact Micrium info micrium com A seperate FontConverter documentation describes all you need for an efficient way of implementing Shift JIS in your uC GUI projects 17 2 Example The following example defines a small font containing 6 characters A B C and the Shift JIS characters 0x8350 KATAKANA LETTER KE 0x8351 KATAKANA LETTER GE and 0x8352 KATAKANA LETTER KO A mixed string is then drawn onto the dis play The example can be found under Sample Misc ShiftJIS c OK KK IK IK A A A A A KK KK K K A K K K K kk I KOK KOK K KOK KOK ke ke KK Micrium Inc Empowering embedded systems uC GUI sample code Ck Ck ck ck k K k Ck k k lt k Ck Ck k k lt KKK k k K kk ck kk kk ck kk x kk Ck x k k x KK KKK KKK KKK ck kk Ck x x k kc KK KKK KKK File S Shiftgls c Purpose S Fame demonstrating ShiftJIS of pC GUI F include gui h RK HK IK I k K k k K K K K K K K K k K k K k K k SK SK SK SK A A A A A A K K K K Kk kk kk KOK KOK KOK K kk K K KK Definition of ShiftJIS font CK k CK kk k k k x x Ck lt lt x Ck k k k kk K k k k x x k k Ck x K kk kk x K x kk Sk K x Sk x lt x x KKK x x x x lt lt KKK LATIN CAPITAL LETTER A static co
318. om line used N LASTCOM3 LCD controller 3 last com line used N LCD XORG3 LCD controller 3 leftmost lowest X position N LCD YORG3 LCD controller 3 topmost lowest Y position When using more than one LCD controller be sure to remember to define the number of controllers used see macro LCD NUM CONTROLLERS in the next section Example The following diagram shows a hardware configuration using two LCD controllers The COM lines are driven by the common driver connected to controller 1 and are directly connected to the second LCD LCD 1 is connected to segment driver 1 using SEG lines 4 to 91 LCD 2 is driven by SEG 0 to SEG 87 of segment driver 2 User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 300 CHAPTER 20 Low Level Configuration LCD Controller 1 LCD Controller 2 Segment Driver 1 88 Pixels horizontal 88 Pixels horizontal ommon Driver 1 64 Pixels vertical 64 Pixels vertical Configuration for the above example define LCD FIRSTSEGO 4 Contr 0 first segment line used define LCD LASTSEGO 91 Contr 0 last segment line used define LCD FIRSTCOMO 0 Contr 0 first com line used define LCD LASTCOMO 63 Contr 0 last com line used define LCD XORGO 0 Contr 0 leftmost lowest x Pos define LCD YORGO 0 Contr 0 topmost lowest y Pos define LCD FIRSTSECI 0 Contr
319. on of desired functionality ck ck k k k k k K ck k k k ck ck k k k K K k k k ck K K k k k K ck ck k k kk ko k k ko ko lt K k k K lt lt ko x ko define GUI WINSUPPORT 1 Use window manager if true 1 define GUI SUPPORT TOUCH 1 Support a touch screen J KCKCKCKCk kk kk kk K K K K K K K K KOK KOK KOK KOK KOK KOK KOK Configuration of dynamic memory ACA k k K k ck ck ck k ck ck ck ck ck ck ck Ck Ck Ck k x lt CKCCK lt k CC CK CK lt k CC CK CK OCC lt lt x K x k K x x lt x x S x K K KKK x x x x x lt x M Dynamic memory is used for memory devices and window manager If you do not use these features there is no need for dynamic memory and it may be switched off completely This section can be erased ifndef GUI SIZE define GUI ALLOC SIZE 5000 Size of dynamic memory KK IK IK kk kk K kk K K K K KOK KOK KOK KOK KOK KOK KOK K KOK KOK KOK KOK E Configuration of fonts ck ck ck ck k k k k ck KKK k k ck lt K k k lt x k k ck lt ck ck k x K ck x x lt x k k x lt ck lt x x x x x ko ko ko If your create additionnal fonts usually using the uC GUI FontConvert these fonts need to be declared as extern in order to be able to use them This would be a good place to do this define GUI DEFAULT FONT amp GUI_Font 6x8 This font is used as default 21 2 GUI
320. only as an example To optimize the execution speed it must be adapted in assembler code For detailed information on how to write the output routine please take a look at the sample supplied with the driver or contact us Additional configuration switches The following table shows optional configuration switches available for this driver Macro Explanation LCD_TIMERINITO Timing value used by ISR for displaying pane 0 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 326 CHAPTER 22 LCD Drivers Macro Explanation LCD Timing value used by ISR for displaying pane 1 LCD ON Function replacement macro which switches the LCD on LCD DEF Function replacement macro which switches the LCD off 22 9 LCDMemC This driver like LCDMem is designed for a system without an LCD controller The difference is that LCDMemC supports color displays For more information on using the CPU instead of an LCD controller please see the previous section on the LCDMem driver Supported hardware Controllers None Bits per pixel Supported color depths are 3 and 6 bpp Interfaces The driver supports 1 4 8 bit interfaces from the CPU to the LCD User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Display data RAM organization 6 bits per pixel fixed palette 222 Byte 0 Byte 1 SEGO SEG1 lt gt lt
321. or Description Sets the edit field text color Prototype void EDIT SetBkColor EDIT Handle hObj int Index GUI COLOR Color Parameter Meaning hObj Handle of edit field Index Has to be 0 reserved for future use Color Color to be set EDIT SetValue Description Sets the current value of the edit field Only useful if binary decimal or hexadecimal edit mode is set Prototype void EDIT SetValue EDIT Handle hObj I32 Value Parameter Meaning hObj Handle of edit field Value New value GUI EditBin Description Edits a binary value at the current cursor position Prototype U32 GUI EditBin U32 Value U32 Min U32 Max int Len int xsize Parameter Meaning Value Value to be modified Min Minimum value Max Maximum value Len Number of digits to edit xsize Pixel size in X of the edit field Return value The new value will be returned if ENTER is pressed If ESC is pressed the old value is returned Additionnal information The routine returns after pressing ENTER or lt ESC gt The contents of the given text will be modified only if ENTER is pressed User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 191 GUI EditDec Description Edits a decimal value at the current cursor position Prototype U32 GUI EditDec I32 Value 132 Min I32 Max int Len int xsize int Shift U8 Flags
322. or It is available as WIDGET Progb ar c KKK IK IK A A A A A A A A A K K KOK K K I KOK KOK K K K KOK K K KKKKKKKKKKKKK Micrium Inc Empowering embedded systems pC GUI sample code KKK K K k k k k k x ck K x k k ck K k k k x lt lt Ck x k k k ck kk x k x kk k kk x x lt Sk lt KKK KKK x x lt File Purpose WIDGET Progbar c Simple demo shows the use of the PROGBAR widget 2002 Micrium Technologies Corporation A include gui h include progbar h KK IK kk kk kk kk K K K K K K K KOK KOK KOK K KOK K KOK KOK KOK KOK KOK KOK kCK KOK KOK KOK Ck ck k ck KOK KOK KOK KOK KOK ke kk Shows the use of progress bars KCKCkCk x k k k k ck x k k k k lt k ck ckckckckck lt x k k x lt lt lt K x k k x K x k k x lt ck x k k x lt ck ck ck ck ck ck ck ck ck ck ck lt lt ck ck KK KKK AY o ct tic void DemoProgBar void nt ROGBAR Handle ahProgBar 2 UI Clear UI SetColor GUI WHITE UI SetFont amp GUI Font8x160 UI DispStringAt Progress bar 100 80 Create em hProgBar 0 PROGBAR Create 100 100 100 20 WM SHOW hProgBar 1 PROGBAR Create 80 150 140 10 WM SHOW Use memory device optional for better looks ROGBAR EnableMemdev ahProgBar 0 ROGBAR EnableMemdev ahProgBar 1 UI Delay 1000 ROGBAR SetMinMax ahProgBar 1 0 500 hile 1 PROGBAR SetFont ahProg
323. or EDIT widgets Prototype const GUI FONT EDIT GetDefaultFont void Return value Default font used for EDIT widgets EDIT GetText Description Retrieves the user input of a specified edit field Prototype void EDIT GetText EDIT Handle hObj char sDest int MaxLen Parameter Meaning hObj Handle of edit field Specie Pointer to buffer MaxLen Size of buffer EDIT_GetValue Description Returns the current value of the edit field The current value is only useful if the edit field is in binary decimal or hexadecimal mode User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 187 Prototype 132 EDIT GetValue EDIT Handle hObj Parameter Meaning Handle of edit field Return value The current value EDIT SetBinMode Description Enables the binary edit mode of the edit field The given value can be modified in the given range Prototype void EDIT SetBinMode EDIT Handle hObj U32 Value 032 Min 032 Max Parameter Meaning hObj Handle of edit field Value Value to be modified Min Minimum value Max Maximum value EDIT SetBkColor Description Sets the edit field background color Prototype void EDIT SetBkColor EDIT Handle hObj int Index GUI COLOR Color Parameter Meaning hObj Handle of edit field Index Has to be 0 reserved for future use Color Color to be set
324. or have to and save it as a C file The C file may then be compiled allowing the font to be shown on your display with uC GUI on demand The character codes 0x00 Ox1F and 0x80 Ox9F are disabled by default The fol lowing is a sample screen shot of the font converter with a font loaded User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 92 CHAPTER 7 Fonts pC GUI FontConvert V2 16b ArialBlack1 8444 File Edit View Arial Black height 18 current char OOBS current width 9 max width 22 disabled no The font converter is described in a separate documentation which can be obtained by request from Micrium Inc info micrium com User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 93 Chapter 8 Bitmap Converter Bitmaps which be used with uC GUI are normally defined as GUI BITMAP struc tures in C The structures or rather the picture data which is referenced by these structures can be quite large It is time consuming and inefficient to generate these bitmaps manually especially if you are dealing with sizable images and multi ple shades of gray or colors We therefore recommend using the bitmap converter The bitmap converter is a Windows program which is easy to use Simply load a bit map in the form of a bmp file into the program convert it if you want or have to and save it as a C file which can then be
325. orporation 64 CHAPTER 6 2 D Graphic Library 6 1 API reference graphics The table below lists the available graphic related routines in alphabetical order within their respective categories Detailed descriptions can be found in the sections that follow Routine Explanation Drawing modes GUI SetDrawMode Set the drawing mode Basic drawing routines UI ClearRect Fill a rectangular area with the background color UI DrawPixel Draw a single pixel UI DrawPoint Draw a point UI FillRect Draw a filled rectangle amp 63 UI InvertRect Invert a rectangular area Drawing bitmaps GUI DrawBitmap Draw a bitmap GUI DrawBitmapExp Draw a bitmap GUI DrawBitmapMag Draw a magnified bitmap Drawing lines GUI DrawHLine Draw a horizontal line GUI DrawLine Draw a line GUI DrawLineRel Draw a line from the current position to endpoint by X and Y distance GUI DrawLineTo Draws a line from the current position to endpoint by X and Y position GUI DrawPolyLine Draw a polyline GUI DrawVLine Draw a vertical line Drawing polygons _DrawPolygon Draw a polygon EnlargePolygon Enlarge a polygon _FillPolygon Draw a filled polygon _MagnifyPolygon Magnify a polygon 2 G G C E F F T4 UI RotatePolygon Rotate a polygon by a specified angle Drawing circ
326. ossible to exploit the invalidation logic of the window manager Not using callbacks You do not have to use callback routines but in doing so the WM loses the ability to manage redrawing updating of the windows It is also possible to mix for example having some windows use callbacks and others not However if a window does not use the callback mechanism your application is responsible for updating its contents Warning When not using the callback mechanism it is your responsibility to manage screen updates 12 4 Using callback routines In order to create a window with a callback you must have a callback routine The name of the routine will be the name used to specify the pointer when creating a win dow with that particular callback function the co parameter in WM CreateWindow All callback routines must have the following prototype Prototype void callback WM MESSAGE pMsg Parameter Meaning pMsg Pointer to message The action performed by the callback routine depends on the type of message it receives The prototype above is usually followed by a switch statement which defines different behaviors for different messages using one or more case state ments typically at least PAINT Example Creates a callback routine to automatically redraw a window void WinHandler WM MESSAGE pMsg 1 switch pMsg MsgId case WM PAINT GUI SetBkColor OxFFOO GUI Clear GUI DispS
327. otype GUI DRAWMODE GUI SetDrawMode GUI DRAWMODE mode Parameter Meaning mode Drawing mode to set May be a value returned by any routine which sets the drawing mode or one of the constants below Permitted values for parameter mode GUI DRAWMODE NORMAL Default Draws points lines areas bitmaps GUI DRAWMODE XOR Inverts points lines areas when overwriting the color of another object on the display Return value The selected drawing mode Additional Information In addition to setting the drawing mode this routine may also be used to restore a drawing mode that has previously been changed If using colors an inverted pixel is calculated as follows New pixel color 2 number of colors actual pixel color 1 Example Showing two circles the second one XOR combined with the first GUI_Clear GUI_SetDrawMode GUI_DRAWMODE_NORMAL GUI_FillCircle 120 64 40 GUI SetDrawMode GUI DRAWMODE XOR GUI FillCircle 140 84 40 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 66 CHAPTER 6 2 D Graphic Library Screen shot for preceeding example 6 3 Basic drawing routines The basic drawing routines allow drawing of individual points horizontal and vertical lines and shapes at any position on the display Any available drawing mode can be used Since these routines are called frequently in most applications they ar
328. ound to background is 2 x 2 4 The next line is drawn with an antialiasing factor of 3 so there are 3 x 3 9 shades and so on Factor 4 should be sufficient for most applications Increasing the anti aliasing factor further does not improve the result dramatically but increases the cal culation time User s amp reference manual for HC GUI 2002 Micrium Technologies Corporation 243 Antialiased Fonts Two types of antialiased fonts low quality 2bpp and high quality 4bpp are sup ported The routines needed to display these fonts are automatically linked when using them The following table shows the effect on drawing the character C with out antialiasing and with both types of antialiased fonts Font type Black on white White on black Standard no antialiasing 1 bpp 2 shades Low quality antialiased 2 bpp 4 shades High quality antialiased 4 bpp 16 shades Antialiased fonts can be created with the pC GUI font converter The general purpose of using antialiased fonts is to improve the appearance of text While the effect of using high quality antialiasing will be more visually pleasing than low quality com putation time and memory consumption will increase proportionally Low quality 2bpp fonts require twice the memory of non antialiased 1bpp fonts high quality 4bpp fonts require four times the memory High resolution coordinates When drawing items using antia
329. out having to refresh the contents User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 336 CHAPTER 23 LCD Driver API 23 3 Drawing group LCD LO DrawBitMap Description Draws a pre converted bitmap Prototype LCD LO DrawBitMap int x0 int 0 int Xsize int Ysize int BitsPerPixel int BytesPerLine const U8 pData int Diff const LCD PIXELINDEX pTrans Parameter Meaning 0 Upper left X position of bitmap to draw 0 Upper left Y position of bitmap to draw Xsize Number of pixels in horizontal direction Ysize Number of pixels in vertical direction BitsPerPixel Number of bits per pixel BytesPerLine Number of bytes per line of the image pData Pointer to the actual image the data that defines what the bitmap looks like Number of pixels to skip from the left side LCD LO DrawHLine Description Draws a horizontal line one pixel thick at a specified position using the current fore ground color Prototype void LCD 10 DrawHLine int x0 int y int x1 Parameter Meaning 0 Start position of line y Y position of line to draw End position of line Additionnal information With most LCD controllers this routine executes very quickly because multiple pixels can be set at once and no calculations are needed If it is clear that horizontal lines are to be drawn this routine executes faster than the DrawL
330. ow User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 78 Example Draw concentric circles void ShowCircles void int i for i 10 GUI_DrawCircle 120 60 i CHAPTER 6 2 D Graphic Library 1 lt 50 i Screen shot for preceeding example GUI FillCircle De scription Draws a filled circle of specified dimensions at a specified position in the current win dow Prototype void GUI FillCircle int x0 int y0 int r Parameter Meaning x0 X position of the center of the circle in pixels of the client window yo Y position of the center of the circle in pixels of the client window r Radius of the circle half the diameter Minimum 0 will result in a point Maximum 180 Additional Information This routine cannot handle a radius in excess of 180 Example GUI FillCircle 120 60 50 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 79 Screen shot for preceeding example 6 8 Drawing ellipses GUI DrawEllipse Description Draws an ellipse of specified dimensions at a specified position in the current window Prototype void GUI DrawEllipse int x0 int yO int rx Parameter Meaning x0 X position of the center of the circle in pixels of the client window y0 Y position of the center of the circle in pixels of the client window rx X radius of the e
331. p AutoDev Use GUI AUTODEV object for drawing amp Param AutoDevInfo amp Draw amp Param GUI MEMDEV DeleteAuto amp AutoDev Delete GUI AUTODEV object Example for using an auto device object The following example demonstrates the use of an auto device object It can be found under Source Misc AutoDev c A scale with a moving needle is drawn in the background and a small text is written in the foreground The needle is drawn with the antialiasing feature of pC GUI High resolution antialiasing is used here to improve the appearance of the moving needle For more information please see Chapter 15 Antialiasing RK HK IK IK RA A A A A KK KK A A Ck Ck kk KOK kk KOK KOK ke K KOK K kk KOK Micrium Inc Empowering embedded systems x uC GUI sample code Ck Ck ck ck k k k Ck k k k k lt k k Sk ck k x k k k K kk ck kk kk ck x k ck kk Ck x K k k ck kk x k x lt x ck kk x x lt Sk x x k lt KKK KK KKK File AutoDev c Purpose Example demonstrating the use of GUI_AUTODEV objects User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 133 A include gui h include lt math h gt include stddef h ifndef WIN32 include rtos h endif define countof Obj sizeof 0bj sizeof 0bj 0 define DEG2RAD 3 1415926 180 KK IK IK kk kk kk K K K K K K K K K KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK KOK K
332. p converter menu are available as com mands and any number of functions may be performed on a bitmap in one command line Commands are entered using the following format BmpCvt lt filename gt bmp command If more than one command is used one space is typed between each For example a bitmap with the name MicriumLlogo is converted into Best palette format and saved as a C file named logo2 all at once by entering the following at the command prompt BmpCvt MicriumLogo200 bmp convertintobestpalett saveaslogo2 1 exit Note that while the file to be loaded into the bitmap converter always includes its bmp extension no file extension is written in the saveas command An integer is used instead to specify the desired file type The number 1 in the saveas command above designates C with palette The exit command automatically closes the pro gram upon completion See the table below for more information Valid command line options The following table lists all permitted bitmap converter commands It can also be viewed at any time by entering BmpCvt at the command prompt Command Explanation convertintobw Convert to BW convertintogray4 Convert to Gray4 16 Convert to Gray16 convertintogray64 Convert to Gray64 convertintogray256 Convert to Gray256 convertintolll Convert to 111 convertinto2z22 Convert to 222 convertinto233 Convert to 233
333. pDrawItContext XPos Text 100 pDrawItContext YPos Text 5 draw polygon GUI SetColor GUI BLUE GUI FillPolygon pDrawItContext aPointsDest SIZE OF ARRAY aPoints 160 120 draw foreground GUI SetColor GUI RED GUI_FillRect 220 pDrawItContext XPos Text pDrawlItContext YPos Text 5 220 pDrawItContext XPos Text 100 pDrawItContext YPos Text 25 KK IK IK IK kk k K K K K K K K K KOK KOK KOK KOK KOK KOK KOK KOK A KOK KOK KOK KOK kCK Ck Ck k ck k ck KOK KOK KOK KOK ke ke KOK Demonstrates the banding memory device ck ck k K ck k k k k ck Ck ck k k k x ck k k k ck ck Ck ck k k x lt ck ck Ck ck kk ck k k x K lt K k ck k K ck K k lt k k ck k ck k k k k k k k k k ko Z define USE BANDING MEMDEV 1 Set to 0 for drawing without banding memory device void DemoBandingMemdev void 1 irit d int XSize LCD GET XSIZE int YSize LCD GET YSIZE tDrawltContext DrawlItContext GUI SetFont amp GUI Font8x9 GUI SetColor GUI WHITE GUI DispStringHCenterAt Banding memory device nwithout flickering XSize 2 40 DrawItContext XPos Poly XSize 2 DrawItContext YPos Poly YSize 2 DrawItContext YPos Text YSize 2 4 for i 0 i lt XSize 100 itt float angle i 3 1415926 60 DrawltContext XPos Text i User s amp reference manual for uC GUI 2
334. pFloatMin Description Displays a floating point value with a minimum number of decimals to the right of the decimal point at the current text position in the current window using the current font Prototype void GUI DispFloatMin float f char Fract Parameter Meaning Value to display Minimum 1 2 E 38 maximum 3 4 E38 Minimum no of characters to display V Additionnal information Leading zeros are suppressed If the value is negative a minus sign is shown The length need not be specified the minimum length will automatically be used If values have to be aligned but differ in the number of digits this function is not a good choice Try one of the functions that specify the number of digits GUI DispSFloatFix Description Displays a floating point value with sign with a specified number of total characters and a specified number of characters to the right of the decimal point in the current window using the current font Prototype void GUI DispSFloatFix float v char Len char Decs Parameter Meaning Value to display id Minimum 1 2 E 38 maximum 3 4 E38 Len No of digits to display max 9 Decs No of digits to show to right of decimal point User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 59 Additionnal information Leading zeros are not suppressed A sign is always shown in front of the value GUI
335. pport is enabled see below GUI OS 0 Activate to enable multitasking support GUI MAXTASK 4 GUI MAXTASK Description Defines the maximum number of tasks from which pu C GUI is called to access the dis play User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 142 CHAPTER 11 Execution Model Single Task Multitask Type Numerical value Additionnal information This function is only relevant when GUI OS is activated GUI OS Description Enables multitasking support by activating the module GUITask Type Binary switch 0 inactive multitask support disabled default 1 active multitask support enabled 11 6 Kernel interface routine API An RTOS usually offers a mechanism called a resource semaphore in which a task using a particular resource claims that resource before actually using it The display is an example of a resource that needs to be protected with a resource semaphore HC GUI uses the macro GUI_USE to call the function Use before it accesses the display or before it uses a critical internal data structure In a similar way it calls GUI Unuse after accessing the display or using the data structure This is done in the module GUITask c GUITask c in turn uses the GUI kernel interface routines shown in the table below These routines prefixed x since they are high level hardware dependent functions They must be adapted to the real
336. ption Makes a specified window visible Prototype void WM ShowWindow WM HWIN hWin Parameter Meaning hWin Window handle Additionnal information The window will not immediately be visible after calling this function It will be redrawn when executing wM Exec If you need to show draw the window immedi ately you should calll ww Paint 12 6 Advanced functions WM Activate Description Activates the window manager Prototype void WM Activate void Additionnal information The WM is activated by default after initialization This function only needs to be called if there has been a previous call of WM_Deactivate User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 159 WM BringToBottom Description Places a specified window underneath its siblings Prototype void WM BringToBottom WM HWIN hWin Parameter Meaning hWin Window handle Additionnal information The window will be placed underneath all other sibling windows but will remain in front of its parent WM BringToTop Description Places a specified window on top of its siblings Prototype void WM BringToTop WM HWIN hWin Parameter Meaning hWin Window handle Additionnal information The window will be placed on top of all other sibling windows and its parent WM ClirHasTrans Description Clears the nas transparency flag sets it to O Prototyp
337. r countof aPointer GUI MEMDEV DrawAuto amp aAuto 1 amp Param AutoInfo Draw amp Param ifdef WIN32 GUI Delay 2 endif Angle Angle J KCKCKCKCKCKCk kk I K K K kkk k kk k k A K K K ck kck KOK KOK KOK K K K K K T main CK k CK kk k k kk x k ek Ck k kk x x x K x k Ck K x kk Kk Kk kk Sk kk kk x K x k kk x x K KKK KKK KK KKK xy void main void GUI Init ShowHiresAntialiasing User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 255 Chapter 16 Unicode The Unicode code standard is a 16 bit character encoding scheme All of the charac ters available worldwide are in a single 16 bit character set which works worldwide The Unicode standard is defined by the Unicode consortium HC GUI can display individual characters or strings in Unicode although it is most common to simply use mixed strings which can have any number of Unicode sequences within one ASCII string User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 256 CHAPTER 16 Unicode 16 1 Displaying Unicode characters Unicode characters The character output routine used by uC GUI GUI DispChar does always take unsigned 16 bit value U16 and has the basic ability to display a character defined by Unicode It simply requires a font which contains the character you want to dis play Displaying Unicode
338. r API Please note that this feature is intended only for some LCD controllers with simple bus interface for which it is important to access the controller as little as possible in order to maximize speed For other controllers this switch has no effect LCD TIMERINITO Description Timing value used by an interrupt service routine for displaying pane 0 of a pixel Type Numerical value Additionnal information This macro is only relevant when no LCD controller is used since it is then the job of the CPU to update the display in an interrupt service routine LCD TIMERINIT1 Description Timing value used by an interrupt service routine for displaying pane 1 of a pixel Type Numerical value Additionnal information This macro is only relevant when no LCD controller is used since it is then the job of the CPU to update the display in an interrupt service routine LCD ON Description Switches the LCD on Type Function replacement LCD OFF Description Switches the LCD off Type Function replacement pC GUI User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 303 Chapter 21 High Level Configuration High level configuration is relatively simple In the beginning you can normally use the existing configuration files for example those used in the simulation Only if there is a need to fine tune the system or to minimize memory consumption does the high level configurat
339. r activates LCD if handle is 0 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 124 CHAPTER 10 Memory Devices Prototype void GUI MEMDEV Select GUI MEMDEV Handle hMem Parameter Meaning hMem Handle to memory device 10 5 Advanced features GUI MEMDEV Clear Description Marks the entire contents of a memory device as unchanged Prototype void GUI MEMDEV Clear GUI MEMDEV Handle hMem Parameter Meaning hMem Handle to memory device Additional Information The next drawing operation with GUI MEMDEV CopyToLCD Will then write only the bytes modified between GUI MEMDEV Clear and GUI MEMDEV CopyTOoLCD GUI MEMDEV CopyFromLCD Description Copies the contents of a memory device from LCD data video memory to the mem ory device In other words read back the contents of the LCD to the memory device Prototype void GUI MEMDEV CopyFromLCD GUI MEMDEV Handle hMem Parameter Meaning hMem Handle to memory device GUI MEMDEV CopyToLCDAA Description Copies the contents of a memory device antialiased from memory to the LCD Prototype void GUI MEMDEV CopyToLCDAA GUI MEMDEV Handle MemDev Parameter Meaning hMem Handle to memory device User s amp reference manual for uC GUI 2002
340. r input of the EDIT widget If you need to erase the last character you must call GUI_ID_BACKSPACE If the maximum count of characters has been reached another character will not be added EDIT_Creat e Description Creates an EDIT widget of a specified size at a specified location Prototype User s amp reference EDIT Handle manual for uC GUI EDIT Create int x0 int y0 int xsize int ysize 2002 Micrium Technologies Corporation 186 CHAPTER 13 Window Objects Widgets int ID int MaxLen int Flags Parameter Meaning x Leftmost pixel of the edit field in desktop coordinates 0 Topmost pixel of the edit field in desktop coordinates xsize Horizontal size of the edit field in pixels ysize Vertical size of the edit field in pixels ID ID to be returned MaxLen Maximum count of characters Window create flags Typically WM SHOW in order to make the widget visible Flags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values Return value Handle for the created EDIT widget O if the routine fails EDIT Createlndirect Prototype explained at the beginning of the chapter The element Flags of the resource passed as parameter is not used but the maximum number of characters in the edit field is specified as the Para element EDIT GetDefaultFont Description Sets the default font used f
341. r is opened as an empty win s dow Step 2 Load a bitmap into the bitmap converter Choose File Open Locate the document you want to open and click Open must be a bmp file In this example the file MicriumLogo bmp is chosen Step 3 The bitmap converter displays the loaded source bitmap Y2 30b C Logos Wc riumLogeD lue bmp Fe Ves lex Hep In this example the source bitmap is in full color TE RGB mode It therefore must be converted to a De ied palette format before a C file can be generated User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 96 CHAPTER 8 Bitmap Converter Procedure Screen shot Step 4 Convert the image if necessary Choose Image Convert Into Select the desired palette In this example the option Best palette is chosen Edit Help Resolution Transparency Colors BW Zoom Flip Gray Transparent Rotate Gayl Invert Gray64 Gray256 1 BPP 2 BPP 4 BPP 8 BPP Info 8 BPP CEN sbi Color 111 4 BPP 6 bit Color 222 8 BPP 8 bit Color 233 8 BPP 8 bit Color 323 8 BPP 8 bit Color 332 8 BPP 8 BPP 8 bit Color 8666 RGB 24 BPP Custom palette Step 5 The bitmap converter displays the con verted bitmap Y ucf mpCvt Y2 30b C Logos WicriumLopoDlue bmp DER Fie FR nage Hep In this example the image is
342. r of LCD controllers used Deactivate to disable use of display data cache B LCD CACHE 1 which slows down the speed of the driver Not applicable with all drivers Deactivate to disable BitBLT engine If set to 1 B ACID AUS 1 the driver will use all available hardware accel eration Activate to enable cache control functions of B LCD SUPPORT CACHECONTROL 0 LCD LO ControlCache driver API Not applicable with all controllers Et EE Timing value used by ISR for displaying pane 0 N LED EIER UL when using CPU as controller N Ll Timing value used by ISR for displaying pane 1 when using CPU as controller O Function replacement macro which switches the E LCD on F LCD OFF 7 Function replacement macro which switches the LCD off How to configure the LCD We recommend the following procedure 1 Make a copy of a configuration file of similar configuration Several configuration samples for your particular LCD controller can be found in the folder sam User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 284 CHAPTER 20 Low Level Configuration ple LCDConf xxx where xxx is your LCD driver 2 Configure the bus interface by defining the appropriate simple bus or full bus macros Define the size of your LCD LCD XSIZE LCD YSIZE Select the controller used in your system as well as the appropriate bpp and the palette mode LCD CONTROLLER LC
343. r own callback function The example is available as WM_Redraw c in the samples shipped with un C GUI KK IK HK k k k K kk K K K K K K KC KC K K kk K k k K K k k k KK k k k k IR A CK K K Ck kk kk ke ke ke ke ke ke ke ke e ke e k Micrium Inc Empowering embedded systems is uC GUI sample code kk ck ck k k KKK KKK KKK KKK KK KKK KKK KK KKK KKK KKK KKK 1k Sk ck k k ck kk ck kk kk Sk kk K x ko kk kc KKK KKK File WM Redraw c Purpose Demonstrates the redrawing mechanism of the window manager include GUI H 8K IK HK kk Kk K K K K K K K kk K K KC KC KK KK KK K K K K SK SK IR A KOK A CK A kk kk kk ke ke ke ke ke ke ke ke e e Callback routine for background window k k k K K k k k KKK KKK KKK k k k K k k K lt K K x K K KKK k k k KKK K kk K lt Ck x K ko kc KK KKK x lt lt static void cbBackgroundWin WM MESSAGE pMsg switch pMsg MsgId case WM PAINT GUI Clear default WM DefaultProc pMso 8K IK HK k k k k K K A KARA IR A A A KK A KOK KOK kk ke ke ke ke ke ke ke ke e Callback routine for foreground window k k ck ck ck k KKK KKK KKK KKK KKK KK KKK k k lt lt K K K lt lt ko ck k k k K lt lt K lt k K kk Ck K KKK KKK KK KKK static void cbForegroundWin WM MESSAGE pMsg switch pMsg MsgId case WM PAINT GUI SetBkColor GUI GREEN GUI Clear
344. r s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 249 If working in high resolution mode the coordinates must be in high resolution coor dinates Otherwise they must be specified in pixels User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 250 CHAPTER 15 Antialiasing 15 5 Examples Different antialiasing factors The following example creates diagonal lines with and without antialiasing The source code can be found under Sample Misc AntialiasedLines c A A K SK K KC Kk K K KOK kk kk KOK KOK KOK K KOK kk KK Micrium Inc Empowering embedded systems uC GUI sample code Ck Ck ck ck k k k ck k k k k Ck ck k k KKK KKK ck kk ck k x kk ck kk x kk lt x k K x lt kk x k x lt x ck kk x kk Ck x KKK ko ko kc x x x lt lt File AntialiasedLines c Purpose Shows lines with different antialiasing qualities include GUI H lt HK IK KR A A A A A A A K KOK KOK KOK KOK KOK KOK KOK K K K Show lines with different antialiasing qualities Dk ck k ck K Ck k k k ck k k k K ck ck ck ck k k lt ck ck ck ck k k lt ck ck ck k ck k ck ck k k k ck ck k k k k kk k k k ko k k k k Mk Sk k k k k ko ko n m ct w tic void DemoAntialiasing void nt Ayo xla 2 nt y 2 Set drawing attributes UI_SetColor GUI_BLACK UI_SetBkColor GUI_WHITE UI_SetPenShape GUI_
345. r uC GUI 2002 Micrium Technologies Corporation 152 CHAPTER 12 The Window Manager WM U8 Style WM CALLBACK cb int NumExtraBytes Parameter Meaning x0 Upper left X position relative to parent window yo Upper left Y position relative to parent window width X size of window If 0 X size of client area of parent window height Y size of window If 0 Y size of client area of parent window hWinParent Handle of parent window Style Window create flags see WM CreateWindow eb Pointer to callback routine or NULL if no callback used Number of extra bytes to be allocated normally 0 Return value Handle for the child window Additionnal information If the hWinParent parameter is set to 0 the background window is used as parent A child window is placed on top of its parent and any previous siblings by default so that if their Z positions are not changed the youngest window will always be top most The Z positions of siblings may be changed although they will always remain on top of their parent regardless of their order WM DeleteWindow Description Deletes a specified window Prototype void WM DeleteWindow WM HWIN hWin Parameter Meaning hWin Window handle Additionnal information Before the window is deleted it receives DELETE message This message is typ ically used to delete any objects widgets it uses and to free memory dynamically allocated by
346. rLine The bitmap can be shown at any point in the client area Usually the bitmap converter is used to generate bitmaps Example extern const GUI BITMAP bmMicriumLogo declare external Bitmap void main GUI Init GUI DrawBitmap amp bmMicriumLogo 45 20 User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 69 Screen shot for preceeding example Description Micrium GUI DrawBitmapExp Same function as GUI DrawBitmap but with extended parameter settings Prototype void GUI DrawBitmapExp int 0 int XSize int YSize XMul int YMul int BitsPerPixel int BytesPerLine const U8 pData const GUI LOGPALETTE pPal int int Parameter Meaning x0 X position of the upper left corner of the bitmap in the display yo Y position of the upper left corner of the bitmap in the display Xsize Number of pixels in horizontal direction Valid range 1 255 Ysize Number of pixels in vertical direction Valid range 1 255 XMUL Scale factor of X direction YMul Scale factor of Y direction BitsPerPixel Number of bits per pixel BytesPerLine Number of bytes per line of the image pData Pointer to the actual image the data that defines what the bitmap looks like pPal Pointer to a GUI LOGPALETTE structure DrawBitmapMag Description This routine makes it possible to scale a bitmap on the display Prototype voi
347. rameter Meaning Index Index of the color to be used Return value The selected foreground color index 9 8 Index amp color conversion GUI Color2Index Returns the index of a specified RGB color value Prototype int GUI Color2Index GUI COLOR Color Parameter Meaning Color RGB value of the color to be converted User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 116 CHAPTER 9 Colors Return value The color index GUI Index2Color Returns the RGB color value of a specified index Prototype int GUI Index2Color int Index Parameter Meaning Index Index of the color to be converted Return value The RGB color value 9 9 Lookup table LUT group These functions are optional and will work only if supported by the LCD controller hardware An LCD controller with LUT hardware is required Please consult the man ual for the LCD controller you are using for more information on LUTs GUI InitLUT Description Initializes the lookup table of the LCD controller s Prototype void LCD InitLUT void Additional information The lookup table needs to be enabled by the LCD INITCONTROLLER macro for this function to have any effect GUI SetLUTColor Description Modifies a single entry to the color table and the LUT of the LCD controller s Prototype void GUI SetLUTColor U8 Pos GUI COLOR Color Parameter Meanin
348. ration 328 CHAPTER 22 LCD Drivers 3 bits per pixel fixed palette mode 111 When using this mode only one pane exists for each pixel RAM requirements of the driver The driver only handles a memory area containing the display data The required size of the display memory area may be calculated as follows 6 bits per pixel fixed palette mode 222 Size of RAM in bytes LCD XSIZE 7 8 3 2 3 bits per pixel fixed palette mode 111 Size of RAM in bytes LCD XSIZE 7 8 3 Additional driver functions None Hardware configuration Normally the hardware interface is an interrupt service routine ISR which updates the LCD An output routine written in C code is shipped with pC GUI This routine should serve only as an example To optimize the execution speed it must be adapted in assembler code For detailed information on how to write the output routine please take a look at the sample supplied with the driver or contact us Additional configuration switches The following table shows optional configuration switches available for this driver Macro Explanation LCD TIMERINITO Timing value used by ISR for displaying pane O LCD TIMERINITl Timing value used by ISR for displaying pane 1 only used by 6 bpp mode LOD ON Function replacement macro which switches the LCD on LCD OFF Function replacement macro which switches the LCD off 22 10 LCDPage1bpp Supported hardware Co
349. rd to modify string 160 0 Create edit widget hEdit EDIT Create 50 20 219 25 sizeof aBuffer O Modify edit widget EDIT SetText hEdit Press ENTER when done EDIT SetFont hEdit amp GUI Font8x160 EDIT SetTextColor hEdit 0 GUI RED Handle keyboard until ESC or ENTER is pressed do Key GUI WaitKey switch Key case GUI ID ESCAPE case GUI ID CANCEL User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 193 break default EDIT AddKey hEdit Key while Key GUI ID ESCAPE amp amp Key GUI ID ENTER amp amp Key 0 Fetch result from edit widget if Key GUI ID ENTER EDIT GetText hEdit aBuffer sizeof aBuffer else aBuffer 0 0 EDIT Delete hEdit GUI DispStringHCenterAt aBuffer 160 50 return Key 8K IK HK k k k Kk K K K K K K K K K K K K K K K KOK KOK KOK KOK KOK KOK KOK KOK KOK K K K KOK K KOK KOK KOK KOK KOK KOK KOK KOK main ck ck ck ck ck K lt k ck ck KKK ck ck ck ck ck ck lt k ck ck k K ck ck ck ck ck k ck ck k k K k kk kk void main void GUI Init Edit while 1 GUI Delay 100 Screen shot of above example Use keyboard to modify string Press lt ENTER gt when done 13 6 FRAMEWIN
350. rence values nenne nhanh nea sena rea sena nnn nnn 46 6 2 Displaying decimal 1 4 E 46 6 3 Displaying floating point 4 menn 50 6 4 Displaying binary values suu m l a RI d EUER n eta UE 54 6 5 Displaying hexadecimal 6 55 TM PONI E MCI hah Dacha susu a bua 57 7 1 i eoo exi nmt eii as il t e t n C od ue e i clade 58 7 2 Selection Of a TONG usse exerc ri ER ER au uiay B 58 7 3 Eontsrelated FUNCTIONS 2 teur DI T en A EE REUS 59 7 4 Gharacter sete s de dx o xp Ep dx E FERME hisses 62 7 5 Adding ccr cette 65 7 6 yu C FontConvert exe font converter editor 65 8 2 D Graphic Library ioco Epiro trc a dI o DE erus 67 8 1 API reference ice eno dr e ere dees ee El p I E Reit eee 68 8 2 Drawing modes uie onte ads ETE FEAR secur REPRE RE EAT ede 69 8 3 Basic pU eels 70 8 4 Drawing bitmaps
351. rfaces The driver supports 8 bit parallel simple bus interfaces Display data RAM organization E EG 1 EG 2 T E lt 60 1 SEG l SEG pl tt SEG n COMO ByteO Byte1 Byte2 Byte n COM 1 4 COM 2 com n The picture above shows the relation between the display memory and the SEG and COM lines of the LCD Additional RAM requirements None Additional driver functions None User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 317 Hardware configuration This driver accesses the hardware with a simple bus interface as described in Chapter 20 Low Level Configuration The following table lists the macros which must be defined for hardware access Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller READ AO Read a byte from LCD controller with A line low iCD_READ 1 Read a byte from LCD controller with A line high LCD_WRITE_AO Write a byte to LCD controller with A line low LCD WRITE AL Write a byte to LCD controller with A line high Additional configuration switches None Special requirements for certain LCD controllers None 22 5 LCD15E05 Supported hardware Controllers This driver has been tested with the following LCD controllers e Epson S1D15E05 It should be assumed that it will also wo
352. riptions follow Routine Explanation GUI MOUSE GetState Return the current state of the mouse GUI MOUSE StoreState Store the current state of the mouse GUI MOUSE GetState Description Returns the current state of the mouse Prototype int GUI MOUSE GetState GUI STATE pState Parameter Meaning potate Pointer to a structure of type GUI_PID_STATE Return value 1 if mouse is currently pressed 0 if not pressed Additional information This function will call GUI PID GetsState GUI MOUSE StoreState Description Stores the current state of the mouse Prototype void GUI MOUSE StoreState const GUI PID STATE pState Parameter Meaning pstate Pointer to a structure of type GUI PID STATE Additional information This function will call GUI StoreState User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 270 CHAPTER 18 Input Devices PS2 mouse driver API The table below lists the available mouse driver routines in alphabetical order These functions only apply if you are using the PS2 mouse driver included with pi C GUI Routine Explanation GUI MOUSE DRIVER PS2 Init Initialize the mouse driver GUI MOUSE DRIVER PS2 OnRx Called form receive interrupt routines GUI MOUSE DRIVER P392 Init Description Initializes the mouse driver Prototype void G
353. rk with any controller of similar organization Bits per pixel Supported color depth is 2 bpp Interfaces Both 8 bit parallel simple bus and serial SPI interfaces are supported User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 318 CHAPTER 22 LCD Drivers Display data RAM organization SEG SEG SEG SEG 0 1 2 ra 4 gt 4 pric a A pBO COM DB1 DB2 DB3 DB4 DB5 DB6 DB7 lt 1 0 P COM 2 gt lt COM 3 DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 Page n COM n Y The picture above shows the relation between the display memory and the SEG and COM lines of the LCD Additional RAM requirements of the driver This LCD driver may be used with or without a display data cache containing a com plete copy of the contents of the LCD data RAM If a cache is not used there are no additional RAM requirements It is recommended to use this driver with a data cache for faster LCD access The amount of memory used by the cache may be calculated as follows Size of RAM in bytes LCD_YSIZE 7 8 LCD_XSIZE Additional driver functions None User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Hardware configuration This driv
354. rmat Of course the results vary depending on the colors that can be displayed the routine requires a display size of 320 240 in order to show all colors The routine is used to demon strate the effect of the different color settings for displays It may also be used by a test program to verify the functionality of the display to check available colors and grayscales as well as to correct color conversion The screen shots are taken from the windows simulation and will look exactly like the actual output on your display if your settings and hardware are working properly The routine is available as COLOR ShowColorBar c the samples shipped with pC GUI ck ck ck k k k k ck k lt ck k k k lt ck ck k k k ck Ck ck x k lt ck ck ck k x ck lt ck lt x ck k x lt K lt k k ck lt lt ck k lt ck ko ck lt k k k ko lt k X ko lt ko Micrium Inc Empowering embedded systems pC GUI sample code i k K k ck ck k k k Ck k k Sk ck k x k k KKK KKK KKK ck kk x kk Ck x k k k ck kk k k x kk k lt k k k k k k k k k KKK k k KKK 2002 Micrium Technologies Corporation 107 File COLOR ShowColorBar c Purpose Example draws a color bar include GUI H KK KK IK kk kk kk K K K K K K K KOK KOK KOK KOK KOK KOK KOK A A KOK KOK KOK KOK KOK KOK k ck k ck KOK KOK KOK KOK KOK ke Draws 13 color bars KKKKKKKKKKKKK KKK Sk x x kk Ce x x k k x Ck lt K x k k k K x
355. rn European strings may be written as regular strings The beginning of a Unicode section is indicated by GUI_UC_START which may be at any position in the string GUI UC END indicates the end of the Unicode section A O character terminates the string as usual if the last character was encoded in Unicode UC END may be omitted User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 257 Example UI SetBkColor GUI RED UI SetColor GUI WHITE UI Clear UI_SetFont amp GUI_Font16_1HK UI DispStringHCenterAt English mixed GUI UC START Switch to UNICODE double byte 30 40 Japanese 30 45 Japanese Nx30Nx52 Japanese NX3 0NX5I Japanese GUI UC END Back to single byte characters with Japanese 160 50 Produces the following output English mixed gt WH ET with Japanese How does the double byte form work All characters which do not have a code where either the high or low byte of the 16 bit character code is 0 will retain their 16 bit character code Characters with high byte 0 code are moved to the area 0xe000 OxeOff For characters with low byte 0 code the high byte is used as the low byte and the new high byte is set to Oxel The resulting code is stored as 2 bytes high byte first 16 3 Example The following example defines a small font containing 6
356. rollers used Type Numerical value default is 1 LCD CACHE Description Controls caching of video memory in CPU memory Type Binary switch 0 disabled no display data cache used 1 enabled display data cache used default Additionnal information This switch is not supported by all LCD drivers Using a display data cache which speeds up access is recommended if access to the video memory is slow which is usually the case with larger displays and simple bus interfaces particularly if port access or serial interfaces are used Disabling the cache will slow down the speed of the driver LCD USE BITBLT Description Controls usage of hardware acceleration Type Binary swith 0 disabled BitBLT engine is not used 1 enabled BitBLT engine is used default Additionnal information Disabling the BitBLT engine will instruct the driver not to use the available hardware acceleration LCD SUPPORT CACHECONTROL Description Switch support for the LCD 10 ControlCache function of the driver User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 302 CHAPTER 20 Low Level Configuration Type Binary switch 0 disabled LCD L0 ControlCache may not be used default 1 enabled LCD 10 ControlCache may be used Additionnal information The API function LCD 10 ControlCache permits locking unlocking or flushing of the cache For more information refer to Chapter 23 LCD Drive
357. rporation 21 2 2 Adding p C GUI to the target program You basically have a choice between including only the source files that you are actu ally going to use in your project which will then be compiled and linked or creating a library and linking the library file If your tool chain supports smart linking link ing in only the modules that are referenced and not those that are unreferenced there is no real need to create a library at all since only the functions and data struc tures which are required will be linked If your tool chain does not support smart linking a library makes sense because otherwise everything will be linked in and the program size will be excessively large For some CPUs we have sample projects available to help you get started 2 3 Creating a library Building a library from the sources is a simple procedure The first step is to copy the batch files located under Sam Makelib bat ple Makelib into your root directory Then make any necce sary changes There are a total of four batch files which need to be copied described in the table below The main file Prep bat Makelib bat will be the same for all systems and requires no changes To build a library for your target system you will nor mally need to make slight modifcations to the other three smaller files Finally start the file Makelib bat to create the library The batch files assume that your GUI and Config subdi rectories are set up
358. rray Note the difference between enlarging and magnifying a polygon Whereas setting the parameter Len to 1 will enlarge the polygon by one pixel on all sides setting the parameter Mag to 1 will have no effect Example define countof Array sizeof Array sizeof Array 0 const GUI POINT aPoints 0 20 40 20 i 20 0 GUI POINT aMagnifiedPoints countof aPoints void Sample void int Mag y 0 Count 4 GUI_Clear GUI_SetColor GUI_GREEN for Mag 1 Mag lt 4 Mag 2 Count 2 int i x 0 GUI MagnifyPolygon aMagnifiedPoints aPoints countof aPoints Mag for i Count i gt 0 i x 40 Mag GUI FillPolygon aMagnifiedPoints countof aPoints x y y 20 Mag Screen shot for preceeding example GUI RotatePolygon Description Rotates a polygon by a specified angle Prototype void GUI RotatePolygon GUI POINT pDest const GUI POINT pSrc int NumPoints User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 76 CHAPTER 6 2 D Graphic Library float Angle Parameter Meaning pDest Pointer to the destination polygon pace Pointer to the source polygon NumPoints Number of points specified in the list of points Angle Angle in radian used to rotate the polygon Additional Information Make sure the destination array of points is equal to or larger than the source array Example
359. rs tuvuxyet iF U x ROM Size 1962 bytes Used files F8x12 ASCII c GUI Font8x13 ASCII Cr an TI c so I X amp 0123456789 lt gt HABCDEF GHIJELHMNOPQRESTUVWEYZ abcdefghijklm nopgrzstuwvwzxyzi l l ROM Size 2058 bytes Used files F8x13 ASCII c GUI Font8x13 1 Cr cm B User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 369 I 3 xRE CIEL 2470123455789 lt gt MABCDEF GHIIJIKLMNOFPQRSTUVWEYZ abcdefghijklm turma iui otra S 183 p 12 14634 AAECEEEEIITIDNOOODCOxOUS0 U YbBa Zs scee siiiisftiG n8n asu yb ROM Size 2070 bytes size of GUI Font8x13 5 Used files F8x13_1 c F8x13_ASCII c GUI Font8x15B ASCII Cr cm e 5 t HSZR 8123456789 lt gt P ABCDEF GHIJKLHNOPQRSTUUMXV2 X abcdefghijklm nopgrstuuvuxyzi N ROM Size 2250 bytes Used files F8x15B ASCII c GUI Font8x15B 1 Crom c so HSSR 8123456789 lt gt THABCDEF GHIJKLHHOPQRSTUUMNXVZ X abcdefghijklm nopqrstuuwxyz W jCEUY S Daen E ez jd 19 1664 AAAARAACEEEE TI TTOROODUUxBUU l pha dddaece eglITIOTno000 g u pb User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 370 CHAPTER 25 Standard Fonts ROM Size 2262 bytes size of GUI Font8x15B ASCII used iles F8x15B_1 c F8x15B_ASCI
360. rted bitmap may be saved as a bmp file which can be reloaded and used or loaded into other bitmap manipulation programs or as a C file A C file will serve as an input file for your C compiler It may contain a palette device independent bit map or DIB or be saved without device dependent bitmap or DDB DIBs are rec ommended as they will display correctly on any LCD a DDB will only display correctly on an LCD which uses the same palette as the bitmap 8 4 Generating C files from bitmaps The main function of the bitmap converter is to convert PC formatted bitmaps into C files which be used by uC GUI Before doing so however it is often desirable to modify the color palette of an image so that the generated C file is not excessively large With full color bitmaps it will be necessary to convert the image into a palette format as the bitmap converter cannot generate C files from bitmaps in RGB mode User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 95 C files may be generated as C with palette C without palette C with palette compressed or C without palette compressed For more information on com pressed files see the section Compressed bitmaps as well as the example at the end of the chapter The basic procedure for using the bitmap converter is illustrated step by step in the table below Procedure Screen shot Step 1 Start the application The bitmap converte
361. s the correct syntax for your compiler With 8 bit accesses a value of 1 indicates byte 1 With 16 bit accesses a value of 1 indicates word 1 LCD WRITE REG Description Writes data to a specified register of the LCD controller Type Function replacement Prototype LCD WRITE REG Index Data Parameter Meaning Index Index of the register to write to Data Data to write to the register Additionnal information This macro defines how to write to the registers of the LCD controller If the registers are memory mapped the macro can normally be written as a single line In order to configure this switch correctly you need to know the address the regis ters are mapped to the spacing and if 8 16 or 32 bit accesses are permitted as well as the correct syntax for your compiler With 8 bit accesses a value of 1 indicates byte 1 With 16 bit accesses a value of 1 indicates word 1 Example If the registers are mapped to a memory area starting at 0xc0000 the spacing is 4 and 8 bit access should be used with most compilers the define should look as fol lows define LCD WRITE REG Index Data U8volatile 0xc0000 O0Off lt lt 2 data User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation 296 CHAPTER 20 Low Level Configuration LCD BUSWIDTH Description Defines bus width of LCD controller CPU interface external display access Type Selection switch
362. s Corporation 221 Additional information An attached scroll bar is essentially a child window which will position itself on the parent window and operate accordingly Vertical attached scrollbars will be automaticaly placed on the right side of the parent window horizontal scrollbars on the bottom Example Creates a list box with an attached scrollbar LISTBOX Handle hListBox hListBox LISTBOX Create ListBox 50 50 100 100 WM CF SHOW SCROLLBAR CreateAttached hListBox SCROLLBAR CF VERTICAL Screen shots of above example The picture on the left shows the list box as it appears after creation On the right it is shown with the attached vertical scrollbar SCROLLBAR Createlndirect Prototype explained at the beginning of the chapter The following flags may be used as the Flags element of the resource passed as parameter Permitted indirect creation flags oR combinable SCROLLBAR CF VERTCAL Create a vertical scroll bar default is horizontal SCROLLBAR CF FOCUSSABLE Gives scroll bar the input focus The Para element is not used in the resource table SCROLLBAR Dec Description Decrements the current value of the scroll bar by a value of 1 Prototype void SCROLLBAR Dec SCROLLBAR Handle hObj Parameter Meaning Handle of scroll bar Additional information The definition of an item is application specific although in most cases it is equal
363. s Corporation Configuring additional LCD controllers HC GUI offers the possibility of using more than one up to four LCD controllers with one LCD The configuration switches are identical to the switches for the first control ler controller 0 except the index is 1 2 or 3 instead of O Second LCD controller 299 Type Macro Explanation N LCD FIRSTSEGI LCD controller 1 first segment line used N CD LASTSEGI LCD controller 1 last segment line used N LCD FIRSTCOMI LCD controller 1 first com line used N LASTCOMI LCD controller 1 last com line used N LCD XORG1 LCD controller 1 leftmost lowest X position N LCD YORGI1 LCD controller 1 topmost lowest Y position Third LCD controller Type Macro Explanation N LCD FIRSTSEG2 LCD controller 2 first segment line used N LASTSEG2 LCD controller 2 last segment line used N LCD FIRSTCOM2 LCD controller 2 first com line used N LASTCOM2 LCD controller 2 last com line used N LCD XORG2 LCD controller 2 leftmost lowest X position N LCD YORG2 LCD controller 2 topmost lowest Y position Fourth LCD controller Type Macro Explanation N LCD FIRSTSEG3 LCD controller 3 first segment line used N LASTSEG3 LCD controller 3 last segment line used N LCD FIRSTCOM3 LCD controller 3 first c
364. s are currently available Name Explanation BUTTON Button which can be pressed Text or bitmaps may be displayed on a button CHECKBOX Check box which may be checked or unchecked EDIT Single line edit field which prompts the user to type a number or text FRAMEWIN Frame window Creates the typical GUI look LISTBOX Listbox which highlights items as they are selected by the user PROGBAR Progress bar used for visualization RADIOBUTTON Radio button which may be selected Only one button may be selected at a time SCROLLBAR Scrollbar which may be horizontal or vertical SLIDER Slider bar used for changing values TEXT Static text controlls typically used in dialogs Understanding the redrawing mechanism A widget draws itself according to its properties This is done when wM is called If you do not call Exec from within your program Paint must be called for the widget C GUIIn a multitasking environment a background task is normally used to call Exec and update the widgets and all other windows with callback functions It is then not necessary to manually call wM Paint however it is still legal to do so and may also make sense if you want to ensure that the widget is redrawn immediately When a property of a widget is changed the window of the widget or part of it is marked as invalid but it is not immediately redrawn Therefore the section of code executes ver
365. s created as a background window The handle of this window is ww HBKWIN The WM does not redraw areas of the background window automatically because there is no default background color That means if you create a further window and then delete it the deleted window will still be visible The routine SetBkWindowColor needs to be specified in order to set a color for redrawing the background window You can also set a callback function to take care of this problem If a window is cre ated and then deleted as before the callback routine will trigger the WM to recognize that the background window is no longer valid and redraw it automatically For more information on creating and using callback routines see the example at the end of the chapter 12 5 Basic functions WM CreateWindow Description Creates a window of a specified size at a specified location Prototype WM HWIN WM CreateWindow int x0 int 0 int width int height User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 151 U8 Style WM CALLBACK cb int NumExtraBytes Parameter Meaning 0 Upper left X position yo Upper left Y position width X size of window height Y size of window Style Window create flags listed below 16 Pointer to callback routine or NULL if no callback used 32 Number of extra bytes to be allocated normally 0 Return value Permitted values for parameter Style OR combi
366. s parameter is not used but the number of radio buttons used is specified as the Para element RADIO Dec Description Decrements the selection by a value of 1 Prototype void RADIO Dec RADIO Handle hObj Parameter Meaning hObj Handle of radio button widget Additionnal information Please note that the numbering of the buttons always starts from the top with a value of 0 therefore decrementing the selection will actually move the selection one but ton up RADIO GetValue Description Returns the current button selection User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 218 CHAPTER 13 Window Objects Widgets Prototype void RADIO GetValue RADIO Handle hObj Parameter Meaning hObj Handle of radio button widget Return value The value of the currently selected button RADIO Inc Description Increments the selection by a value of 1 Prototype void RADIO Inc RADIO Handle hObj Parameter Meaning hObj Handle of radio button widget Additionnal information Please note that the numbering of the buttons always starts from the top with a value of 0 therefore incrementing the selection will actually move the selection one button down RADIO SetValue Description Sets the current button selection Prototype void RADIO SetValue RADIO Handle hObj int v Parameter Meaning hobj Handle of radio button widget
367. se note that to rebuild the executable you will need to have Microsoft Visual C version 6 00 or later installed e Step 1 Open the Visual C workspace by double clicking on Simulation Trial dsw e Step 2 Rebuild the project by choosing Build Rebuild 11 from the menu or by pressing F7 e Step 3 Start the simulation by choosing Build Start Debug Go from the menu or by pressing F5 The demo project will begin to run and may be exited at any time by right clicking on it and selecting Exit Compiling the samples The Sample directory contains ready to go samples that demonstrate different fea tures of uC GUI and provide examples of some of their typical uses In order to build any of these executables their C source must be added to the project This is eas ily done with the following procedure e Step 1 Double click on the Application sajz folder in the Visual C workspace The demo files will be displayed beneath it e Step 2 Remove all files from the Applica 5 Workspace SimulationT rial 1 project s 7 SimulationT rial files tion folder by selecting them and pressing Application the Delete key They will not be deleted DIALOG_SliderColor c you are just removing them from the F J Exe project GUI e Step 3 You should now have an empty Simulation Application folder Right click on it and select Add files to folder A dialog box 4 will be displayed I u
368. source usage in typical systems which can be used to obtain sufficient estimates for most target systems User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 344 CHAPTER 24 Performance and Resource Usage 24 1 Performance benchmark We use a benchmark test to measure the speed of the software on available targets This benchmark is in no way complete but it gives an approximation of the length of time required for common operations on various targets Configuration and performance table all values are in ps pixel o w w w e e e e 5 5 5 3r o SO SO DO o CPU 10 gt mue d mad mis ou o 592900 o o o o Ere ese er x SN ZG TR TA TN 5 m 2 ke rm m E M16C 60 16 bit 16MHz T6963 M16C 60 16 bit 16MHz T6963 16 80 16 bit 20MHz 1375 16 80 16 bit 20MHz 1375 16 80 16 bit 20MHz 1375 0 26 9 26 4 43 7 38 7 93 8 01 7 99 7 14 0 46 5 60 2 29 2 94 8 21 3 14 7 86 1 54 0 63 5 45 2 30 3 26 7 65 3 23 2 81 1 61 Description of test sequences used in the benchmark test Bench1 Filling Bench the speed of filling An area of 64 64 pixels is filled with different colors Bench2 Small fonts Bench the speed of small character o
369. splay if background is the active win GUI DispCEOL Clear display from current text position to end of line 4 3 Routines to display text GUI DispChar Description Displays a single character at the current text position in the current window using the current font Prototype void GUI DispChar U16 c Parameter Meaning Character to display Additionnal information This is the basic routine for displaying a single character All other display routines GUI_DispCharAt GUI DispString etc call this routine to output the individ ual characters Which characters are available depends on the selected font If the character is not available in the current font nothing is displayed Example Shows a capital A on the display GUI DispChar A Related topics GUI DispChars GUI DispCharAt User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 42 CHAPTER 4 Displaying Text GUI DispCharAt Description Displays a single character at a specified position in the current window using the current font Prototype void GUI DispCharAt U16 c I16P x I16P y Parameter Meaning Character to display X position to write to in pixels of the client window Y position to write to in pixels of the client window Add information Displays the character with its upper left corner at the specified X Y position Writes the character
370. standard fonts shipped with pC GUI There is measurement diagram an overview of all characters included and a table containing the ROM size in bytes and the font files required when using the font The following parameters are used in the measurement diagrams Element Meaning Size of font in Y Distance of base line from the top of the font Height of capital characters Height of lowercase characters c 9 Size of underlength used by letters such as g j or y User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 350 CHAPTER 25 Standard Fonts 25 4 Proportional fonts GUI Font8 ASCII cr e l LEES e 234567591277 0ABCOEFGHIJKLMHOP QRS TUUM Vabedetahi3k1nnoparstucusxuztIr ROM Size 1562 bytes FO8_ASCII c GUI Font8 1 cron m Bl 23456 Sas Teed tin 25 RAT E Str Se ee aaa Ba ass Eve ean ee ROM Size 1586 bytes size of GUI Font8 ASCII Used riles FO8_ASCII c F08 1 c GUI Font10 ASCII 18 ao Ba He Bi Zr ciu PEPHER 0123455788 lt gt za SBCDEFGHUKLMMOPORSTLUY VR ST abodetahijkimmopgr sty User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 351 ROM Size Used files 1800 bytes F10 ASCII c GUI
371. t Additionnal information see GUI GetFontSizeY GUI IsinFont Description Evaluates whether or not a particular font contains a specified character Prototype char GUI IsInFont const GUI FONT pFont 016 c Parameter Meaning pFont Pointer to the font Character to be searched for Additionnal information If the pointer pFont is set to 0 the currently selected font is used Example Evaluates whether the font GUI FontD32 contains an X if GUI IsInFont amp GUI FontD32 X 0 GUI DispString GUI FontD32 does not contains X User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 7 5 Character sets ASCII 89 HC GUI supports the full set of ASCII characters These are the following 96 charac ters from 32 to 127 0 1 2 3 4 5 6 7 8 9 A B F 2x amp 0 1 2 3 4 5 6 7 8 9 lt gt Ax A B C D E F G H I K L M 5x P Q R S T U V W X 7 2 x 6x a b c d e f g h i j k 1 m n 7x P q r S t u v w x y 7 Unfortunately as ASCII stands for American Standard Code for Information Inter change it is designed for American needs It does not include any of the special characters used in European languages such as A U a and others There is no single standard for these European extensions of the ASCII set o
372. t ULL GUI ID LISTBOXO 10 20 48 40 0 0 CHECKBOX CreateIndirect ULL GUI ID CHECKO 0 55 0 0 0 0 CHECKBOX CreateIndirect NULL GUI ID CHECK 30 7 D j 0 O SLIDER CreateIndirect ULL GUI ID SLIDERO 60 140 00 20 0 0 k SLIDER CreateIndirect ULL GUI ID SLIDERI 10 170 DU 30 0 0 1 Dialog procedure The sample above has been created using the blank dialog procedure shown below This is the basic template which should be used as a starting point when creating any dialog procedure KK KK kk kk kk Kk K K K K K K K K K KOK KOK K KOK K K Ck K K AAA AA A A KOK K K kk kk KOK KOK ke ke e ke e ke e ke K Dialog procedure static void cbCallback WM MESSAGE pMsg 1 switch pMsg MsgId default WM DefaultProc pMsg For this sample the dialog box is displayed with the following line of code GUI ExecDialogBox aDialogCreate GUI COUNTOF aDialogCreate amp cbCallback 0 0 0 The resulting dialog box looks as follows or similar the actual appearance will depend on your configuration and default settings Dialog notification received User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 234 CHAPTER 14 Dialogs After creation of the dialog box all widgets included in the resource table will be vis ible although as can be seen in the previous screen shot they will appear empty This is because the dialog procedur
373. t Into Best palette from the menu For certain applications it may be more efficient to use a fixed color palette chosen from the menu under Image Convert Into For example suppose a bitmap in full color mode is to be shown on a display which supports only four grayscales It would be a waste of memory to keep the image in the original format since it would only appear as four grayscales on the display The procedure for conversion would be as follows Procedure Screen shot The bitmap converter displays the loaded source bitmap which is the same as in the previous example full color mode Y uC DmpCvt Y2 30b C Lopos MicriumLogoUlue bmp Fe FQ Vew inj Resolution 269 76 Colors HGH Zoom 20 Transparent Micrium ast operation undenn Choose Image Convert Into Gray4 Fie View Help Resolution Transparency Colors Convert Into 1 BPP Zom YN Transparent Rotate Grayl6 4 BPP Gray6d Info Gray256 8 BPP 8 BPP 777 shit Color 111 4 BPP 6bit Color 222 8 BPP Color 233 8 BPP Color 323 8 BPP Color 332 8 BPP 8 8 bit Color 8666 RGB Best palette Custom palette User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 98 CHAPTER 8 Bitmap Converter Procedure Screen shot The bitmap converter displays the converted bit map pC 0mpCvt Y2 30b
374. t x int y Parameter Meaning X end position y Y end position User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 72 CHAPTER 6 2 D Graphic Library GUI DrawPolyLine Description Connects a predefined list of points with lines in the current window Prototype void GUI DrawPolyLine const GUI POINT pPoint int NumPoints int x int y Parameter Meaning pPoint Pointer to the polyline to display NumPoints Number of points specified in the list of points X X position of origin y Y position of origin Additional Information The starting point and endpoint of the polyline need not be identical GUI DrawVLine Description Draws a vertical line one pixel thick from a specified starting point to a specified end point in the current window Prototype void GUI DrawVLine int x int y0 int yl Parameter Meaning x X position 0 Y starting position yl Y end position Additional Information If lt y0 nothing will be displayed With most LCD controllers this routine is executed very quickly because multiple pix els can be set at once and no calculations are needed If it is clear that vertical lines are to be drawn this routine executes faster than the GUI DrawLine routine 6 6 Drawing polygons The polygon drawing routines can be helpful when drawing vectorized symbols GUI DrawPolygon Description Draws the outl
375. tanding of the program code to set all 3 colors to the same value such as 0x555555 or 0xa0a0a0 23 6 Miscellaneous group LCD LO ControlCache Description Locks unlocks or flushes the cache This routine may be used to set the cache to a locked state in which all drawing operations on the driver cause changes in the video memory s cache in CPU RAM but do not cause any visible output Unlocking or flushing then causes those changes to be written to the display This can help to avoid flickering of the display and also accelerate drawing It does not matter how many different drawing operations are executed the changes will all be written to the display at once In order to be able to do this LCD SUPPORT CACHECONTROL must be enabled in the configuration file Prototype U8 LCD ControlCache U8 command Parameter Meaning Specify the command to be given to the cache Use the symbolic values in the table command below Permitted values for parameter command LCD UNLOCK Set the default mode cache is transparent Lock the cache no write operations will be performed until cache is unlocked or flushed LCD CC FLUSH Flush the cache writing all modified data to the video RAM LCD CC LOCK Return value Information on the state of the cache Ignore Additionnal information When the cache is locked the driver maintains a hitlist a list of bytes which
376. tate Return the state of a specified hardkey 0 unpressed 1 pressed SIM HARDKEY SetCallback Seta callback routine to be executed when the state of a specified hardkey changes SIM HARDKEY SetMode Set the behavior for a specified hardkey default 0 no toggle SIM HARDKEY SetState Set the state for a specified hardkey SIM SetLCDPos Description Sets the position for the simulated LCD within the target device bitmap Prototype void SIM SetLCDPos int x int y Parameter Meaning X position of the upper left corner for the simulated LCD in pixels y Y position of the upper left corner for the simulated LCD in pixels Additionnal information The X and Y positions are relative to the target device bitmap therefore position 0 0 refers to the upper left corner origin of the bitmap and not your actual LCD Only the origin of the simulated screen needs to be specified the resolution of your display should already be reflected in the configuration files in the con ig directory SIM SetTransColor Description Sets the color to be used for transparent areas of device or hardkey bitmaps Prototype I32 SIM SetTransColor I32 Color Parameter Meaning Color RGB value of the color Additionnal information The default setting for transparency is bright red OxFF0000 You would typically only need to change this setting if your
377. terfaces The driver supports 1 4 8 bit interfaces from the CPU to the LCD User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 325 Display data RAM organization Byte 0 Byte 1 Pas Byte n ra gt 4 N 4 gt 6 65 6 6 5 5 5 5 5 012 34 56 7 n et n n 4 lt D DD DDD D COM 0 B B B B 7 6 5 4 312 1 1 0 conn The picture above shows the relation between the display memory and the SEG and COM lines of the LCD The display memory is divided into two panes for each pixel The lower bit of one pixel is stored in pane O and the higher bit is stored in pane 1 The advantage of this method is that the output of the display data can be executed very quickly RAM requirements of the driver The driver only handles a memory area containing the display data The required size of the display memory area may be calculated as follows Size of RAM in bytes LCD_XSIZE 7 8 LCD_YSIZE 2 Additional driver functions None Hardware configuration Normally the hardware interface is an interrupt service routine ISR which updates the LCD An output routine written in C code is shipped with pC GUI This routine should serve
378. the window If the specified window has any existing child windows these are automatically deleted before the window itself is deleted WM Exec Description Redraws invalid windows by executing callback functions all jobs Prototype int WM Exec void User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 153 Return value 0 if there were no jobs performed 1 if a job was performed Additionnal information This function will automatically call wM repeatedly until it has completed all jobs essentially until a 0 value is returned It is recommended to call the function GUI Exec instead Normally this function does not need to be called by the user application It is called automatically by GUI Delay If you are using a multitasking system we recom mend executing this function by a separate task as seen below void ExecIdleTask void while 1 WM Exec WM_Exec1 Description Redraws an invalid window by executing one callback function one job only Prototype int WM_Execl void Return value if there were no jobs performed 1 if a job was performed Additionnal information This routine may be called repeatedly until O is returned which means all jobs have been completed It is recommended to call the function GUI Exec1 instead This function is called automatically by wM Exec WM GetClientRect
379. tor to debug your application you cannot see the LCD output when stepping through the source code The viewer solves this problem by showing the LCD window and the color window of your simulation The viewer can be found under ToolNuC GUI View exe pC GUIView V3 14 File View Help LCD 320 240 8bpp Banding memory device without flickering DONE m mua noooseo0000s8o00000 Mouse moved out Using the simulator and the viewer It is your choice if you want to start the viewer before debugging your application or while you are debugging Our suggestion e Step 1 Start the viewer No LCD or color window is shown until the simulation has been started e Step 2 Open the Visual C workspace e Step 3 Compile and run the application program e Step 4 Debug the application as described previously The advantage is that you can now follow all drawing operations step by step in the LCD window Per default the viewer window is always on top You can change this behavior by selecting View Always on top from the menu 3 5 Device simulation and other advanced features Warning Device simulation and other features which are based on it are advanced features which may require the simulator source code in order to work for your target system This source code is not normally shipped with pC GUI Please contact us for more information The simulator can show the simulated LCD in a bitmap of your choice typically your target d
380. tringAt Hello world 0 0 break User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 150 CHAPTER 12 The Window Manager WM Elements of WM MESSAGE MsgId Type of message see table below hWin Destination window hWinSrc Source window Data p Data pointer Data v Data value Types of messages used with MsgId WM PAINI Redraws the window because content is at least partially invalid WM CREATE Sent immediately after a window has been created Tells the window to free its data structures if any since it is W DE iE h about to be deleted WM SIZE Sent to a window when its size has changed WM MOVE Sent to a window when it has been moved WM SHOW Sent to a window when it has received the show command WM HIDE Sent to a window when it has received the hide command WM TOUCH Touch screen message The application program can define additional messages for its own usage In order to ensure that they do not use the same message ID s as those used by p C GUI user defined messages start numbering after wM USER You would define your own messages as follows define MY MESSAGE AAA WM_USER 0 define MY MESSAGE WM_USER 1 and so on Background window redrawal and callback During initialization of the window manager a window containing the whole LCD area i
381. uC GUI Graphical User Interface with Graphic Library Version 3 26 Manual Rev 0 Micriym Technologies Corporation www micrium com Empowering Embedded Systems Disclaimer Specifications written in this manual are believed to be accurate but are not guaran teed to be entirely free of error Specifications in this manual may be changed for functional or performance improvements without notice Please make sure your man ual is the latest edition While the information herein is assumed to be accurate Micrium Technologies Corporation the distributor assumes no responsibility for any errors or omissions and makes no warranties The distributor specifically disclaims any implied warranty of fitness for a particular purpose Copyright notice The latest version of this manual is available as PDF file in the download area of our website at www micrium com You are welcome to copy and distribute the file as well as the printed version You may not extract portions of this manual or modify the PDF file in any way without the prior written permission of Micrium Technologie Corpora tion The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license 2002 Micrium Inc Weston Florida 33327 1848 U S A Trademarks Names mentioned in this manual may be trademarks of their respective companies Brand and product names are trademarks or registered trade
382. ular font GUI GetYSizeOfFont Return the Y size of a particular font GUI IsInFont Evaluate whether a specified character is in a particular font 7 3 Selection of a font GUI GetFont Description Returns a pointer to the currently selected font Prototype const GUI FONT GUI GetFont void GUI SetFont Description Sets the font to be used for text output Prototype const GUI FONT GUI SetFont const GUI FONT pNewFont Parameter Meaning pFont Pointer to the font to be selected and used Return value Returns a pointer to the previously selected font so that it may be restored at a later point Examples Displays sample text in 3 different sizes restoring the former font afterwards User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 86 CHAPTER 7 Fonts void DispText void const GUI FONT GUI FLASH OldFont GUI SetFont amp GUI Font8x16 GUI DispStringAt This text is 8 by 16 pixels 0 0 GUI SetFont amp GUI Font6x8 GUI DispStringAt This text is 6 by 8 pixels 0 20 GUI SetFont amp GUI Font8 GUI DispStringAt This text is proportional 0 40 GUI SetFont OldFont Restore font Screen shot of above example This text is 8 by 16 pixels This text is 6 by amp pixels This text iz proportional Displays text and value in different fonts GUI SetFont amp GUI Font6x8 GUI DispString The result is Disp text GUI S
383. um Technologies Corporation 4 O 0123456789 1 lt gt ABCDEFGHIJKLMNOP QRSTUVWXYZ N 7 abcdefgh ijklmnopqrstuvwxyzt D ROM Size Used files FComic24B_ASCII c 6146 bytes GUI FontComic24B 1 User s Ln J 4 0 0123456789 rig gt 9 ABCDEFGHIJ KLMNOP QRSTUVWXYZ X abcdefgh ijklmnopqrstuvwxyz 1 it ex 9 x237 7 1911 3C AAAAAAACEEEELILIDNOO OO OxQUUUUYPf 6da gce e eilli fioo000 au yb ROM Size Used files FComic24B 1c FComic24B_ASCII c 5598 bytes size of GUI Font24 ASCII amp re ference manual for uC GUI 2002 Micrium Technologies Corporation 366 CHAPTER 25 Standard Fonts 25 5 Monospaced fonts GUI Font4x6 cr emm Cet s01234d5B 28 Xz772BRBECDEFGHIJELHWDP QRZTHUHHVZE ST ak d F3kijklHn npqgettuuuxur Ix ROM Size Used files 620 bytes F4x6 c GUI Font6x8 Croom EEKE CI t ZB123456789 1 lt ieee oe dar iu abcdef ahi ik Lunopg rztuuvwx xim mag 07 vis yuzi 4 14 x annae amp amp E ROM Size Used files 1840 bytes F6x8 c GUI Font6x9 an TI IURSXE UCIXT 4 amp H1z234556r7389 2 URHBLDEFGHI EKLPHU UPEREST Uae abodef ghiik lmnoparstuvuccuzt px Eis pgseac D 732574 1095512555854 FEEEtftiDHas
384. um Technologies Corporation 214 User s amp reference manual for uC GUI CHAPTER 13 Window Objects Widgets include gui include prog h bar h RK HK IK kk KC K k K k K kkk K k k K K K K K K K K K K K K K KOK K K KOK KOK k Ck KOK K K S hows the use of progress bars kk ck K k k k k ck KKK KKK KKK k k k KKK k kk KK k x x k kk ck kk k k x kk ck kk lt lt ck x x k kk lt kk Sk x x x k x x x KKK static void De nt i i P GUI Clear GUI SetFont GUI DispStri Create pr ahProgBar GUI_Delay 5 Modify pr for i 0 PROGBAR_Se GUI Delay GUI_Delay 5 Delete pr PROGBAR_Dele moProgBar void ROGBAR_Handle ahProgBar amp GUI_Font8x16 ngAt Progress bar 100 80 ogress bar PROGBAR_Create 100 100 100 20 WM_CF_SHOW 00 ogress bar i lt 100 i tValue ahProgBar i 10 00 ogress bar te ahProgBar RK IK IK IK A K K K K A k k k k K K K K K K K K kc k k ck k ck kck kk KOK KOK K ck ck ck ok kk main k k k k ck KKK k k K KKK k k k KKK ck ck ck KK K k x k kk ck kk k x x kk K x x kk ck x x k x x ck lt x x x x x x x x x KKK void main void GUI Init while 1 DemoProgBa r Screen shot of above example Progress bar ANN Advanced use of the PROGBAR widget This more advanced example creates a tank fill level indicat
385. um Technologies Corporation 14 CHAPTER 1 Introduction to uC GUI Samples and demos To give you a better idea of what uC GUI can do we have different demos available as ready to use simulation executables under Sample EXE The source of the sam ple programs is located in the folder Sample The folder Sample GUIDemo contains an application program showing most of ui C GUI s features 1 3 Evaluation borad A complete Evaluation board including a demoboard with LCD a C compiler and a sample project are available It has been designed primarily to test and demonstrate HC GUI and it can be used to get familiar with the software Evaluation board eEvaluation board with Mitsubishi M30803 CPU and SED 13705 LCD controller including schematic and documentation eLCD 320 240 pixel either monochrome 1 4 VGA color display or TFT For more details please take a look at our website at www micrium com 1 4 How to use this manual This manual explains how to install configure and use uC GUI It describes the inter nal structure of the software and all the functions that uC GUI offers the Application Program Interface or API Before actually using uC GUI you should read or at least glance through this manual in order to become familiar with the software The following steps are then recom mended e the pn C GUI files to your computer e Go through Chapter 2 Getting Started e Use the simulator in
386. uration LCD MAX LOG COLORS Description Defines the maximum number of colors supported by the driver in a bitmap Type Numerical value default is 256 Additionnal information If you are using a 4 grayscale LCD it is usually sufficient to set this value to 4 How ever in this case remember not to try to display bitmaps with more than 4 colors LCD PHYSCOLORS Description Defines the contents of the color lookup table if one is used Type Alias Additionnal information This macro is only required if LCD FIXEDPALETTE is set to 0 Refer to the color section for more information LCD PHYSCOLORS IN RAM Description Puts the contents of the physical color table in RAM if enabled User s amp reference manual foruC GUI 2002 Micrium Technologies Corporation CHAPTER 20 Low Level Configuration Type Binary switch 0 inactive default 1 active LCD REVERSE Description Inverts the display at compile time Type Binary switch 0 inactive not reversed default 1 active reversed LCD SWAP RB Description Swaps the red and blue color components Type Binary switch 0 inactive not swapped default 1 active swapped 20 6 Magnifying the LCD Some hardware requires the LCD to be magnified in order to display images cor rectly The software must compensate for hardware which internally needs magnifi cation It does so by activating a layer above the driver layer to automatically
387. ure that the default font is one that you are actually using in your application because the default font will be linked with your application and will therefore use up ROM memory uy C GUICompatibility Older versions of uC GUI used a different font concept where fonts were listed in a font table and their position in that table was selected by an integer This concept was changed due to a lack of flexibility The new concept is to a large degree compat ible with the old one and the font identifiers i e F6x8 are still available User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 7 2 Font API The table below lists the available font related routines in alphabetical order within their respective categories Detailed descriptions can be found in the sections that 85 follow Routine Explanation Selection of a font GUI GetFont Return a pointer to the currently selected font GUI SetFont Set the current font Font related functions GUI BetCharDistki the width in pixels X size of a specified character in the current GUI GetFontDistYyY Return the Y spacing of the current font GUI GetFontInfo Return a structure containing font information GUI GetFontSizeY Return the height in pixels Y size of the current font GUI GetStringDistX Return the X size of a text using the current font GUI GetYDistOfFont Return the Y spacing of a partic
388. utput An area of 60 64 pixels is filled with small character text Bench3 Big fonts Bench the speed of big character output An area of 65 48 pixels is filled with big character text Bench4 Bitmap 1bpp Bench the speed of 1bbp bitmaps An area of 58 8 pixels is filled with a 1bpp bitmap Bench 5 Bitmap 2bpp Bench the speed of 2bbp bitmaps An area of 32 11 pixels is filled with a 2bpp bit map Bench Bitmap 4bpp Bench the speed of 4bbp bitmaps An area of 32 11 pixels is filled with a 4bpp bit map Bench7 Bitmap 8bpp Bench the speed of 8bbp bitmaps An area of 32 11 pixels is filled with a 8bpp bit map User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 8 Device dependent bitmap 8 or 16 bpp 345 Bench the speed of bitmaps 8 or 16 bits per pixel An area of 64 8 pixels is filled with a bitmap The color depth of the tested bitmap depends on the configuration For configurations lt 8bpp a bitmap with 8 bpp is used 16bpp configurations use a 16 bpp bitmap 24 2 Memory requirements The following table will give you an idea of the memory requirements for UC GUI The values in this table are approximations depending on the CPU the C compiler used the memory model and the compile time switches i e which parts of uC GUI are included in your application However the following data represents a good average value for 32 bit CPUs based on the requirements for x8
389. ver functions LCD LO ControlCache For information about this function please refer to Chapter 23 LCD Driver API User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 330 CHAPTER 22 LCD Drivers Hardware configuration This driver accesses the hardware with a simple bus interface as described in Chapter 20 Low Level Configuration The following table lists the macros which must be defined for hardware access Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller READ AO Read a byte from LCD controller with A line low READ A1 Read a byte from LCD controller with A line high LCD WRITE AQ Write a byte to LCD controller with A line low LCD WRITE A1 Write a byte to LCD controller with A line high Additional configuration switches The following table shows optional configuration switches available for this driver Macro Explanation When set to 0 no display data cache is used which slows down the speed of the driver Default is 1 cache activated LCD SUPPORT CACHECONTRO When set to 0 the cache control functions of 1 LCD LO ControlCache driver are disabled LCD CACHE Special requirements for certain LCD controllers None 22 11 LCDSLin Supported hardware Controllers This driver has been tested with the following LCD controllers e Epson SED1330
390. want to change or relocate them A recommended place is in the configuration file LcDConf h User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 18 CHAPTER 1 Introduction to uC GUI User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation Chapter 2 Getting Started The following chapter provides an overview of the basic procedures for setting up and configuring on your target system It also includes a simple program exam ple Please keep in mind that most topics are treated in greater detail in later chapters You will most likely need to refer to other parts of the manual before you begin more complex programming User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 20 CHAPTER 2 Getting Started 2 1 Recommendeuurectory structure E Config w d keeping uC GUI te f lication FAS e recommend keeping p separate from your application Antialias files It is good practice to keep all the program files including the header files together in the GUI subdirectories of your E ConvertColor E ConvertMono project s root directory The directory structure should be similar Bil Core to the one pictured on the right This practice has the advantage 8 Font of being very easy to update to newer versions of p C GUI by LCDDriver simply replacing the GUIN directories Your application files can J MemDev be stored anywhere Tou
391. when creating new windows _SetHasTrans Set the has transparency flag SetUserClipRect Temporarily reduce the clipping area ValidateRect Validate parts of a window z z zm z _ValidateWindow Validate a window Memory device support optional DisableMemdev Disable usage of memory devices for redrawing z _EnableMemdev Enable usage of memory devices for redrawing 12 3 Callback mechanism of the window manager The WM may be used with or without callback routines In most cases using call backs is preferable Philosphy behind the callback mechanism The idea behind the callback mechanism that p C GUI offers for windows and window objects widgets is that of an event driven system As in most windowing systems the principle is that the flow of control is not just from the user program to the graphic system but also from the user program to the graphic system and back up to the user program by means of the callback routines provided by the user program This mechanism often characterized as the Hollywood principle Don t call us User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 149 we ll call you is needed by the window manager mainly in order to trigger the redrawing of windows This contrasts with classical programming but it makes it p
392. window SCROLLBAR Create Description Creates a SCROLLBAR widget of a specified size at a specified location Prototype SCROLLBAR Handle SCROLLBAR Create int x0 int yO int xsize int ysize WM HWIN hParent int Id int WinFlags int SpecialFlags Parameter Meaning x0 Leftmost pixel of the scroll bar in desktop coordinates 0 Topmost pixel of the scroll bar desktop coordinates xsize Horizontal size of the scroll bar in pixels ysize Vertical size of the scroll bar in pixels hParent Handle of parent window TA ID to be returned Window create flags Typically WM SHOW in order to make the widget visible WinFlags immediately please refer to WM CreateWindow in Chapter 12 The Window Manager for a list of available parameter values 22 Special creation flags see creation flags under SCROLLBAR CreateIndirect Return value Handle for the created SCROLLBAR widget 0 if the routine fails SCROLLBAR CreateAttached Description Creates a scroll bar which is attached to an existing window Prototype SCROLLBAR Handle SCROLLBAR CreateAttached WM HWIN hParent int SpecialFlags Parameter Meaning hParent Handle of parent window S SEEN Special creation flags see indirect creation flags under oe SCROLLBAR CreateIndirect Return value Handle for the created scrollbar 0 if the routine fails 2002 Micrium Technologie
393. window using the current pen size and the current pen shape Prototype void GUI AA DrawLine int x0 int y0 int xl int yl Parameter Meaning x0 X starting position y0 Y starting position x1 X end position yl Y end position Additional Information If working in high resolution mode the coordinates must be in high resolution coor dinates Otherwise they must be specified in pixels GUI AA DrawPolyOutline Description Displays the outline of an antialiased polygon defined by a list of points at a speci fied position in the current window and with a specified thickness Prototype void GUI AA DrawPolyOutline const GUI POINT pPoint int NumPoints int Thickness int x int y Parameter Meaning pPoint Pointer to the polygon to display NumPoints Number of points specified in the list of points Thickness Thickness of the outline x X position of origin y Y position of origin Additional Information The polyline drawn is automatically closed by connecting the endpoint to the starting point The starting point must not be specified a second time as an endpoint If working in high resolution mode the coordinates must be in high resolution coor dinates Otherwise they must be specified in pixels Example define countof Array sizeof Array sizeof Array 0 static GUI POINT aPoints 0 0 t 15 30 i 0 20 15 30 User s amp reference manu
394. x 32 32768 Color sequence BBBBBGGGGGRRRRR 555 mode 5 bits blue 5 bits green 5 bits red red and blue swapped Use of this mode is necessary for an LCD controller that supports RGB colors with a color depth of 15 bpp The red green and blue shares are each 5 bits The available colors are the same as those in 555 mode Number of available colors 32 x 32 x 32 32768 Color sequence RRRRRGGGGGBBBBB 565 mode 5 bits red 6 bits green 5 bits blue i r Use of this mode is necessary for an LCD controller that supports RGB colors with a color depth of 16 bpp The red green and blue shares are each 5 bits One bit remains unused Number of available colors 32 x 64 x 32 65536 Color sequence BBBBBGGGGGGRRRRR 565 mode 5 bits blue 6 bits green 5 bits red red and blue swapped Use of this mode is necessary for an LCD controller that supports RGB colors with a color depth of 16 bpp The red green and blue shares are each 5 bits One bit remains unused The available colors are the same as those in 565 mode Number of available colors 32 x 64 x 32 65536 Color sequence RRRRRGGGGGGBBBBB User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 112 CHAPTER 9 Colors 8666 mode 8bpp 6 levels per color 16 gray scales This mode is most frequently used with a program mable color lookup table LUT supporting a total of 256 possible colors using a palette The screen shot gives an ide
395. x kk Ck Sk ck k k ck kk k lt x kk K kk x kk Ck x k k x kc ko kc KK KKK File WIDGET_SimplelistBox c Purpose Example demonstrating the LISTBOX widget include gui H include listbox h include lt stddef h gt const GUI_ConstString ListBox English Deutsch Fran ais Japanese Italiano NULL s define countof Array sizeof Array sizeof Array 0 BK IK HK KK KC KC KC KK TK k AAA RA RA KK Kk kk kk K K ke kc ke ke ke koe ke ke KOK ke ke Simple use of the LISTBOX widget Dk ck ck k k k k k k k k KEK k k k k k k k k lt ck ck k k k K K k k K ck K k lt ck ck k k k lt ko Sk K k x kx kx ko KK void DemoListBox void 1 int i int Entries countof ListBox 1 LISTBOX Handle hListBox User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 207 int ySize GUI GetFontSizeYOf amp GUI Font13B 1 Entries Create the listbox hListBox LISTBOX Create ListBox 10 10 60 ySize WM CF SHOW Change current selection of the listbox for i 0 i lt Entries 1 i GUI Delay 500 LISTBOX IncSel hListBox WM Exec for i 0 i lt Entries 1 1 GUI_Delay 500 LISTBOX_DecSel hListBox WM_Exec Delete listbox widget LISTBOX Delete hListBox GUI_Clear KK IK IK k k k K K K K K K K K K K K KOK KOK KOK K K KOK KO
396. y a series of pixels that must lie at display coordinates They can therefore appear jagged particularly lines which are nearly horizontal or nearly vertical This jaggedness is called aliasing Antialiasing is the smoothing of lines and curves It reduces the jagged stair step appearance of any line that is not exactly horizontal or vertical uC GUI supports dif ferent antialiasing qualities antialiased fonts and high resolution coordinates Support for antialiasing is a seperate software item and is not included in the uC GUI basic package The software for antialiasing is located in the subdirectory GuI Anti Alias User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 242 CHAPTER 15 Antialiasing 15 1 Introduction Antialiasing smoothes curves and diagonal lines by blending the background color with that of the foreground The higher the number of shades used between back ground and foreground colors the better the antialiasing result and the longer the computation time Quality of antialiasing The quality of antialiasing is set by the routine lzd234b565 GUI AA SetFactor explained later in the chapter For an idea of the relationship between the antialiasing factor and the corresponding result take a look at the image pictured The first line is drawn without antialiasing factor 1 The second line is drawn antialiased using factor 2 This means that the number of shades from foregr
397. y fast The redrawal is done by the WM at a later time or it can be forced by calling wM_Paint for the widget wM Exec until all windows are redrawn How to use widgets Suppose we would like to display a progress bar All that is needed is the following code PROGBAR Handle hProgBar GUI DispStringAt Progress bar 100 20 hProgBar PROGBAR Create 100 40 100 20 WM SHOW The first line reserves memory for the handle of the widget The last line actually creates the widget The widget will then automatically be drawn by the window manager if wM Exec is called at a later point or in a separate task Member functions are available for each type of widget which allow modifications to their appearance Once the widget has been created its properties can be changed by calling one of its member functions These functions take the handle of the widget as their first argument In order to make the progress bar created above show 45 and to change the bar colors from their defaults dark gray light gray to green red the following code section may be used User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 171 PROGBAR SetBarColor hProgBar 0 GUI GREEN PROGBAR SetBarColor hProgBar 1 GUI RED PROGBAR SetValue hProgBar 45 Progress bar All widgets also have one or more configuration macros E which define various default settings such as fonts an
398. ystem hardware Your target system must e Have a CPU 8 16 32 64 bits e Have a minimum of RAM and ROM e Have a full graphic LCD any type and any resolution The memory requirements vary depending on which parts of the software are used and how efficient your target compiler is It is therefore not possible to specify pre cise values but the following apply to typical systems Small systems no window manager e RAM 100 bytes e Stack 500 bytes e ROM 10 25 kb depending on the functionality used Big systems including window manager and widgets e 2 6 kb depending on number of windows required e Stack 1200 bytes e ROM 30 60 kb depending on the functionality used Note that ROM requirements will increase if your application uses many fonts All val ues are rough estimates and cannot be guaranteed Development environment compiler The CPU used is of no importance only an ANSI compliant C compiler is required If your compiler has some limitations please let us know and we will inform you if these will be a problem when compiling the software Any compiler for 16 32 64 bit CPUs or DSPs that we know of can be used most 8 bit compilers can be used as well A C compiler is not required but can be used The application program can there fore also be programmed in C if desired 1 2 wC GUIpC GUlatures HC GUI is designed to provide an efficient processor and LCD controller indepen dent graphical
399. yte from LCD controller with A line high LCD WRITE AO0 Write a byte to LCD controller with A line low LCD WRITE A1 Write a byte to LCD controller with A line high Serial mode Macro Explanation LCD INIT CONTROLLER Initialization sequence for the LCD controller LCD WRITE 0 Write a byte to LCD controller with A line low LCD WRITE A1 Write a byte to LCD controller with A line high LCD WRITEM A1 Write multiple bytes to LCD controller with A line high Additional configuration switches None Special requirements for certain LCD controllers None 22 3 LCD13XX Supported hardware Controllers This driver has been tested with the following LCD controllers Epson SED1352 S1D13502 Epson SED1354 S1D13504 Epson SED1356 S1D13506 Epson SED1374 S1D13704 Epson SED1375 S1D13705 Epson SED1376 S1D13706 Epson SED1386 S1D13806 Epson S1D13A03 S1D13A04 It should be assumed that it will also work with any controller of similar organization Bits per pixel Supported color depths are 1 2 4 8 and 16 bpp Interfa ces The chips supported by this driver can be interfaced in 8 16 bit parallel full bus modes The driver supports both interfaces Please refer to the respective LCD controller manual in order to determine if your chip can be interfaced in 8 bit mode User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 314 CHAPTER 22 LCD Drivers Display data RAM organizat
400. ze Parameter Meaning BorderSize Size to be set FRAMEWIN SetDefaultCaptionSize Description Sets the size in Y for the title bar Prototype void FRAMEWIN SetDefaultCaptionSize int CaptionSize Parameter Meaning CaptionSize Size to be set FRAMEWIN_SetDefaultFont Description Sets the default font used to display the title Prototype void FRAMEWIN_SetDefaultFont const GUI_FONT pFont Parameter Meaning pFont Pointer to font to be used as default FRAMEWIN SetFont Description Sets the title font Prototype void FRAMEWIN SetFont FRAMEWIN Handle hObj const GUI FONT pfont Parameter Meaning hObj Handle of frame window ERU Pointer to the font FRAMEWIN SetText Description Sets the title text User s amp reference manual for uC GUI 2002 Micrium Technologies Corporation 199 Prototype void FRAMEWIN SetText FRAMEWIN Handle hObj const char s Parameter Meaning hObj Handle of frame window S Text to display as the title FRAMEWIN SetTextAlign Description Sets the text alignment of the title bar Prototype void FRAMEWIN SetTextAlign FRAMEWIN Handle hObj int Align Parameter Meaning hObj Handle of frame window Align Alignment attribute for the title see table below Permitted values for parameter Align
Download Pdf Manuals
Related Search
Related Contents
Read full text Hotpot° & Aquagrad User Manual - Thermo Fisher Scientific 3D GeoModeller Tutorial Case Study J Chamberlain 3885C Garage Door Opener User Manual Musical Fidelity X-80 User's Manual Hyperion EOS0610iDUOII Ladegerät Rexel 2103759 folder DIGITA DR DALI KM0832 Copyright © All rights reserved.
Failed to retrieve file