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
How many times the menu structure should be scanned for changes and redrawn if needed. TcMenu tries to minimise redraws where reasonably possible.