In this guide we show how to use the Adafruit_GFX library for mbed RTOS to renderer menu items with tcMenu. This rendering driver for Adafruit_GFX is built into the core menu designer download, meaning it’s available out of the box when MBED_RTOS is selected.
We maintain a fork of Adafruit_GFX library for mbed that currently supports OLED displays only. Therefore, at the moment all options are memory buffered.
Before proceeding, you’ll need to make sure you’ve installed the Adafruit_GFX for mbed library and the library; which also contains the OLED drivers. I’d recommend taking a read through the Adafruit_GFX library documentation if you’re not familiar with the library already. We’ll also assume you’ve got a menu structure already prepared in the menu designer UI.
First, ensure your menu structure is saved and then choose Code -> Generate Code from the menu. Once the code generation dialog appears, change the current display by either pressing on the image (or on older UIs a button named “Change”). From this menu select the Adafruit mbed driver.
Once you’ve chosen this display type, the following properties will be added to the table at the bottom:
This is variable name that the designer should generate on your behalf, it will export the variable ready for use.
We support either SSD_1306 and SH_1106 OLED displays at the moment.
This is the native display width and height.
This is the serial bus type that your display is on either I2C or SPI.
The variable you’ve created that represents the serial bus. EG an I2C or SPI reference.
Optionally, the reset pin for the device
Optionally the RS and CS pins when using SPI
The rotation of the display between 0 and 3, 0 for regular
When using this driver, you may well need to change the drawing settings such as font, spacing and colors to suit your display. For Adafruit_GFX this is the configuration type, if you leave the config field blank, the generator will provide a default with name
It is probable that you’ll either want to completely override, or make some small adjustments to the graphics configuration. See the graphical configuration section in this rendering guide.
When you don’t choose a graphics configuration by leaving the property blank, the code generator will use a default one on your behalf, by adding it to your