aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gdisp/SSD1306
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-10-28 20:04:03 +1000
committerinmarket <andrewh@inmarket.com.au>2013-10-28 20:04:03 +1000
commit555257933af6e7e3b106ac3589520b5dad45061b (patch)
treeb2c2cd148855bc20ebb476e62e0fa39ed1efbab0 /drivers/gdisp/SSD1306
parentdc2d5be60625dc03f0982d61a55dd3ccf844fff5 (diff)
downloaduGFX-555257933af6e7e3b106ac3589520b5dad45061b.tar.gz
uGFX-555257933af6e7e3b106ac3589520b5dad45061b.tar.bz2
uGFX-555257933af6e7e3b106ac3589520b5dad45061b.zip
Clean up the driver directory structure by moving all board specific files into the boards sub-structure.
Diffstat (limited to 'drivers/gdisp/SSD1306')
-rw-r--r--drivers/gdisp/SSD1306/board_SSD1306_i2c.h129
-rw-r--r--drivers/gdisp/SSD1306/board_SSD1306_spi.h132
2 files changed, 0 insertions, 261 deletions
diff --git a/drivers/gdisp/SSD1306/board_SSD1306_i2c.h b/drivers/gdisp/SSD1306/board_SSD1306_i2c.h
deleted file mode 100644
index 449d47ba..00000000
--- a/drivers/gdisp/SSD1306/board_SSD1306_i2c.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * This file is subject to the terms of the GFX License. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- * http://ugfx.org/license.html
- */
-
-/**
- * @file drivers/gdisp/SSD1306/board_SSD1306_i2c.h
- * @brief GDISP Graphic Driver subsystem board interface for the SSD1306 display.
- */
-
-#ifndef _GDISP_LLD_BOARD_H
-#define _GDISP_LLD_BOARD_H
-
-// The command byte to put on the front of each page line
-#define SSD1306_PAGE_PREFIX 0x40 // Co = 0, D/C = 1
-
-// For a multiple display configuration we would put all this in a structure and then
-// set g->board to that structure.
-#define SSD1306_RESET_PORT GPIOB
-#define SSD1306_RESET_PIN 5
-
-/**
- * The default slave address is 0x3D, (talking about
- * only the real address part here) and the slave
- * address can be changed to 0x3C by soldering the
- * SA0 pads on the bottom side of the module.
- *
- * b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0
- * --------------------------------------
- * 0 | 1 | 1 | 1 | 1 | 0 |SA0 | R/W
- */
-#define SSD1306_I2C_ADDRESS 0x3D
-#define SSD1306_SDA_PORT GPIOB
-#define SSD1306_SDA_PIN 7
-#define SSD1306_SCL_PORT GPIOB
-#define SSD1306_SCL_PIN 6
-#define SET_RST palSetPad(SSD1306_RESET_PORT, SSD1306_RESET_PIN);
-#define CLR_RST palClearPad(SSD1306_RESET_PORT, SSD1306_RESET_PIN);
-
-// I2C configuration structure.
-static I2CConfig i2cconfig;
-
-#if GFX_USE_OS_CHIBIOS
- static int32_t thdPriority = 0;
-#endif
-
-static inline void init_board(GDisplay *g) {
-
- // As we are not using multiple displays we set g->board to NULL as we don't use it.
- g->board = 0;
-
- switch(g->controllerdisplay) {
- case 0: // Set up for Display 0
- // RESET pin.
- palSetPadMode(SSD1306_RESET_PORT, SSD1306_RESET_PIN, PAL_MODE_OUTPUT_PUSHPULL);
-
-
- /*
- * Initializes the I2C driver 1. The I2C1 signals are routed as follows:
- * PB6 - SCL.
- * PB7 - SDA.
- * Timing value comes from ST I2C config tool (xls):
- * 0x00901D2B; // 100kHz Standard Mode
- * 0x00300444; // 100kHz Fast Mode
- * 0x0030020A; // 400kHz Fast Mode
- * 0x00100002; // 800kHz Fast Mode +
- */
- palSetPadMode(SSD1306_SCL_PORT, SSD1306_SCL_PIN, PAL_MODE_ALTERNATE(1));
- palSetPadMode(SSD1306_SDA_PORT, SSD1306_SDA_PIN, PAL_MODE_ALTERNATE(1));
- i2cconfig.timingr = 0x00100002; // 800kHz Fast Mode+
- i2cInit();
- break;
- }
-}
-
-static inline void post_init_board(GDisplay *g) {
- (void) g;
-}
-
-static inline void setpin_reset(GDisplay *g, bool_t state) {
- (void) g;
- if(state)
- CLR_RST
- else
- SET_RST
-}
-
-static inline void acquire_bus(GDisplay *g) {
- (void) g;
- #if GFX_USE_OS_CHIBIOS
- thdPriority = (int32_t)chThdGetPriority();
- chThdSetPriority(HIGHPRIO);
- #endif
- i2cAcquireBus(&I2CD1);
-}
-
-static inline void release_bus(GDisplay *g) {
- (void) g;
- #if GFX_USE_OS_CHIBIOS
- chThdSetPriority(thdPriority);
- #endif
- i2cReleaseBus(&I2CD1);
-}
-
-static inline void write_cmd(GDisplay *g, uint8_t cmd) {
- uint8_t command[2];
- (void) g;
-
- command[0] = 0x00; // Co = 0, D/C = 0
- command[1] = cmd;
-
- i2cStart(&I2CD1, &i2cconfig);
- i2cMasterTransmitTimeout(&I2CD1, SSD1306_I2C_ADDRESS, command, 2, NULL, 0, MS2ST(10));
- i2cStop(&I2CD1);
-}
-
-static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
- (void) g;
-
- i2cStart(&I2CD1, &i2cconfig);
- i2cMasterTransmitTimeout(&I2CD1, SSD1306_I2C_ADDRESS, data, length, NULL, 0, MS2ST(10));
- i2cStop(&I2CD1);
-}
-
-#endif /* _GDISP_LLD_BOARD_H */
-
-
diff --git a/drivers/gdisp/SSD1306/board_SSD1306_spi.h b/drivers/gdisp/SSD1306/board_SSD1306_spi.h
deleted file mode 100644
index 5b481630..00000000
--- a/drivers/gdisp/SSD1306/board_SSD1306_spi.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * This file is subject to the terms of the GFX License. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- * http://ugfx.org/license.html
- */
-
-/**
- * @file drivers/gdisp/SSD1306/board_SSD1306_spi.h
- * @brief GDISP Graphic Driver subsystem board interface for the SSD1306 display.
- */
-
-#ifndef _GDISP_LLD_BOARD_H
-#define _GDISP_LLD_BOARD_H
-
-// The command byte to put on the front of each page line
-#define SSD1306_PAGE_PREFIX 0x40 // Co = 0, D/C = 1
-
-// For a multiple display configuration we would put all this in a structure and then
-// set g->board to that structure.
-#define SSD1306_RESET_PORT GPIOB
-#define SSD1306_RESET_PIN 5
-#define SSD1306_MISO_PORT GPIOB
-#define SSD1306_MISO_PIN 8
-#define SSD1306_MOSI_PORT GPIOB
-#define SSD1306_MOSI_PIN 7
-#define SSD1306_SCK_PORT GPIOB
-#define SSD1306_SCK_PIN 6
-#define SSD1306_CS_PORT GPIOB
-#define SSD1306_CS_PIN 5
-#define SET_RST palSetPad(SSD1306_RESET_PORT, SSD1306_RESET_PIN);
-#define CLR_RST palClearPad(SSD1306_RESET_PORT, SSD1306_RESET_PIN);
-
-/*
- * SPI1 configuration structure.
- * Speed 42MHz, CPHA=0, CPOL=0, 8bits frames, MSb transmitted first.
- * The slave select line is the pin 4 on the port GPIOA.
- */
-static const SPIConfig spi1config = {
- NULL,
- /* HW dependent part.*/
- SSD1306_MISO_PORT,
- SSD1306_MISO_PIN,
- 0
- //SPI_CR1_BR_0
-};
-
-#if GFX_USE_OS_CHIBIOS
- static int32_t thdPriority = 0;
-#endif
-
-static inline void init_board(GDisplay *g) {
- unsigned i;
-
- // As we are not using multiple displays we set g->board to NULL as we don't use it.
- g->board = 0;
-
-
- switch(g->controllerdisplay) {
- case 0: // Set up for Display 0
- // RESET pin.
- palSetPadMode(SSD1306_RESET_PORT, SSD1306_RESET_PIN, PAL_MODE_OUTPUT_PUSHPULL);
-
- palSetPadMode(SSD1306_MISO_PORT, SSD1306_MISO_PIN, PAL_MODE_ALTERNATE(1)|
- PAL_STM32_OSPEED_HIGHEST);
- palSetPadMode(SSD1306_MOSI_PORT, SSD1306_MOSI_PIN, PAL_MODE_ALTERNATE(1)|
- PAL_STM32_OSPEED_HIGHEST);
- palSetPadMode(SSD1306_SCK_PORT, SSD1306_SCK_PIN, PAL_MODE_ALTERNATE(1)|
- PAL_STM32_OSPEED_HIGHEST);
- palSetPad(SSD1306_CS_PORT, SSD1306_CS_PIN);
- palSetPadMode(SSD1306_CS_PORT, SSD1306_CS_PIN, PAL_MODE_ALTERNATE(1)|
- PAL_STM32_OSPEED_HIGHEST);
- spiInit();
- break;
- }
-}
-
-static inline void post_init_board(GDisplay *g) {
- (void) g;
-}
-
-static inline void setpin_reset(GDisplay *g, bool_t state) {
- (void) g;
- if(state)
- CLR_RST
- else
- SET_RST
-}
-
-static inline void acquire_bus(GDisplay *g) {
- (void) g;
- #if GFX_USE_OS_CHIBIOS
- thdPriority = (int32_t)chThdGetPriority();
- chThdSetPriority(HIGHPRIO);
- #endif
- spiAcquireBus(&SPID1);
-}
-
-static inline void release_bus(GDisplay *g) {
- (void) g;
- #if GFX_USE_OS_CHIBIOS
- chThdSetPriority(thdPriority);
- #endif
- spiReleaseBus(&SPID1);
-}
-
-static inline void write_cmd(GDisplay *g, uint8_t cmd) {
- uint8_t command[2];
-
- command[0] = 0x00; // Co = 0, D/C = 0
- command[1] = cmd;
-
- spiStart(&SPID1, &spi1config);
- spiSelect(&SPID1);
- spiStartSend(&SPID1, 2, command);
- spiUnselect(&SPID1);
- spiStop(&SPID1);
-}
-
-static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
- (void) g;
-
- spiStart(&SPID1, &spi1config);
- spiSelect(&SPID1);
- spiStartSend(&SPID1, length, data);
- spiUnselect(&SPID1);
- spiStop(&SPID1);
-}
-
-
-#endif /* _GDISP_LLD_BOARD_H */
-