For I2C displays, the bus_type needs to be added:
+ .bus_type = SSD130x_BUS_I2C,
.address = DISPLAY_ADDR,
.bus_num = I2C0,
To use a SPI display:
1/ add the SSP include:
#include "drivers/ssp.h"
2/ add the SPI pins to the init table:
/* SPI : Display */
{ LPC_SSP0_SCLK_PIO_0_14, LPC_IO_DIGITAL },
{ LPC_SSP0_MISO_PIO_0_16, LPC_IO_DIGITAL },
{ LPC_SSP0_MOSI_PIO_0_17, LPC_IO_DIGITAL },
3/ update the oled_display conf:
.bus_type = SSD130x_BUS_SPI,
.bus_num = SSP_BUS_0,
.gpio_dc = LPC_GPIO_0_0,
.gpio_cs = LPC_GPIO_1_0,
.gpio_rst = LPC_GPIO_0_31,
4/ initialize the SPI bus:
ssp_master_on(SSP_BUS_0, LPC_SSP_FRAME_SPI, 8, 8*1000*1000);
#define DISPLAY_ADDR 0x78
static uint8_t gddram[ 4 + GDDRAM_SIZE ];
struct oled_display display = {
+ .bus_type = SSD130x_BUS_I2C,
.address = DISPLAY_ADDR,
.bus_num = I2C0,
.video_mode = SSD130x_DISP_NORMAL,