- Edited
Hi! I've been working with @RafaeleAndrade to get this type of OLED display (SSD1306) working for our respective Bela projects; I got the example code working for the i2c-1 ports on our Bela Original and Bela Mini, by making these alterations:
in SSD1306_OLED.c: replace I2C_DEV_2 with I2C_DEV_1
in I2C.h:
add #define I2C_DEV1_PATH "/dev/i2c-1”
add extern int init_i2c_dev1(unsigned char slave_address);
in I2C.c:
add I2C_DeviceT I2C_DEV_1;
add a duplicate of the init_i2c_dev2 function, but altered to dev1
in Main.c:
replace I2C_DEV2 with I2C_DEV1
replace ic2_dev2 with i2c_dev1
replace i2c-2 with i2c-1
I've put these files up online here: https://github.com/crosswick/SSD1306-OLED-display-driver-for-BeagleBone
So part 1 of the instruction that @giuliomoro gave above works, the example code is running outside of the Bela environment. For inside the Bela environment, I stumbled upon the error no matching function for call to 'Bela_createAuxiliaryTask'
, which was fixable by changing
void* oledTaskFunction(void*)
to
void oledTaskFunction(void*)
Also I needed to add to render.cpp:
void render(BelaContext *context, void *userData)
{
}
void cleanup(BelaContext *context, void *userData)
{
}
After that, I get a Segmentation Fault:
Segmentation fault
bela: Makefile:524: recipe for target 'runide' failed
make: *** [runide] Error 139
So any help with that would be much appreciated; I presume we should take a good look at what this SSD1306_OLED code is doing in terms of memory allocation?
BTW, in terms of hardware: with the specific display module that we have available in our hackerspace, namely https://nl.aliexpress.com/item/32595065663.html, we had to not only change the resistors on the back side to change it from SPI to i2c mode; also the RES pin needs to be involved by adding a small RC circuit, found on the Axoloti forum here: http://community.axoloti.com/t/spi-i2c-oled-display/638/187