uGFX Port for Teensy 3 / ChibiOS available?

Status
Not open for further replies.
Hi Christoph,

Sorry it took me so long to try this out, I got caught up with things...

So I am running on OS X and now I am trying this out with the Arduino IDE.

I am getting the following error:

Code:
In file included from /Users/tenkai/Documents/Arduino/libraries/ugfx/src/gos/gos_mk.c:9:0,
from /Users/tenkai/Documents/Arduino/libraries/ugfx/src/gfx_mk.c:9,
from /Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/ugfx-arduino.c:1:
/Users/tenkai/Documents/Arduino/libraries/ugfx/src/gos/gos_chibios.c:33:3: error: #error "GOS: Unsupported version of ChibiOS"
#error "GOS: Unsupported version of ChibiOS"
^
exit status 1
Error compiling.

I edited gos_mk.c and commented out #include "gos_chibios.c", but then I get a whole host of other new errors.

Here is my tree output for my arduino library:

Code:
MacPro:libraries tenkai$ tree -d -L 1 | grep ugfx
├── example-ssd1351-ugfx-config
├── ugfx
├── ugfx-arduino
├── ugfx-arduino-gdisp-ssd1351

I am running on Arduino 1.6.6, and I just downloaded everything fresh, including Arduino 1.6.6, Teensyduino 1.26 beta 3 and your github repos for ugfx-arduino
 
Last edited:
Well I never used ChibiOS, so I can just guess what might be happening...

In the ugfx source, this error message is emitted if there is simply the wrong ChibiOS version available or when the defines simply don't exist: https://bitbucket.org/Tectu/ugfx/sr...fileviewer=file-view-default#gos_chibios.c-33

That you got this error indicates that you altered gfxconf.h to use ChibiOS instead of arduino, which should be fine. Which version of ChibiOS are you using? Maybe the ugfx guys can also be of help in the ugfx forum. I'm not sure where this problem originates so it's hard to tell which forum would be more suitable.

When you use ChibiOS, does it need to be configured for a specific target?

Regards

Christoph
 
I did not edit gfxconf.h. here are the contents of that file:

Code:
#ifndef _GFXCONF_H
#define _GFXCONF_H

/* The operating system to use. One of these must be defined - preferably in your Makefile */
//#define GFX_USE_OS_CHIBIOS	FALSE
//#define GFX_USE_OS_WIN32		FALSE
//#define GFX_USE_OS_LINUX		FALSE
//#define GFX_USE_OS_OSX		FALSE
#define GFX_USE_OS_ARDUINO      TRUE
//#define GFX_USE_OS_RAW32 TRUE

/* GFX sub-systems to turn on */
#define GFX_USE_GDISP			TRUE

/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION	TRUE
#define GDISP_NEED_CLIP			TRUE

#endif /* _GFXCONF_H */
 
uuuh...then I'm not sure why ugfx even includes the chibios-specific code. What happens if you comment out GFX_USE_OS_ARDUINO and enable GFX_USE_OS_CHIBIOS instead?

maybe I should get a copy of chibi myself but I'm typing one-handed with a little drooling kid in the other...
 
OK, I think ugfx defines these things elsewhere... check out

libraries/ugfx/src/gos/gos_options.h

It re-defines the GFX_USE_OS flags.. I set GFX_USE_OS_ARDUINO to TRUE here and now I get new errors:

Code:
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino: In function 'void setup()':
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:26:25: error: 'gdispGetWidth' was not declared in this scope
width = gdispGetWidth();
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:27:27: error: 'gdispGetHeight' was not declared in this scope
height = gdispGetHeight();
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:30:47: error: 'Yellow' was not declared in this scope
gdispDrawBox(10, 10, width / 2, height / 2, Yellow);
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:30:53: error: 'gdispDrawBox' was not declared in this scope
gdispDrawBox(10, 10, width / 2, height / 2, Yellow);
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:31:73: error: 'Blue' was not declared in this scope
gdispFillArea(width / 2, height / 2, width / 2 - 10, height / 2 - 10, Blue);
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:31:77: error: 'gdispFillArea' was not declared in this scope
gdispFillArea(width / 2, height / 2, width / 2 - 10, height / 2 - 10, Blue);
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:32:49: error: 'Red' was not declared in this scope
gdispDrawLine(5, 30, width - 50, height - 40, Red);
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:32:52: error: 'gdispDrawLine' was not declared in this scope
gdispDrawLine(5, 30, width - 50, height - 40, Red);
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:35:26: error: 'White' was not declared in this scope
gdispDrawPixel(i, j, White);
^
/Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/examples/example-ssd1351/example-ssd1351.ino:35:31: error: 'gdispDrawPixel' was not declared in this scope
gdispDrawPixel(i, j, White);
^
exit status 1
Error compiling.

A bit further now! not sure why these functions aren't declared, but I will dig a bit deeper.
 
Please don't change anything in libraries/ugfx! That will make things way harder to fix. The header you mentioned does not change things, it just makes sure that options that were not given are set to false explicitly. Change the OS defines in your config library instead (which you should create if you haven't done that yet)
 
Ah, well that must mean that my config library is not being included somehow. I will look into that.
 
OK, so I have a custom teensy config for ugfx, and I think all the files are in the right place. this is what my filesystem looks like:

Code:
MacPro:libraries tenkai$ tree -d -L 1 | grep ugfx
├── teensy-ssd1351-ugfx-config
├── ugfx
├── ugfx-arduino
├── ugfx-arduino-gdisp-ssd1351
MacPro:libraries tenkai$ ls -l teensy-ssd1351-ugfx-config/
total 24
-rwxr-xr-x@ 1 tenkai  staff  2197 Dec 11 15:37 gfxconf.h
-rwxr-xr-x@ 1 tenkai  staff    98 Nov 29 15:26 ssd1351_pins.cpp
-rwxr-xr-x@ 1 tenkai  staff   246 Dec 11 15:44 teensy-ssd1351-ugfx-config.h

I can't seem to find where the teensy-ssd1351-ugfx-config/gfxconf.h file gets included, though. I don't think it is being included anywhere, which is why it is defaulting to use ChibiOS
 
Last edited:
OK, I finally got it to get past the chibiOS error without modifying ugfx.

But now I get those same errors again:

Code:
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino: In function 'void setup()':
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:24:3: error: 'coord_t' was not declared in this scope
coord_t    width, height;
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:24:14: error: expected ';' before 'width'
coord_t    width, height;
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:25:13: error: expected ';' before 'i'
coord_t   i, j;
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:30:11: error: 'gfxInit' was not declared in this scope
gfxInit();
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:33:3: error: 'width' was not declared in this scope
width = gdispGetWidth();
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:33:25: error: 'gdispGetWidth' was not declared in this scope
width = gdispGetWidth();
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:34:3: error: 'height' was not declared in this scope
height = gdispGetHeight();
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:34:27: error: 'gdispGetHeight' was not declared in this scope
height = gdispGetHeight();
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:37:47: error: 'Yellow' was not declared in this scope
gdispDrawBox(10, 10, width / 2, height / 2, Yellow);
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:37:53: error: 'gdispDrawBox' was not declared in this scope
gdispDrawBox(10, 10, width / 2, height / 2, Yellow);
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:38:73: error: 'Blue' was not declared in this scope
gdispFillArea(width / 2, height / 2, width / 2 - 10, height / 2 - 10, Blue);
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:38:77: error: 'gdispFillArea' was not declared in this scope
gdispFillArea(width / 2, height / 2, width / 2 - 10, height / 2 - 10, Blue);
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:39:49: error: 'Red' was not declared in this scope
gdispDrawLine(5, 30, width - 50, height - 40, Red);
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:39:52: error: 'gdispDrawLine' was not declared in this scope
gdispDrawLine(5, 30, width - 50, height - 40, Red);
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:41:8: error: 'i' was not declared in this scope
for (i = 5, j = 0; i < width && j < height; i += 7, j += i / 20)
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:41:15: error: 'j' was not declared in this scope
for (i = 5, j = 0; i < width && j < height; i += 7, j += i / 20)
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:42:26: error: 'White' was not declared in this scope
gdispDrawPixel(i, j, White);
^
/Users/tenkai/Desktop/Projects/ssd1351_ugfx/ssd1351_ugfx.ino:42:31: error: 'gdispDrawPixel' was not declared in this scope
gdispDrawPixel(i, j, White);
^
 
It is basically the same one that you had as an example:

Code:
#include <SPI.h>

#include <ugfx-arduino-gdisp-ssd1351.h>
/* example ssd1351 project for ugfx-arduino
1) make sure you have copied the libraries from the repo:
- libraries/ugfx-arduino-gdisp-ssd1351
- libraries/example-ssd1351-ugfx-config
to arduino's libraries folder

2) connect your SSD1351 display to your arduino board
- SCK, MOSI are the standard SPI pins
- RESET, CS and DC as per libraries/example-ssd1351-ugfx-config/ssd1351_pins.cpp
  or adapt ssd1351_pins.cpp to suit your needs
*/

//#include "teensy-ssd1351-ugfx-config.h"



#define GFX_USE_GDISP     TRUE



void setup() {
  coord_t    width, height;
  coord_t   i, j;

  SPI.begin();

  // Initialize and clear the display
  gfxInit();

  // Get the screen size
  width = gdispGetWidth();
  height = gdispGetHeight();

  // Code Here
  gdispDrawBox(10, 10, width / 2, height / 2, Yellow);
  gdispFillArea(width / 2, height / 2, width / 2 - 10, height / 2 - 10, Blue);
  gdispDrawLine(5, 30, width - 50, height - 40, Red);

  for (i = 5, j = 0; i < width && j < height; i += 7, j += i / 20)
    gdispDrawPixel(i, j, White);

  SPI.end();
}

void loop() {
}

Same result if I change #define GFX_USE_GDISP to FALSE
 
Last edited:
Ok as I see it the main sketch includes the config library. That in turn should include gfx.h, so those types should be available because they're just os- and display dependent typedef. I'll try to take a closer look at that
 
Cool, thanks dude! Your help is super awesome and helpful :D I am going home for the night. Thank you so much!!
 
Ok, I have reworked some of my includes in the config files and now I am getting a new error:

Code:
In file included from /Users/tenkai/Documents/Arduino/libraries/ugfx/src/gos/gos.h:476:0,
from /Users/tenkai/Documents/Arduino/libraries/ugfx/gfx.h:443,
from /Users/tenkai/Documents/Arduino/libraries/ugfx/src/gfx.c:16,
from /Users/tenkai/Documents/Arduino/libraries/ugfx/src/gfx_mk.c:8,
from /Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/ugfx-arduino.c:1:
/Users/tenkai/Documents/Arduino/libraries/ugfx/src/gos/gos_arduino.h:34:1: error: unknown type name 'bool'
typedef bool bool_t;
^
In file included from /Users/tenkai/Documents/Arduino/libraries/ugfx/src/gos/gos_mk.c:8:0,
from /Users/tenkai/Documents/Arduino/libraries/ugfx/src/gfx_mk.c:9,
from /Users/tenkai/Documents/Arduino/libraries/ugfx-arduino/ugfx-arduino.c:1:
/Users/tenkai/Documents/Arduino/libraries/ugfx/src/gos/gos_arduino.c: In function '_gosInit':
/Users/tenkai/Documents/Arduino/libraries/ugfx/src/gos/gos_arduino.c:28:4: warning: #warning "GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!" [-Wcpp]
#warning "GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
^

more breadcrumbs!

That second error is not consistent. It will appear sometimes during compilation, and then I recompile without changing anything and it will disappear, and then reappear again at some point... not sure whats going on here.
 
The first error should not appear any more, as I have already suggested a fix to the ugfx crew some time ago. When was the last time you puled changes from the repo? The commit fixing this bool typedef error is here: https://bitbucket.org/Tectu/ugfx/commits/24ba58e612c770e052fa82a6cc290dc427df7820

The second one is actually just a warning, and it makes sense. When there is an OS, ugfx code "knows" how to init the OS or can determine if the OS is initialized properly. Arduino is not an OS, and ugfx just reminds you of the fact that you (or the arduino core devs like Paul for teensyduino) have to initialize all the hardware correctly. Once the source that emits this warning has been compiled, the arduino IDE will reuse the resulting object code, so you don't get the warning again.

I also get that warning regularly when compiling ugfx.
 
It works!

I was using the latest from the µGFX website: version 2.4
Which I can confirm does not have that bug fixed.

This might be the only suggestion I have to change in your github instructions, as you mention it works with version 2.4. I just pulled the latest github repo and it works like a charm!

Thank you so much for your help! time to experiment :D
 
Ah well you're absolutely right about that, I'm recommending a release that doesn't quite work.

There's one question still open, which might or might not be relevant to you: is ugfx using chibios now? If I understood you correctly, you're configuring it for arduino.
 
No, my implementation is not using ChibiOS. I may attempt to try that later, but for now I am going to explore a bit of what uGFX has to offer.
 
One note for folks who are using the 128x96 pixel version of the SSD1351 is that they will need to change two lines in ugfx-arduino-gdisp-ssd1351/gdisp_lld_SSD1351.c:

change line 32
Code:
	#define GDISP_SCREEN_HEIGHT		128
to
Code:
	#define GDISP_SCREEN_HEIGHT		96

change line 78
Code:
	write_reg(g, SSD1351_SET_MUX_RATIO, 128); // set MUX ratio
to
Code:
	write_reg(g, SSD1351_SET_MUX_RATIO, 95); // set MUX ratio

otherwise the pixel mapping will be incorrect.
 
Hey guys!

First of all: We got a new website! --> http://ugfx.org

Secondly: We will release a maintenance release (v2.5) in a couple of days. The issue with the definition of bool will be included into the latest release that way.

Tectu, what is stopping you from getting Teensys to try this out? Are you waiting for someone to send you one? I have a spare 3.1 I might be able to send your way if that would get official support rolling...
It's not really a money issue. It's just that we have a lot of things on our ToDo list and as soon as I have something sitting on my table I feel obligated that I need to get it done ASAP. So as long as we didn't receive a couple of Teensys I don't feel bad for a couple of days before I get to it ;)
Anyway, we are of course interested into providing official support for Teensy. We are currently working on individual guides that show how to get started with any platform/IDE so writing a same guide for the Teensy would definitely make sense. I'll try to get in touch with the Teensy people (as in developers). Maybe they can spare a few.

@christoph: Would you like to write a short guide on the uGFX wiki that explains how to get uGFX working on a Teensy in the meantime? I guess there would be quite a few people that would appreciate that (including us).


~ Tectu
 
Status
Not open for further replies.
Back
Top