31 posts in this topic

Hello and welcome to the µGFX community!

The way to do this is by creating a custom widget. You can find the corresponding documentation here.
Judging from the fact that you already linked the matrix operations API documentation I assume that you know that you need to draw a needle polygon and then transform it, is that correct?
In order for us to help you efficiently it would be helpful if you could tell us what you already know/understand and what exactly your questions/problems are. Otherwise we have to write down a complete guide here ^^

You might want to have a look at this custom widget that you can download from the downloads section that does more or less exactly that. It's a lot uglier than yours but the logic behind is the same. You might be able to just take and modify that.
Note that we are using a PNG image as a background / dial / scale. The one you show in your photo can be drawn manually using arcs and lines. That will require way less memory than rendering a PNG image.

Please don't hesitate to ask if you have any other questions. We're happy to help!

Edit: This is the real API documentation for the matrix operations:

Share this post

Link to post
Share on other sites

Hello ;
I was not able to run the program.µVision_5_MDK-ARM I made the instructions here but did not.

Is the correction correct?can you check?

ım using uKEIL V5.22 / WINDOWS 10 / STM32F746NG DISCOVERY KIT 


#ifndef _GFXCONF_H
#define _GFXCONF_H

// GOS - One of these must be defined, preferably in your Makefile       //
//#define GFX_USE_OS_CHIBIOS                           FALSE
//#define GFX_USE_OS_FREERTOS                          FALSE
//    #define GFX_FREERTOS_USE_TRACE                   FALSE
//#define GFX_USE_OS_WIN32                             FALSE
//#define GFX_USE_OS_LINUX                             FALSE
//#define GFX_USE_OS_OSX                               FALSE
//#define GFX_USE_OS_ECOS                              FALSE
//#define GFX_USE_OS_RAWRTOS                           FALSE
//#define GFX_USE_OS_ARDUINO                           FALSE
#define GFX_USE_OS_KEIL                              TRUE
//#define GFX_USE_OS_CMSIS                             FALSE
//#define GFX_USE_OS_RAW32                             FALSE
//#define GFX_USE_OS_NIOS                              FALSE
//    #define INTERRUPTS_OFF()                         optional_code
//    #define INTERRUPTS_ON()                          optional_code

// Options that (should where relevant) apply to all operating systems
//    #define GFX_NO_INLINE                            FALSE
//    #define GFX_COMPILER                             GFX_COMPILER_GCC
//    #define GFX_CPU                                  GFX_CPU_CORTEX_M4_FP
//    #define GFX_CPU_NO_ALIGNMENT_FAULTS              FALSE
//    #define GFX_CPU_ENDIAN                           GFX_CPU_ENDIAN_UNKNOWN
//    #define GFX_OS_HEAP_SIZE                         0
//    #define GFX_OS_NO_INIT                           TRUE
//    #define GFX_OS_INIT_NO_WARNING                   TRUE
//    #define GFX_OS_PRE_INIT_FUNCTION                 myHardwareInitRoutine
//    #define GFX_OS_EXTRA_INIT_FUNCTION               myOSInitRoutine
//    #define GFX_OS_EXTRA_DEINIT_FUNCTION             myOSDeInitRoutine
//    #define GFX_EMULATE_MALLOC                       FALSE

// GDISP                                                                 //
#define GFX_USE_GDISP                                TRUE

//#define GDISP_NEED_AUTOFLUSH                         FALSE
//#define GDISP_NEED_TIMERFLUSH                        FALSE
#define GDISP_NEED_VALIDATION                        TRUE
#define GDISP_NEED_CLIP                              TRUE
#define GDISP_NEED_CIRCLE                            TRUE
//#define GDISP_NEED_ELLIPSE                           FALSE
//#define GDISP_NEED_ARC                               FALSE
//#define GDISP_NEED_ARCSECTORS                        FALSE
#define GDISP_NEED_CONVEX_POLYGON                    TRUE
//#define GDISP_NEED_SCROLL                            FALSE
//#define GDISP_NEED_PIXELREAD                         FALSE
//#define GDISP_NEED_CONTROL                           FALSE
//#define GDISP_NEED_QUERY                             FALSE
//#define GDISP_NEED_MULTITHREAD                       FALSE
//#define GDISP_NEED_STREAMING                         FALSE
#define GDISP_NEED_TEXT                              TRUE
//    #define GDISP_NEED_TEXT_WORDWRAP                 FALSE
//    #define GDISP_NEED_ANTIALIAS                     FALSE
//    #define GDISP_NEED_UTF8                          FALSE
//    #define GDISP_NEED_TEXT_KERNING                  FALSE
//    #define GDISP_INCLUDE_FONT_UI1                   FALSE
//    #define GDISP_INCLUDE_FONT_UI2                   FALSE        // The smallest preferred font.
//    #define GDISP_INCLUDE_FONT_FIXED_10X20           FALSE
//    #define GDISP_INCLUDE_FONT_FIXED_7X14            FALSE
//    #define GDISP_INCLUDE_FONT_FIXED_5X8             FALSE
//    #define GDISP_INCLUDE_USER_FONTS                 FALSE

#define GDISP_NEED_IMAGE                             TRUE
//    #define GDISP_NEED_IMAGE_NATIVE                  FALSE
//    #define GDISP_NEED_IMAGE_GIF                     TRUE
//    #define GDISP_NEED_IMAGE_BMP                     TRUE
//        #define GDISP_NEED_IMAGE_BMP_1               FALSE
//        #define GDISP_NEED_IMAGE_BMP_4               FALSE
//        #define GDISP_NEED_IMAGE_BMP_4_RLE           FALSE
//        #define GDISP_NEED_IMAGE_BMP_8               FALSE
//        #define GDISP_NEED_IMAGE_BMP_8_RLE           FALSE
//        #define GDISP_NEED_IMAGE_BMP_16              FALSE
//        #define GDISP_NEED_IMAGE_BMP_24              FALSE
//        #define GDISP_NEED_IMAGE_BMP_32              FALSE
//    #define GDISP_NEED_IMAGE_JPG                     FALSE
    #define GDISP_NEED_IMAGE_PNG                     TRUE
//    #define GDISP_NEED_IMAGE_ACCOUNTING              FALSE

//#define GDISP_NEED_PIXMAP                            FALSE
//    #define GDISP_NEED_PIXMAP_IMAGE                  FALSE

//#define GDISP_DEFAULT_ORIENTATION                    GDISP_ROTATE_LANDSCAPE    // If not defined the native hardware orientation is used.
//#define GDISP_LINEBUF_SIZE                           128
//#define GDISP_STARTUP_COLOR                          Black
#define GDISP_NEED_STARTUP_LOGO                      FALSE

//#define GDISP_TOTAL_DISPLAYS                         1

//#define GDISP_DRIVER_LIST                            GDISPVMT_Win32, GDISPVMT_Win32
//    #ifdef GDISP_DRIVER_LIST
//        // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
//        #define GDISP_HARDWARE_STREAM_WRITE          FALSE
//        #define GDISP_HARDWARE_STREAM_READ           FALSE
//        #define GDISP_HARDWARE_STREAM_POS            FALSE
//        #define GDISP_HARDWARE_DRAWPIXEL             FALSE
//        #define GDISP_HARDWARE_CLEARS                FALSE
//        #define GDISP_HARDWARE_FILLS                 FALSE
//        #define GDISP_HARDWARE_BITFILLS              FALSE
//        #define GDISP_HARDWARE_SCROLL                FALSE
//        #define GDISP_HARDWARE_PIXELREAD             FALSE
//        #define GDISP_HARDWARE_CONTROL               FALSE
//        #define GDISP_HARDWARE_QUERY                 FALSE
//        #define GDISP_HARDWARE_CLIP                  FALSE

//        #define GDISP_PIXELFORMAT                    GDISP_PIXELFORMAT_RGB888
//    #endif

//#define GDISP_USE_GFXNET                             FALSE
//    #define GDISP_GFXNET_PORT                        13001
//    #define GDISP_GFXNET_UNSAFE_SOCKETS              FALSE

// GWIN                                                                  //
#define GFX_USE_GWIN                                 TRUE

#define GWIN_NEED_WINDOWMANAGER                      TRUE
//    #define GWIN_REDRAW_IMMEDIATE                    FALSE
//    #define GWIN_REDRAW_SINGLEOP                     FALSE
//    #define GWIN_NEED_FLASHING                       FALSE
//        #define GWIN_FLASHING_PERIOD                 250

//#define GWIN_NEED_CONSOLE                            FALSE
//    #define GWIN_CONSOLE_USE_HISTORY                 FALSE
//    #define GWIN_CONSOLE_ESCSEQ                      FALSE
//    #define GWIN_CONSOLE_USE_BASESTREAM              FALSE
//    #define GWIN_CONSOLE_USE_FLOAT                   FALSE
//#define GWIN_NEED_GRAPH                              FALSE
//#define GWIN_NEED_GL3D                               FALSE

#define GWIN_NEED_WIDGET                             TRUE
//#define GWIN_FOCUS_HIGHLIGHT_WIDTH                   1
//    #define GWIN_NEED_LABEL                          FALSE
//        #define GWIN_LABEL_ATTRIBUTE                 FALSE
    #define GWIN_NEED_BUTTON                         TRUE
//        #define GWIN_BUTTON_LAZY_RELEASE             FALSE
    #define GWIN_NEED_SLIDER                         TRUE
//        #define GWIN_SLIDER_NOSNAP                   FALSE
//        #define GWIN_SLIDER_DEAD_BAND                5
//        #define GWIN_SLIDER_TOGGLE_INC               20
//    #define GWIN_NEED_CHECKBOX                       FALSE
//    #define GWIN_NEED_IMAGE                          FALSE
//        #define GWIN_NEED_IMAGE_ANIMATION            FALSE
//    #define GWIN_NEED_RADIO                          FALSE
//    #define GWIN_NEED_LIST                           FALSE
//       #define GWIN_NEED_LIST_IMAGES                FALSE
//    #define GWIN_NEED_PROGRESSBAR                    FALSE
//        #define GWIN_PROGRESSBAR_AUTO                FALSE
//    #define GWIN_NEED_KEYBOARD                       FALSE
//        #define GWIN_KEYBOARD_DEFAULT_LAYOUT         VirtualKeyboard_English1
//        #define GWIN_NEED_KEYBOARD_ENGLISH1          TRUE
//    #define GWIN_NEED_TEXTEDIT                       FALSE
//    #define GWIN_FLAT_STYLING                        FALSE
//    #define GWIN_WIDGET_TAGS                         FALSE

#define GWIN_NEED_CONTAINERS                         TRUE
    #define GWIN_NEED_CONTAINER                      TRUE
//    #define GWIN_NEED_FRAME                          FALSE
//    #define GWIN_NEED_TABSET                         FALSE
//        #define GWIN_TABSET_TABHEIGHT                18

// GEVENT                                                                //
#define GFX_USE_GEVENT                               TRUE

//#define GEVENT_ASSERT_NO_RESOURCE                    FALSE
#define GEVENT_MAXIMUM_SIZE                          32
#define GEVENT_MAX_SOURCE_LISTENERS                  32

// GTIMER                                                                //
#define GFX_USE_GTIMER                               TRUE

#define GTIMER_THREAD_PRIORITY                       HIGH_PRIORITY
#define GTIMER_THREAD_WORKAREA_SIZE                  2048

// GQUEUE                                                                //
#define GFX_USE_GQUEUE                               TRUE

#define GQUEUE_NEED_ASYNC                            TRUE
//#define GQUEUE_NEED_GSYNC                            FALSE
//#define GQUEUE_NEED_FSYNC                            FALSE
//#define GQUEUE_NEED_BUFFERS                          FALSE

// GINPUT                                                                //
#define GFX_USE_GINPUT                               TRUE

#define GINPUT_NEED_MOUSE                            TRUE
//    #define GINPUT_TOUCH_STARTRAW                    FALSE
//    #define GINPUT_TOUCH_NOTOUCH                     FALSE
//    #define GINPUT_TOUCH_NOCALIBRATE                 FALSE
//    #define GINPUT_TOUCH_NOCALIBRATE_GUI             FALSE
//    #define GINPUT_MOUSE_POLL_PERIOD                 25
//    #define GINPUT_MOUSE_CLICK_TIME                  300
//    #define GINPUT_TOUCH_CXTCLICK_TIME               700
//    #define GMOUSE_DRIVER_LIST                       GMOUSEVMT_Win32, GMOUSEVMT_Win32
//#define GINPUT_NEED_KEYBOARD                         FALSE
//    #define GINPUT_KEYBOARD_POLL_PERIOD              200
//    #define GKEYBOARD_DRIVER_LIST                    GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
//    #define GKEYBOARD_LAYOUT_OFF                     FALSE
//        #define GKEYBOARD_LAYOUT_SCANCODE2_US        FALSE
//#define GINPUT_NEED_TOGGLE                           FALSE
//#define GINPUT_NEED_DIAL                             FALSE

// GFILE                                                                 //
#define GFX_USE_GFILE                                TRUE

#define GFILE_NEED_PRINTG                            TRUE
//#define GFILE_NEED_SCANG                             FALSE
#define GFILE_NEED_STRINGS                           TRUE
//#define GFILE_NEED_FILELISTS                         FALSE
//#define GFILE_NEED_STDIO                             FALSE
//#define GFILE_NEED_NOAUTOMOUNT                       FALSE
//#define GFILE_NEED_NOAUTOSYNC                        FALSE

//#define GFILE_NEED_MEMFS                             FALSE
//#define GFILE_NEED_ROMFS                             FALSE
//#define GFILE_NEED_RAMFS                             FALSE
//#define GFILE_NEED_FATFS                             FALSE
#define GFILE_NEED_NATIVEFS                          TRUE
//#define GFILE_NEED_CHBIOSFS                          FALSE

//#define GFILE_ALLOW_FLOATS                           FALSE
//#define GFILE_ALLOW_DEVICESPECIFIC                   FALSE
#define GFILE_MAX_GFILES                             5

// GADC                                                                  //
//#define GFX_USE_GADC                                 FALSE
//    #define GADC_MAX_LOWSPEED_DEVICES                4

// GAUDIO                                                                //
//#define GFX_USE_GAUDIO                               FALSE
//    #define GAUDIO_NEED_PLAY                         FALSE
//    #define GAUDIO_NEED_RECORD                       FALSE

// GMISC                                                                 //
#define GFX_USE_GMISC                                TRUE

//#define GMISC_NEED_ARRAYOPS                          FALSE
//#define GMISC_NEED_FASTTRIG                          FALSE
//#define GMISC_NEED_FIXEDTRIG                         FALSE
//#define GMISC_NEED_INVSQRT                           FALSE
//    #define GMISC_INVSQRT_MIXED_ENDIAN               FALSE
//    #define GMISC_INVSQRT_REAL_SLOW                  FALSE
#define GMISC_NEED_MATRIXFLOAT2D                     TRUE
//#define GMISC_NEED_MATRIXFIXED2D                     FALSE

#endif /* _GFXCONF_H */


c ya :)

Share this post

Link to post
Share on other sites

Can you please tell us what doesn't work?
If you have compile time errors, please attach a text file containing the entire output of the build process to your next forum post.

Also, please do not use colored fonts, larger fonts or similar things in your forum posts.

Share this post

Link to post
Share on other sites

Note: GFX_USE_OS_KEIL is for the Keil CMSIS operating system. This has nothing to do with the Keil IDE. The Keil CMSIS is provided as part of the Keil professional license.

Share this post

Link to post
Share on other sites

That looks very strange - nothing comes to mind right now.
Have you tried making a clean build? You can do that in Keil µVision by clicking Project -> Clean Targets. Then make a new compile. It should restart from the very beginning this time. Can you attach a text file (like you did before, great!) with that clean build output log?

Share this post

Link to post
Share on other sites

So far you are only getting one error:

..\ugfx\src\gfile/gfile_fs_rom.c(36): error:  #5: cannot open source input file "romfs_files.h": No such file or directory

This error means that the file romfs_files.h couldn't be found by the compiler.
The romfs_files.h file is required when you are using ROMFS (if GFILE_NEED_ROMFS is set to TRUE). If you don't actually use ROMFS then simply set it to FALSE. If you need ROMFS then create a file named romfs_files.h where you include all the converted ROMFS files (the files converted with file2c.exe).
You can find the corresponding documentation here:

Share this post

Link to post
Share on other sites


I think you misunderstood with the text files: Only attach text file containing large, generated things like your compiler output. Don't keep your actual explanations, what you did and questions in there. These things belong directly in your forum post. So to summarize: Stuff you want to say/ask -> Forum post    Larger text files that are relative (like compiler outputs, configuration files and similar) -> attach a text file to the same forum post.
That is very important, please re-read it carefully.

I'll quote your text file:


#define GFILE_NEED_NATIVEFS FALSE ///if � change to true this value � get "sys/types.h" error?

but � search in wiki "" � dont want use rom, use native,cause native is good then roms.but � cant use.


� get error :


..\ugfx\src\gfile/gfile_fs_native.c(22): error: #5: cannot open source input file "sys/types.h": No such file or directory


#define GFILE_NEED_ROMFS FALSE (when true : search roms. when include roms )

Not enough information to list image symbols.

Not enough information to list the image map.




I do not know what i should do :(

You cannot use the NativeFS in your case. NativeFS is just a file system wrapper that allows using the native file system of the underlying system (if any). For example, when you're running your application on Windows or Linux, you can use NativeFS to directly access files on your computer's hard disk through GFILE. You are not using an underlying operating system that offers a native file system and hence you can't use NativeFS.

If you want to use files (eg. if your µGFX application wants to load images and other resources from files) then use ROMFS. It's the best option you have. It's super small & efficient and very easy to use. Otherwise you have to use FatFS or something else that is way more complex and way more resource intensive.

So, to summarize: If your µGFX application doesn't need access to files, simply turn the GFILE module off in your configuration file. If your µGFX application needs access to files, then simply use ROMFS in your case. Follow the documentation linked above, create your romfs_files.h files, add it to the project, convert all the files you need to access through ROMFS with file2c.exe, include the generated header files in romfs_files.h and you're done.

Share this post

Link to post
Share on other sites

I did exactly what you said. And I got help from the link above :) It was really useful. But ı got same error("Error.txt")

ı search that error ı found but ı dont understand.Maybe you know what you mean (


I did not add the error list because the same ("Error.txt")

thnx.C  ya 

Share this post

Link to post
Share on other sites


It can be the same two variables. So I have to check the names of all the projects I have combined, but again the same fault.


The mind does not come any more. But I feel we will be successful at the end I hope

Share this post

Link to post
Share on other sites

Can you please attach your Keil project as a ZIP or RAR archive so we can have a look? Please don't forget to clean the project first (Project -> Clean all targets) to keep unnecessary large binaries out of it.

Share this post

Link to post
Share on other sites

We'll have a look at this, but that might take a few days. Stay tuned!

If you have any questions in the meantime please don't hesitate to ask. We're happy to help wherever we can.

Share this post

Link to post
Share on other sites

We had no time to dive into this yet, I'm afraid.
I can't promise that we'll find time for that this week. If this is of importance due to a deadline of a commercial project or something like that please contact us if you want to get priority support (paid support).

Share this post

Link to post
Share on other sites

This project is not paid for me. Just to learn. But if I make a project with money, I definitely ask you.

If it is a simple project is $ 25 ?

Share this post

Link to post
Share on other sites

The project I sent you is your demon. But it did not work, so it is not a hard error for you :-)

Share this post

Link to post
Share on other sites

I just had the time to download and try building the project. Did you even read the error message that you're getting? It tells you exactly what the issue is.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now