Mxgui OLED example
Before you begin
This tutorial is mainly focused at showing
- How to add Mxgui to your project
- How to drive a small OLED display that can be easily found on ebay with Mxgui
This tutorial assumes that you have read the Miosix and git workflow and that you have already downloaded and configured the kernel. The code of this example can be found in the mxgui library itself https://github.com/fedetft/mxgui/tree/master/_examples/display_ly091wg14
Configuration
In the Miosix top-level directory (or in the directory of your project if you are using an out of git tree project download the mxgui library. If you are under a git repository
git submodule add https://github.com/fedetft/mxgui.git
or if your project directory is not under git
git clone https://github.com/fedetft/mxgui.git
If you are using an out of git tree project setup is is recomended to copy the mxgui/config/mxgui_settings.h file in your project config directory as you'll need to edit it.
cp mxgui/config/mxgui_settings.h config
Now edit your makefile to add the following:
Add the mxgui directory to SUBDIRS so when you run make, the graphics library will be compiled
SUBDIRS := $(KPATH) mxgui
Add libmxgui.a to LIBS so the the graphics library will be linked
LIBS := mxgui/libmxgui.a
Add both the mxgui directory and the directory one level upper to INCLUDE_DIRS so includes will work
INCLUDE_DIRS := -I. -Imxgui
Now, edit mxgui_settings.h as follows, commenting out these two lines. The second line serves to disable the input module of the library, as in this example we don't have a touchscreen driver.
#error This error is a reminder that you have not edited mxgui_settings.h yet.
#define MXGUI_LEVEL_2
Replace your main with the example code and edit it as needed to match the pins to the ones of the display
cp mxgui/_examples/display_ly091wg14/main.cpp .
Build the example with make, and flash it with make program.