using uGFX in arduino, with Teensy 3.1 example

Status
Not open for further replies.

christoph

Well-known member
I managed to turn uGFX into an arduino library (well, kinda). You need five things:

  1. ugfx in your arduino libraries folder
  2. ugfx-arduino, a wrapper library that adds the necessary ugfx sources
  3. a driver library for the display you want to use, e.g. ugfx-arduino-ssd1351
  4. project-ugfx-config, a configuration library that includes the first two, and configures ugfx for your sketch.
  5. your actual sketch
hackaday.io project: https://hackaday.io/project/8539-using-ugfx-in-arduino

github: https://github.com/crteensy/ugfx-arduino
The repo includes ugfx-arduino, a sample SSD1351 driver, and a sample sketch and config library.

More display drivers can be added as individual libraries, so give it a try! uGFX ships with a lot of driver examples for common displays, see https://bitbucket.org/Tectu/ugfx/src/ -> drivers -> gdisp. As uGFX also supports audio we might even be able to get the Teensy audio board to work with this.

This is highly experimental because it relies on arduino's library lookup mechanism to pick the correct driver and project-specific config library, but it seems to work. I've tried to confuse arduino in a quite a few ways and it didn't fail with the scheme outlined above.

Regards

Christoph
 
Sweet! Thank you Christoph! I will try to get to trying this out today and let you know how it goes!
 
If you use the same display as I did (SSD1351) you shouldn't run into a lot of problems. If you use a different display that's supported by uGFX I might be able to help turning their driver into a working library.
 
Some more bits and pieces:
  • Adding custom fonts works very well: you write a library and include it in your project configuration library. It can then be used just like all other fonts in ugfx. Creating a library makes it easy to share a ugfx-arduino font with others.
  • I've found a way of passing driver configuration information via structs. That's imho better than relying on arduino's library lookup mechanism when configuration is done via header files (as in #define SSD1351_PIN_RESET 14).
  • The ugfx crew say that their ILI9341 driver stub works well enough so this might be a good candidate for the next driver library. I also have that display in one of my boxes.
 
Still compiles fine with ugfx 2.6 and teensyduino 1.30 beta 2. I'll try it with hardware (T3.1, SSD1351) later, but I'm quite confident that it will work as expected.
 
Status
Not open for further replies.
Back
Top