This article is a generic guide on how to get started with µGFX. It explains how a copy of the µGFX library can be obtained and where to begin reading the documentation in order to understand how the library is supposed to be used. There are a couple of other articles that explain how µGFX can be integrated into existing projects and how it can be used together with IDEs. You can find the list of these articles in the Using µGFX on... and Using IDEs sections on the main page.
There are two ways to get a copy of µGFX: A stable release and the latest version from the git repository. We currently strongly recommend to use the git repository. Before you start, please make sure that your application and the use of µGFX meets the license of this project. Please contact us should you have any questions regarding licensing. If you're using µGFX for free please considering making a small donation to support our efforts.
We understand that integrating µGFX into your project might be the most difficult part for most users. Please do not hesitate to ask for help should you face any issues.
A copy of a stable release of µGFX can be downloaded from the download section.
Please note that the following guide has been written for unix-like systems using the terminal. For Windows you may use a graphical git client such as SourceTree.
µGFX is developed through a git repository hosted here.
cd /path/to/your/project/resources git clone https://git.ugfx.io/ugfx/ugfx.git ugfx
If you're more familiar with git you might want to read the following guide in order to learn how to seamlessly integrate the uGFX repository into your existing repository: Use_uGFX_repository_as_Git_Submodule;
Understanding the architecture of the µGFX library is rather important. See Architecture.
Important: When you want to build a classic GUI with widgets like pushbuttons, sliders, dialog boxes and so on, use the GWIN module directly. There is no need to manually draw something or manually read out the touchscreen. Everything is handled automatically in the GWIN module.
After you have successfully obtained a copy of µGFX, you have to include it into your current project. The follow section will describe how uGFX can be integrated into an existing Makefile project or how it can be easily used with an IDE.
The uGFX library comes with a built-in Makefile system (which is not mandatory to be used, see Single File Inclusion below). If your IDE / Project allows to use external, existing Makefiles, we highly recommend using this method of adding uGFX to your project.
- Set the GFXLIB variable to the path pointing to the µGFX library root directory
- Include the main µGFX Makefile (/ugfx/gfx.mk)
- Add GFXSRC to the sources variable/list
- Add GFXINC to the include paths variable/list
- Include additional Makefiles of the µGFX library to include board files, drivers, ...
Single File Inclusion
If your IDE or project doesn't allow using Makefiles there's another very easy way to include the uGFX library in your project. All that needs to be done is adding the /src/gfx_mk.c file to the sources and adding the µGFX library root directory to the compiler include path.
- Add /src/gfx_mk.c to the sources in the files tree of your project
- Add the path to the µGFX library root directory to the compiler include path
- Add the source and header files of each driver that you want to be using the same way
Note: Some features such as multiple-display support and pixmaps are currently not supported when using the single-file-inclusion method. µGFX v3.0 no longer has this limitation.
You can find a variety of different guides explaining how to integrate uGFX into an existing project on the main page.
Certain modules of µGFX such as the display and touchscreen drivers require a file which builds the interface to your actual hardware. This board file tells µGFX how to talk to your hardware.
The documentation of every module shows how to create these board files.
See board file.
The entire configuration of µGFX happens in a file called gfxconf.h which you have to create. A template that can be copied can be found in /gfxconf.example.h. The configuration is crucial so please make sure that you at least scrolled once through the configuration article.
The /demos directory contains a variety of different demos, reaching from single feature (per module sorted) demos up to complete application demos. These demos can be compiled easily by adding the corresponding demo.mk file to your Makefile. For example:
Note: When including a demo Makefile, you have to make sure that you don't compile any other sources with it (eg. exclude your own main.c form the compilation process).
There are two ways to get support for your µGFX related problems:
- Free public support by the community through the discussion forum
- A support agreement / contract
Please do not hesitate to contact us if you're interested in a support agreement.