Close

Well I was wrong, you *can* split things!

A project log for using uGFX in Arduino

uGFX was written for use with makefiles. Using it in arduino is possible with minimal effort, though. Here's how.

christophChristoph 11/24/2015 at 00:120 Comments

As before, I have a bare ugfx library. The only difference to the original git clone is an additional "ugfx.h" file. It's probably not even necessary, but might help arduino find and pick the correct folder.

Another library is created for the display driver and ugfx config, the library folder looks like this:

~/Arduino/libraries/myproject-ugfx-extdriver
├── board_SSD1331.cpp
├── board_SSD1331.h
├── driver_SSD1331.c
├── gdisp_lld_config.h
├── gfx.c
├── gfxconf.h
├── myproject-ugfx-extdriver.h
└── SSD1331.h
The important details: some of the files need to include headers or source files in ugfx's directory structure. As arduino adds an include path (.../ugfx), we can dive into ugfx like so (in driver_SSD1331.c):

#include "src/gdisp/gdisp_driver.h"
The second important detail is that we include ugfx's single-file-source in gfx.c:

#include "src/gfx_mk.c"
(this is actually the whole content of that file!).

I probably just messed up some files or include directive in my previous attempt. The next step is to make the driver code more reusable, probably with another extra library. Then we'd have these libs:

The current state has the latter two merged, making it harder to reuse the driver code.

Discussions