From 17bed746619f89209706194c216d7832450680e6 Mon Sep 17 00:00:00 2001 From: Cyprien Laplace Date: Sat, 24 Jun 2017 16:47:22 -0400 Subject: [PATCH] oled: add support for SPI ssd130x displays 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); --- beta/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/beta/main.c b/beta/main.c index 275824d..3619810 100644 --- a/beta/main.c +++ b/beta/main.c @@ -429,6 +429,7 @@ void temp_config(int uart_num) #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, -- 2.43.0