From 72bd7e9482f3d8d8c08eac7cf5d8f466eff46aac Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Mon, 26 Mar 2012 18:37:03 +0200 Subject: [PATCH] SSD1306 only uses I2C pins --- build/crossworks/LPC1343_CodeBase.hzs | 24 ++++------------------- drivers/displays/bitmap/ssd1306/ssd1306.c | 10 ---------- drivers/displays/bitmap/ssd1306/ssd1306.h | 18 ++++++++++++----- projectconfig.h | 2 -- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/build/crossworks/LPC1343_CodeBase.hzs b/build/crossworks/LPC1343_CodeBase.hzs index d903c47..d980ed8 100644 --- a/build/crossworks/LPC1343_CodeBase.hzs +++ b/build/crossworks/LPC1343_CodeBase.hzs @@ -24,14 +24,10 @@ - - - - @@ -51,10 +47,10 @@ - - - + + + @@ -67,19 +63,7 @@ - - - - - - - - - - - - - + diff --git a/drivers/displays/bitmap/ssd1306/ssd1306.c b/drivers/displays/bitmap/ssd1306/ssd1306.c index f7d55b0..f8e4ee4 100644 --- a/drivers/displays/bitmap/ssd1306/ssd1306.c +++ b/drivers/displays/bitmap/ssd1306/ssd1306.c @@ -351,16 +351,6 @@ void ssd1306Init(uint8_t vccstate) // I2C Initialisation #if defined SSD1306_BUS_I2C - // Set all pins to output - gpioSetDir(SSD1306_RST_PORT, SSD1306_RST_PORT, gpioDirection_Output); - - // Reset the LCD - gpioSetValue(SSD1306_RST_PORT, SSD1306_RST_PIN, 1); - DELAY(1); - gpioSetValue(SSD1306_RST_PORT, SSD1306_RST_PIN, 0); - DELAY(10); - gpioSetValue(SSD1306_RST_PORT, SSD1306_RST_PIN, 1); - #if defined SSD1306_128_32 // Init sequence taken from datasheet for UG-2832HSWEG04 (128x32 OLED module) ssd1306SendCommand(SSD1306_DISPLAYOFF); // 0xAE diff --git a/drivers/displays/bitmap/ssd1306/ssd1306.h b/drivers/displays/bitmap/ssd1306/ssd1306.h index 2f4abf1..1773050 100644 --- a/drivers/displays/bitmap/ssd1306/ssd1306.h +++ b/drivers/displays/bitmap/ssd1306/ssd1306.h @@ -109,16 +109,24 @@ #endif /*=========================================================================*/ + // Pin Definitions -#define SSD1306_DC_PORT (2) // Data/Command ... used for SA0 with I2C +// --------------- +// The following are only relevant for SPI mode! +// For I2C, connect Reset to the LPC1114 reset pin, and HW DC for 1 or 0 +// to set last I2C address but to 1 or 0. This means the OLED can not +// be reset in SW seperate from the MCU, but allows the OLED to be used +// with only the two I2C pins + +#define SSD1306_DC_PORT (2) // Data/Command ... also used as SA0 for I2C #define SSD1306_DC_PIN (1) -#define SSD1306_RST_PORT (2) // Reset (I2C + SPI) +#define SSD1306_RST_PORT (2) // Reset #define SSD1306_RST_PIN (2) -#define SSD1306_CS_PORT (2) // Select (SPI only) +#define SSD1306_CS_PORT (2) // Select #define SSD1306_CS_PIN (3) -#define SSD1306_SCLK_PORT (2) // Serial Clock (SPI only) +#define SSD1306_SCLK_PORT (2) // Serial Clock #define SSD1306_SCLK_PIN (5) -#define SSD1306_SDAT_PORT (2) // Serial Data (SPI only) +#define SSD1306_SDAT_PORT (2) // Serial Data #define SSD1306_SDAT_PIN (6) // Commands diff --git a/projectconfig.h b/projectconfig.h index 59abed5..ac0366d 100644 --- a/projectconfig.h +++ b/projectconfig.h @@ -153,7 +153,6 @@ ST7735 . . . . X X X X X X . . . . . . . SHARPMEM . . . . X X X X . . . . . . . . . SSD1306 SPI . . . . X X X . X X . . . . . . . - SSD1306 I2C . . . . . X . . . . . . . . . . . SSD1351 . . . . X X X X X . . . . . . . . MCP121 . . . . . . . . . . . . . . X . . PN532 [3] . . . . . . . . . . . . . . X X . @@ -173,7 +172,6 @@ ST7535 . . . . . . . . . . SHARPMEM . . . . . . . . . . SSD1306 SPI . . . . . . . . . . - SSD1306 I2C . . . . . . . . . . INTERFACE . . . . . . . . . X[2] [1] PMU uses 32-bit Timer 0 for SW wakeup from deep-sleep. This timer -- 2.20.1