版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
AN4323
Applicationnote
GettingstartedwithSTemWinLibrary
Introduction
ApartnershipwithSeggerMicrocontrollerGmbH&Co.KGenablesSTMicroelectronicstoprovideSTemWinLibrary,aproductbasedonSegger’sgraphiclibraryemWin.
STemWinLibraryisaprofessionalgraphicalstacklibraryenablingthebuildingupofGraphicalUserInterfaces(GUIs)withanySTM32,anyLCD/TFTdisplayandanyLCD/TFTcontroller,takingadvantageofSTM32hardwareaccelerationswheneverpossible.
STemWinLibraryisacomprehensivesolutioncomingwithrichfeaturessuchasJPG,GIFandPNGdecoding,manywidgets(checkboxes,buttons…)andaVNCserverallowingtodisplayremotelyalocaldisplay,butalsoprofessionaltoolssuchasGUIBuildertocreatedialogboxesbydraganddrop,afontconverter,etc.
Table1
liststhemicrocontrollersconcernedbythisapplicationnote.
Table1.Applicableproducts
Type
Productcategories
Microcontrollers
STM32F0xxseriesSTM32F1xxseriesSTM32F2xxseriesSTM32F3xxseries
STM32F4xxseriesSTM32L1xxseries
July2013 DocID024959Rev1 1
/31
Contents
AN4323
2/31
DocID024959Rev1
Contents
Libraryandpackagepresentation 6
Licensinginformation 6
Librarydescription 6
Packageorganization 8
Deliveredbinaries 8
SupportedEVALboardsandexamples 10
HowtouseSTemWinLibrarystepbystep 13
Configuration 13
GUIConf_stm32xxx_eval.c 13
LCDConf_stm32xxx_eval.c 13
GUI_X.corGUI_X_OS.c 14
GUIinitialization 14
Corefunctions 15
Imagefiledisplay 15
Bidirectionaltext 15
Alphablending 15
Spritesandcursors 15
Memorydevices 16
Antialiasing 17
WindowManager 17
Widgetlibrary 18
VNCserver 18
Requirements 19
Processdescription 20
Fonts 21
GUIBuilder 24
BasicusageoftheGUIBuilder 25
Creationroutine 25
User-definedcode 25
Callbackroutine 25
Performanceandfootprint 26
LCDdriverperformance 26
STemWinfootprint 27
FAQs(FrequentlyAskedQuestions) 29
Revisionhistory 30
DocID024959Rev1 3
/31
Listoftables
AN4323
Listoftables
Table1. Applicableproducts 1
Table2. SupportedLCDcontrollers 7
Table3. SupportedEVALboardsandexamples 10
Table4. FontAPI 23
Table5. Speedtestlist 26
Table6. SpeedtestfortheSTM324xG-EVAL+FlexColordriver 26
Table7. Modulefootprint 27
Table8. Widgetfootprint 28
Table9. FAQs 29
Table10. Documentrevisionhistory 30
4/31
DocID024959Rev1
AN4323
Listoffigures
Listoffigures
Figure1. STemWinlayers 6
Figure2. Projecttree 8
Figure3. StructureoftheSTemWinLibraryexamples 10
Figure4. Alphablendingeffect 15
Figure5. Animatedsprites 16
Figure6. Cursors 16
Figure7. Scalingandrotationeffectusingmemdev 17
Figure8. Shapeantialiasing 17
Figure9. Widgetexamples 18
Figure10. VNCserverusage 19
Figure11. VNCclient 20
Figure12. TheGUIBuilderapplication 24
DocID024959Rev1 5
/31
Libraryandpackagepresentation
AN4323
Libraryandpackagepresentation
TheSTemWinLibrarypackageincludesasetoffirmwarelibrariesandsoftwaretoolsusedtobuildadvancedandprofessionalGUI-basedapplications.
Licensinginformation
STemWinLibraryGUIfilesareprovidedinobjectformatandlicensedunderMCD-STImageSoftwareLicenseAgreementV2(the“License”);youmaynotusethispackageexceptincompliancewiththeLicense.YoumayobtainacopyoftheLicenseat:
/software_license_agreement_image_v2.
STemWinLibraryconfigurationandheaderfilesareprovidedinsourceformatandlicensedunderMCD-STLibertySoftwareLicenseAgreementV2(the“License”);youmaynotusethispackageexceptincompliancewiththeLicense.YoumayobtainacopyoftheLicenseat:
/software_license_agreement_liberty_v2.
Unlessrequiredbyapplicablelaworagreedtoinwriting,softwaredistributedundertheLicenseisdistributedonan“ASIS”BASIS,WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.SeetheLicenseforthespecificlanguagegoverningpermissionsandlimitationsundertheLicense.
Librarydescription
Figure1
showshowSTemWinisstructuredinternallyandhowitcanbeimplementedinacompleteproject.
Figure1.STemWinlayers
TheCRCmodule(inRCCperipheralclockenableregister)shouldbeenabledbeforeusingthelibrary.
6/31
DocID024959Rev1
AN4323
Libraryandpackagepresentation
STemWinLibraryincludestwooptimizeddrivers:
Directlinearaccess(LIN)driverfortheSTM32F429TFT-LCDcontrollerwiththeDMA2DChromARTgraphicalaccelerationengine,
FlexColor(indirectaccess)driverforserialandparallelbusexternalLCDcontrollersavailableonallSTM32EVALboards.
Referto
Table2
foralistofallsupporteddisplaycontrollers.
Note: ItisstillpossibletosupportanyotherLCDtypejustbyimplementingitsown“custom”driver.
Inadditiontothemainapplication,theuserhastosetandcustomizetwoessentialinterfacefiles:
LCDconfigurationfile(LCDConf_stm32xxx_eval.c)
LCDDisplayinitializationandconfiguration
LCDDisplaydriverlinkandcustomizing
Additionalhardwarecapabilitymanagement
GUIconfigurationfile(GUIConf_stm32xxx_eval.c)
Moduleselection(memorydevice,windowmanager…)
GUImemoryandheapmanagement
Table2.SupportedLCDcontrollers
Driver
SupportedLCDcontrollers
Supportedbits/pixels
GUIDRV_Lin
Thisdriversupportseverydisplaycontrollerwithlinearaddressablevideomemorywithadirect(fullbus)interface.ThismeansthatthevideoRAMisdirectlyaddressablebytheaddresslinesoftheCPU.
Thedrivercontainsnocontroller-specificcode.SoitcanalsobeusedforsolutionswithoutdisplaycontrollerwhichrequireadriverwhichonlymanagesthevideoRAM.
16,18
EpsonS1D19122
FocalTechFT1509
HimaxHX8301,HX8340,HX8347,HX8352,HX8353,HX8325A
HitachiHD66772
IlitekILI9220,ILI9221,ILI9320,ILI9325,ILI9328,ILI9335,
ILI9338,ILI9340,ILI9341,ILI9342,ILI9481
GUIDRV_FlexColor
LGElectronicsLGDP4531,LGDP4551
NovatekNT39122
1,2,4,8,
16,24,32
OriseTechSPFD5408,SPFD54124C,SPFD5414D
RenesasR61505,R61516,R61526,R61580
SamsungS6D0117,S6E63D6
SitronixST7628,ST7637,ST7687,ST7712,ST7735
SolomonSSD1355,SSD1961,SSD1963,SSD2119
SyncoamSEPS525
DocID024959Rev1 7
/31
Libraryandpackagepresentation
AN4323
Packageorganization
Figure2
showstheprojecttree.
Standardandadvancedlibraries
STemWinLibrary:
Config:globalconfigfile+templatesGUIConfandLCDConffiles
Documentation:emWinUser&ReferenceGuideInc:headerfilesoftheSTemWincomponentsLib:binaryformatlibrariescompiledforCM3andCM4cores(withandwithoutOSsupport)
OS:libraryinterfacewithRTOS
Software:PCapplication
Examplesimplementedonallsupportedboards
STM32_EVAL:standardevaluationboardshardwaredriver
Third_Party:third-partydriverssuchas:
LwIPdrivers
FreeRTOSdrivers
MSv32145V1
Binariesfolder:containsallprojectsin‘.hex’format
Figure2.Projecttree
Deliveredbinaries
STemWinLibraryisdistributedbySTasanobjectcodelibrarylockedtoSTM32products.ThelibraryiscompiledforCM3andCM4cores,bothwithandwithoutOSsupport.
Notethatthelibraryiscompiler-dependent(EWARM,MDK-ARM,TrueSTUDIO).
8/31
DocID024959Rev1
AN4323
Libraryandpackagepresentation
Tosummarize,thefolder“Libraries\STemWinLibrary520d\Lib”containstwelvebinaries:
STemWin520d_CM3_IAR.a
STemWin520d_CM3_Keil.a
STemWin520d_CM3_GCC.a
STemWin520d_CM3_OS_IAR.a
STemWin520d_CM3_OS_Keil.a
STemWin520d_CM3_OS_GCC.a
STemWin520d_CM4_IAR.a
STemWin520d_CM4_Keil.a
STemWin520d_CM4_GCC.a
STemWin520d_CM4_OS_IAR.a
STemWin520d_CM4_OS_Keil.a
STemWin520d_CM4_OS_GCC.a
DocID024959Rev1 9
/31
SupportedEVALboardsandexamples
AN4323
SupportedEVALboardsandexamples
Table3
liststhesupportedEVALboardsandexamples.
Table3.SupportedEVALboardsandexamples
STM32Series/EVALboard
LCDinterface
LCDdriver
STM32F1
STM3210B-EVAL
SPI
FlexColor
STM3210C-EVAL
SPI
STM3210E-EVAL
FSMC
STM32100B-EVAL
SPI
STM32100E-EVAL
FSMC
STM32F2
STM322xG-EVAL
FSMC
STM32F3
STM32303C-EVAL
SPI
STM32373C-EVAL
SPI
STM32F4
STM324xG-EVAL
FSMC
STM32L1
STM32L152-EVAL
SPI
STM32L152D-EVAL
FSMC
Asillustratedin
Figure3
,eachprojectcontainstwosub-projects:
RTOS-basedexample
Standaloneexample
Figure3.StructureoftheSTemWinLibraryexamples
TheConfig\foldercontainsthetwointerfacefilesdescribedin
Section1.2
:
GUIConf_stm32xxx_eval.c/.h
LCDConf_stm32xxx_eval.c/.h
10/31
DocID024959Rev1
AN4323
SupportedEVALboardsandexamples
IntheRTOSexample,theConfig\directoryalsocontainstheFreeRTOSconfigurationfile(FreeRTOSConfig.h).
ThemainapplicationsourcecodeislocatedintheDemo\folder.Itconsistsofagenericdemonstrationcomposedofseveralsub-modulessuchas:
Radialmenu(selectsaniconfromaradialmenuusingSTemWinmotionsupport)
Listview(showssomefeaturesoftheLISTVEWwidget)
Bitmap(showsdifferentbitmapswithandwithoutcompression)
Antialiasedtext(outputsanti-aliasedtextonvariousbackgrounds)
Treeview(showsahierarchicalviewofthefilesinadirectoryandsomemovingsprites)
Iconview(demonstratestheuseoftheICONVIEWwidget)
…
AllthesemodulescannotbefullysupportedonallEVALboards:eachexamplewillcontainmoreorlessmodulesdependingonthememoryavailableontheboard.
TheusercanchoosewhichmoduletoactivateinfileGUIDEMO.hlocatedunderDemo\.Aportionofcode(moduleselection)fromtheGUIDEMO.hfileisshownbelow.
/*********************************************************************
*
* Configurationofmodulestobeused
*
**********************************************************************
*/
#ifndef
#define
SHOW_GUIDEMO_BITMAP
SHOW_GUIDEMO_BITMAP
(1)
#endif
#ifndef#define
SHOW_GUIDEMO_COLORBARSHOW_GUIDEMO_COLORBAR
(0)
#endif
#ifndef#define
SHOW_GUIDEMO_CURSORSHOW_GUIDEMO_CURSOR
(1)
#endif
#ifndef#define
SHOW_GUIDEMO_GRAPHSHOW_GUIDEMO_GRAPH
(1)
#endif
#ifndef#define
SHOW_GUIDEMO_LISTVIEWSHOW_GUIDEMO_LISTVIEW
(1)
#endif
DocID024959Rev1 1
1/31
SupportedEVALboardsandexamples
AN4323
#ifndef
#define
SHOW_GUIDEMO_SPEED
SHOW_GUIDEMO_SPEED
(1)
#endif
#ifndef#define
SHOW_GUIDEMO_TREEVIEWSHOW_GUIDEMO_TREEVIEW
(0)
#endif
#ifndef#define
SHOW_GUIDEMO_ICONVIEWSHOW_GUIDEMO_ICONVIEW
(1)
#endif
#ifndef#define
SHOW_GUIDEMO_RADIALMENUSHOW_GUIDEMO_RADIALMENU
(1)
#endif
#ifndef#define
SHOW_GUIDEMO_VSCREENSHOW_GUIDEMO_VSCREEN
(0)
#endif
#ifndef#define
SHOW_GUIDEMO_AUTOMOTIVESHOW_GUIDEMO_AUTOMOTIVE
(0)
#endif
NotethattheVNCmodule(describedindetailin
Section3.8
)isactivatedbydefaultwiththefollowingconfigurations:
STM324xG-EVAL+FreeRTOS
STM322xG-EVAL+FreeRTOS
TheUser\directoryincludesthesystem-relatedfiles,themainprogramand,insomeexamples(wheretheVNCfeatureissupported),thenetworkconnectionconfigurationfiles.
12/31
DocID024959Rev1
AN4323
HowtouseSTemWinLibrarystepbystep
HowtouseSTemWinLibrarystepbystep
ThissectionprovidesanoverviewofthemainfeaturesofSTemWinLibrary,aswellasthemainsettingsandconfigurationsteps.Forfurtherdetails,refertotheSegger’semWinUserManual.
Configuration
Theconfigurationisbasicallydividedintotwoparts:GUIconfigurationandLCDconfiguration.
TheGUIconfigurationcoverstheconfigurationofdefaultcolorsandfontsandofavailablememory.
TheLCDconfigurationismorehardware-dependentandenablestheusertodefinethephysicalsizeofthedisplay,thedisplaydriverandthecolorconversionroutinestobeused.
WhenanewLCDcontrollerneedstobesupported,twoessentialfilesmustbecreated,inadditiontothealreadyexistingOSconfigurationfile:GUIConf_stm32xxx_eval.candLCDConf_stm32xxx_eval.c.
GUIConf_stm32xxx_eval.c
Inthisfile,theusershouldimplementtheGUI_X_Config()functionwhichistheveryfirstroutinecalledduringtheinitializationprocess.ItsmaintaskistosetuptheavailablememoryfortheGUIandtothenassignittothedynamicmemorymanagementsystem.
ThisoperationisdoneviatheGUI_ALLOC_AssignMemory()function:itpassesapointertoamemoryblockanditssize(inbytes)tothememorymanager.
Note: Thememorymustbeaccessibleandmustbe8-,16-and32-bitwide.Memoryaccessischeckedduringinitialization.
LCDConf_stm32xxx_eval.c
ThemainfunctionhereisLCD_X_Config(),calledimmediatelyafterGUI_X_Config()hasbeenexecuted.LCD_X_Config()allowscreatingandconfiguringadisplaydriverforeachlayerbycalling:
GUI_DEVICE_CreateAndLink(),whichcreatesthedriverdeviceandlinksittothedevicechain;
LCD_SetSizeEx()andLCD_SetVSizeEx(),tosetthedisplaysizeconfiguration;
Otherdriver-specificconfigurationroutinessuchas:
GUIDRV_FlexColor_Config(),inassociationwiththeusageoftheFlexColordriver;
LCD_SetVRAMAddrEx(),requiredincaseoflinearaddressablememory.
Asmentionedin
Section1.2
,STemWinLibrarycomeswithtwooptimizeddrivers,GUIDRV_LinandGUIDRV_FlexColor,whichcoveralltheLCDsembeddedinSTEVAL-boards.
DocID024959Rev1
13/31
HowtouseSTemWinLibrarystepbystep
AN4323
Formoredetailsaboutusageofthesedrivers,pleasevisitSegger’swebsite:
/guidrv_flexcolor.html
/guidrv_lin.html
Ingeneral,whenanewLCDtypeneedstobesupported,theusershouldcheckifthesameLCDcontrollerisalreadysupported,thenhejusthastoupdatethealreadyexistingLCDConf_stm32xxx_eval.c.
Anotherfunction,LCD_X_DisplayDriver(),iscalledbythedisplaydriverforseveralpurposes,forexamplewhenusingadvancedfeatureslikemultiplebuffers,smoothscrollingorvirtualpages.Tosupportthecorrespondingtask,theroutineneedstobeadaptedtothedisplaycontroller.
GUI_X.corGUI_X_OS.c
GUI_X.cforsingletaskexecution:
“Singletask”meansthattheprojectusesSTemWinonlyfromwithinonesingletask.ThemainpurposeistosupplySTemWinwithatimingbase.OS_TimeMSneedstobeincrementedeachms.
GUI_X_OS.cformultitaskexecution:
IfSTemWinisusedinamultitaskingsystem,thisfilecontainsadditionalroutinesrequiredforsynchronizingtasks(forthispurpose,thefileGUI_X_FreeRTOS.ccanbeusedasatemplate).
GUIinitialization
ToinitializetheSTemWininternaldatastructuresandvariables,GUI_Init()shouldbeused.Asimple“Helloworld”programillustratesthisinitialization,asshownbelow.
“Helloworld”example:
voidMain(void){intxPos,yPos;
GUI_Init();
xPos=LCD_GetXSize()/2;yPos=LCD_GetYSize()/3;
GUI_SetFont(GUI_FONT_COMIC24B_ASCII);
GUI_DispStringHCenterAt("Helloworld!",xPos,yPos);while(1);
}
14/31
DocID024959Rev1
AN4323
HowtouseSTemWinLibrarystepbystep
Corefunctions
Imagefiledisplay
STemWincurrentlysupportstheBMP,JPEG,GIFandPNGfileformats.ThelibraryincludesrichAPIsforeachoneoftheseimageformats(fullydocumentedintheSTemWinUserManual).Anapproximationofthememoryresourcesneededforeachimagetypeisgivenin
Section4:Performanceandfootprint
.
Bidirectionaltext
DrawingArabicorHebrewtextwithSTemWinisquiteeasyandissupportedautomaticallyineachtext-basedfunction.Itonlyneedstobeenabledoncebyusingthefollowingcommand:
GUI_UC_EnableBIDI()
Alphablending
Alphablendingisamethodcombiningthealphachannelwithotherlayersinanimageinordertocreatetheappearanceofsemi-transparency(see
Figure4
).
Figure4.Alphablendingeffect
Theusercanenableautomaticalphablendingusingthefollowingcommand:
GUI_EnableAlpha()
Hecanalsogiveanalphavaluetodeterminehowmuchofapixelshouldbevisibleandhowmuchofthebackgroundshouldshowthrough:
GUI_SetUserAlpha()
Spritesandcursors
Aspriteisanimagewhichcanbeshownaboveallothergraphicsonthescreen.
Aspritepreservesthescreenareaitcovers.Itcanbemovedorremovedatanytime,fullyrestoringthescreencontent.Animationbyuseofmultipleimagesisalsopossible.
DocID024959Rev1
15/31
HowtouseSTemWinLibrarystepbystep
AN4323
Figure5.Animatedsprites
Spritescanbeanimated(
Figure5
)bycallingGUI_SPRITE_CreateAnim().Notethatspritesmanagethebackgroundautomatically.
STemWinalsoincludesasystem-widecursor(
Figure6
),whichcanalsobeanimatedbyusingGUI_CURSOR_SetAnim().Cursorsareactuallybasedonsprites.
Figure6.Cursors
Althoughthecursoralwaysexists,itishiddenbydefault.Itisnotvisibleuntilacallismadetoshowit(GUI_CURSOR_Show()),andmaybehiddenagainatanypoint(GUI_CURSOR_Hide()).
Memorydevices
Amemorydeviceisahardware-independentdestinationdevicefordrawingoperations.
Ifamemorydeviceiscreated(bycallingGUI_MEMDEV_Create())thenvalidated(bycallingGUI_MEMDEV_Select()),alldrawingoperationsareexecutedinmemory.Thefinalresultisdisplayedonthescreenonlywhenalloperationshavebeenfinished.ThisactionisdonebycallingGUI_MEMDEV_CopyToLCD().
Memorydevicescanbeused:
topreventflickeringeffect(duetodirectdrawingonthedisplay),
ascontainersfordecompressedimages,
forrotating(GUI_MEMDEV_Rotate())andscalingoperations(
Figure7
),
forfadingoperations,
forwindowanimations,
fortransparencyeffects.
16/31
DocID024959Rev1
AN4323
HowtouseSTemWinLibrarystepbystep
Figure7.Scalingandrotationeffectusingmemdev
Sincememorydevicesneedaconsiderableamountofmemory(seecomponent“MemoryDevice”in
Table7
),itisadvisedtouseanexternalmemoryifavailable.
Antialiasing
Antialiasingsmoothescurvesanddiagonallinesby“blending”thebackgroundcolorwiththeforegroundone.Thisisdonebyaddingintermediatecolorsbetweenobjectandbackground.
Shapeantialiasing
STemWinsupportsantialiaseddrawingof:
Text(FontConverterisrequiredtocreateAAfonts)
Arcs(GUI_AA_DrawArc())
Circles(GUI_AA_FillCircle())
Lines(GUI_AA_DrawLine())
Polygons(GUI_AA_DrawPolyOutline()andGUI_AA_FillPolygon())
Figure8.Shapeantialiasing
WindowManager
WindowManagercanbedescribedas:
Amanagementsystemforahierarchicwindowstructure:
Eachlayerhasitsowndesktopwindow.Eachdesktopwindowcanhaveitsownhierarchictreeofchildwindows.
Acallbackmechanism-basedsystem:
Communicationisbasedonanevent-drivencallbackmechanism.AlldrawingoperationsshouldbedonewithintheWM_PAINTevent.
Thefoundationofthewidgetlibrary:
AllwidgetsarebasedonthefunctionsoftheWindowManager.
DocID024959Rev1
17/31
HowtouseSTemWinLibrarystepbystep
AN4323
Widgetlibrary
Widgets(Window+Gadget)arewindowswithobject-typeproperties.TheyrequiretheWindowManager.
AlistofallwidgetsavailableinSTemWinLibrarycanbefoundat:
/emwin-widgets.html
Onceawidgetiscreated,itistreatedjustlikeanyotherwindow.TheWindowManagerensuresthatitisproperlydisplayed(andredrawn)whenevernecessary.
Figure9.Widgetexamples
Widgetcreation
Creatingawidgetcanbedonewithonelineofcode.Therearebasicallytwowaysofcreatingawidget:
Directcreation:
Creationfunctionsexistforeachwidget:
<WIDGET>_CreateEx():creationwithoutuserdata.
<WIDGET>_CreateUser():creationwithuserdata.
Indirectcreation:
“Indirect”meanshereusingadialogboxcreationfunctionandaGUI_WIDGET_CREATE_INFOstructurewhichcontainsapointertotheindirectcreationroutine:
<WIDGET>_CreateIndirect():creationbydialogboxcreationfunction.
VNCserver
VNCstandsfor“VirtualNetworkComputing”.TheVNCserverisusedtoconnecttheembeddedtargettoanetworkPCviaTCP/IP,whichallowsto:
viewtheLCDcontentonthedistantPCmonitor,andto
controltheembeddedenvironmentusingthemouse.
18/31
DocID024959Rev1
AN4323
HowtouseSTemWinLibrarystepbystep
Inotherwords,thedisplaycontentsoftheembeddeddevicearevisibleonthescreenofthemachinerunningtheclient(forexample,anetworkPC);themouseandkeyboardcanthenbeusedtocontrolthetarget.
Figure10.VNCserverusage
Requirements
AnSTM32devicewithembeddedEthernetIP,suchasSTM32F107xx,STM32F2x7xxorSTM32F4x7xx.
ATCP/IPstackshouldbepresentinthetarget.Inthedelivereddemo,LwIPisused.
TheVNCservershouldrunasaseparatethread.Therefore,amultitaskingsystemisrequiredtousetheemWinVNCserver.Inourcase,thedemopackagerunswithFreeRTOS.
AVNCviewer(suchasRealVNC,TightVNC,UltraVNC…)shouldbepresentinthesupervisingPC.
DocID024959Rev1
19/31
HowtouseSTemWinLibrarystepbystep
AN4323
Processdescription
Connectthetargethardwaretothenetwork(ortothePC,ifalocalconnectionisneeded)viaanEthernetcable.
Runthedemo.
TheVNC_Server_taskisasub-taskoftheBackground_Task.
Afterhardware(LEDs,TouchScreen,SRAM…)andGUIinitialization,theTCP/IP(LwIP)stackisalsoinitialized.
ThenGUI_VNC_X_StartServer()iscalledto:
initializetheVNCcontextandattachittoalayer,
createataskfortheVNCserver,whichlistensonport5900untilanincomingconnectionisdetectedandthenrunstheactualserver(bycallingGUI_VNC_Process()).
IfDHCPisenabled(“#defineUSE_DHCP”inmain.h):
WaitfortheIPaddresstobeassignedbytheDHCPserver;itwillbedisplayedinthe“VNCServer”page(justafterthe“Intro”page).
IfitisimpossibletoretrieveanyIPaddress(DHCPtimeout),apredefinedstaticIPaddressisassignedanddisplayed.
IfDHCPisdisabled(orincaseofDHCPtimeout):
WaitforastaticIPaddresstobedisplayed.
ConfiguretheIPaddressandthesubnetmaskofthePCwiththesameclassaddressasusedinthetargethardware.
StarttheVNCviewer.
ConnecttotheIPaddressofthetargethardware(see
Figure11
).
ThedemoisthendisplayedonthePC.
UsingtheVNCviewer,theusercan:
WatchtherunningdemoonthePCmonitor(livestreaming);
ControlthetargethardwarefromthePC(usingthemouse);
Takescreenshotsofthedemo(ifneededforamanual,forexample).
Note: Breakingtheviewer'sconnectiontotheserverandthenreconnectingdoesnotresultinanylossofdata.
Figure11.VNCclient
20/31
DocID024959Rev1
AN4323
HowtouseSTemWinLibrarystepbystep
Fonts
ThemostcommonfontsareincludedinSTemWinLibraryasastandardfontpackage.AllofthemcontaintheASCIIcharactersetandmostofthemalsotheISO8859-1characters.
Acompletelistoftheembeddedfontsisshownbelow(takenfromGUI.h).
Note: TheSTemWinLibrarydefaultfontisGUI_Font6x8.
FontsincludedinSTemWinlibrary
//
//Proportionalfonts
//
#defineGUI_FONT_8_ASCII &GUI_Font8_ASCII#defineGUI_FONT_8_1 &GUI_Font8_1#defineGUI_FONT_10S_ASCII &GUI_Font10S_ASCII#defineGUI_FONT_10S_1 &GUI_Font10S_1#defineGUI_FONT_10_ASCII &GUI_Font10_ASCII#defineGUI_FONT_10_1 &GUI_Font10_1#defineGUI_FONT_13_ASCII &GUI_Font13_ASCII#defineGUI_FONT_13_1 &GUI_Font13_1#defineGUI_FONT_13B_ASCII &GUI_Font13B_ASCII#defineGUI_FONT_13B_1 &GUI_Font13B_1#defineGUI_FONT_13H_ASCII &GUI_Font13H_ASCII#defineGUI_FONT_13H_1 &GUI_Font13H_1#defineGUI_FONT_13HB_ASCII &GUI_Font13HB_ASCII#defineGUI_FONT_13HB_1 &GUI_Font13HB_1#defineGUI_FONT_16_ASCII &GUI_Font16_ASCII#defineGUI_FONT_16_1 &GUI_Font16_1
#defineGUI_FONT_16_HK &GUI_Font16_HK#defineGUI_FONT_16_1HK &GUI_Font16_1HK#defineGUI_FONT_16B_ASCII &GUI_Font16B_ASCII#defineGUI_FONT_16B_1 &GUI_Font16B_1#defineGUI_FONT_20_ASCII &GUI_Font20_ASCII#defineGUI_FONT_20_1 &GUI_Font20_1#defineGUI_FONT_20B_ASCII &GUI_Font20B_ASCII#defineGUI_FONT_20B_1 &GUI_Font20B_1#defineGUI_FONT_24_ASCII &GUI_Font24_ASCII#defineGUI_FONT_24_1 &GUI_Font24_1#defineGUI_FONT_24B_ASCII &GUI_Font24B_ASCII#defineGUI_FONT_24B_1 &GUI_Font24B_1#defineGUI_FONT_32_ASCII &GUI_Font32_ASCII#defineGUI_FONT_32_1 &GUI_Font32_1#defineGUI_FONT_32B_ASCII &GUI_Font32B_ASCII#defineGUI_FONT_32B_1 &GUI_Font32B_1
//
DocID024959Rev1
21/31
HowtouseSTemWinLibrarystepbystep
AN4323
//Proportionalfonts,framed
//
#defineGUI_FONT_20F_ASCII &GUI_Font20F_ASCII
//
//Monospaced
//
#defineGUI_FONT_4X6 &GUI_Font4x6
#defineGUI_FONT_6X8 &GUI_Font6x8#defineGUI_FONT_6X8_ASCII &GUI_Font6x8_ASCII#defineGUI_FONT_6X8_1 &GUI_Font6x8_1
#defineGUI_FONT_6X9 &GUI_Font6x9
#defineGUI_FONT_8X8 &GUI_Font8x8#defineGUI_FONT_8X8_ASCII &GUI_Font8x8_ASCII#defineGUI_FONT_8X8_1 &GUI_Font8x8_1
#defineGUI_FONT_8X9 &GUI_Font8x9#defineGUI_FONT_8X10_ASCII &GUI_Font8x10_ASCII#defineGUI_FONT_8X12_ASCII &GUI_Font8x12_ASCII#defineGUI_FONT_8X13_ASCII &GUI_Font8x13_ASCII#defineGUI_FONT_8X13_1 &GUI_Font8x13_1
#defineGUI_FONT_8X15B_ASCII &GUI_Font8x15B_ASCII#defineGUI_FONT_8X15B_1 &GUI_Font8x15B_1#defineGUI_FONT_8X16 &GUI_Font8x16
#defineGUI_FONT_8X17 &GUI_Font8x17
#defineGUI_FONT_8X18 &GUI_Font8x18#defineGUI_FONT_8X16X1X2 &GUI_Font8x16x1x2#defineGUI_FONT_8X16X2X2 &GUI_Font8x16x2x2#defineGUI_FONT_8X16X3X3 &GUI_Font8x16x3x3#defineGUI_FONT_8X16_ASCII &GUI_Font8x16_ASCII#defineGUI_FONT_8X16_1 &GUI_Font8x16_1
//
//Digits
//
#defineGUI_FONT_D24X32 &GUI_FontD24x32#defineGUI_FONT_D32 &GUI_FontD32#defineGUI_FONT_D36X48 &GUI_FontD36x48#defineGUI_FONT_D48 &GUI_FontD48#defineGUI_FONT_D48X64 &GUI_FontD48x64#defineGUI_FONT_D64 &GUI_FontD64#defineGUI_FONT_D60X80 &GUI_FontD60x80#defineGUI_FONT_D80 &GUI_FontD80
//
//Comicfonts
22/31
DocID024959Rev1
AN4323
HowtouseSTemWinLibrarystepbystep
//
#defineGUI_FONT_COMIC18B_ASCII&GUI_FontComic18B_ASCII#defineGUI_FONT_COMIC18B_1 &GUI_FontComic18B_1#defineGUI_FONT_COMIC24B_ASCII&GUI_FontComic24B_ASCII#defineGUI_FONT_COMIC24B_1 &GUI_FontComic24B_1
Inmostcases,thosefontsarefoundsufficient.However,ifneeded,STemWinalsosupportsseveralexternalfontformats:
SystemIndependentFont(SIF)format
ExternalBitmapFont(XBF)format
TrueTypeFont(TTF)format
Forthose,STemWinLibraryincludesarichfontAPI.See
Table4
.
Table4.FontAPI
Routine
Description
Cfilerelatedfontfunctions
GUI_SetDefaultFont()
Setsthedefaultfont.
GUI_SetFont()
Setsthecurrentfont.
’SIF’filerelatedfontfunctions
GUI_SIF_CreateFont()
Createsandselectsafontbypassingapointertosystem-independentfontdata.
GUI_SIF_DeleteFont()
DeletesafontpreviouslycreatedbyGUI_SIF_CreateFont().
’TTF’filerelatedfontfunctions
GUI_TTF_CreateFont()
CreatesaGUIfontfromaTTFfontfile.
GUI_TTF_DestroyCa
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 海外知識(shí)產(chǎn)權(quán)培訓(xùn)
- 碾泥工崗前規(guī)章考核試卷含答案
- 礦山設(shè)備運(yùn)行協(xié)調(diào)員道德評(píng)優(yōu)考核試卷含答案
- 海員基本安全培訓(xùn)
- 丁腈橡膠裝置操作工崗前創(chuàng)新思維考核試卷含答案
- 客運(yùn)船舶駕駛員崗前實(shí)操知識(shí)技能考核試卷含答案
- 高空作業(yè)機(jī)械裝配調(diào)試工測(cè)試驗(yàn)證考核試卷含答案
- 酒店員工培訓(xùn)資料管理與更新制度
- 酒店客房裝修改造制度
- 酒店服務(wù)質(zhì)量監(jiān)控評(píng)估制度
- 2026年及未來5年市場(chǎng)數(shù)據(jù)中國(guó)工程擔(dān)保行業(yè)發(fā)展運(yùn)行現(xiàn)狀及投資潛力預(yù)測(cè)報(bào)告
- (2026年春新版本)人教版二年級(jí)數(shù)學(xué)下冊(cè)全冊(cè)教案
- DB15-T 4265-2026 零碳產(chǎn)業(yè)園配套新能源規(guī)劃編制規(guī)范
- GB/T 13871.1-2022密封元件為彈性體材料的旋轉(zhuǎn)軸唇形密封圈第1部分:尺寸和公差
- 醫(yī)院消毒滅菌效果環(huán)境衛(wèi)生學(xué)監(jiān)測(cè)報(bào)告單(檢驗(yàn))
- 從事拍賣業(yè)務(wù)許可(變更審批)告知承諾書
- xxx項(xiàng)目勘察設(shè)計(jì)任務(wù)書
- 中國(guó)礦業(yè)權(quán)評(píng)估準(zhǔn)則
- 防盜門購(gòu)銷合同通用版
- 【精品文檔】館藏文物信息管理系統(tǒng)用戶手冊(cè)電子版 - 館藏文物信息管理系統(tǒng)用戶手冊(cè)
- 臨床生物化學(xué)檢驗(yàn)技術(shù):第17章 消化系統(tǒng)疾病的生物化學(xué)檢驗(yàn)
評(píng)論
0/150
提交評(píng)論