aboutsummaryrefslogtreecommitdiffstats
path: root/boards/addons/gdisp
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2014-04-20 10:41:53 +0200
committerJoel Bodenmann <joel@unormal.org>2014-04-20 10:41:53 +0200
commitc88e25b84fa8d18942df56592cec68f8371a8d41 (patch)
tree0c13a89e07560b79ea0092a25f75b7cf630a903f /boards/addons/gdisp
parentad1d70d2957d95161c831e764c6f81c84c332458 (diff)
parent33babb4c1a5b749faac6969681e8deff481c4344 (diff)
downloaduGFX-c88e25b84fa8d18942df56592cec68f8371a8d41.tar.gz
uGFX-c88e25b84fa8d18942df56592cec68f8371a8d41.tar.bz2
uGFX-c88e25b84fa8d18942df56592cec68f8371a8d41.zip
Merge branch 'master' of https://bitbucket.org/Tectu/ugfx into gwin
Diffstat (limited to 'boards/addons/gdisp')
-rw-r--r--boards/addons/gdisp/board_ED060SC4_example.h6
-rw-r--r--boards/addons/gdisp/board_HX8347D_stm32f4discovery.h5
-rw-r--r--boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h7
-rw-r--r--boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h7
-rw-r--r--boards/addons/gdisp/board_ILI9341_spi.h222
-rw-r--r--boards/addons/gdisp/board_ILI9481_firebullstm32f103.h8
-rw-r--r--boards/addons/gdisp/board_S6D1121_olimex_e407.h7
-rw-r--r--boards/addons/gdisp/board_SSD1289_stm32f4discovery.h5
-rw-r--r--boards/addons/gdisp/board_SSD1306_i2c.h5
-rw-r--r--boards/addons/gdisp/board_SSD1306_spi.h5
-rw-r--r--boards/addons/gdisp/board_SSD1963_fsmc.h5
-rw-r--r--boards/addons/gdisp/board_SSD1963_gpio.h5
12 files changed, 270 insertions, 17 deletions
diff --git a/boards/addons/gdisp/board_ED060SC4_example.h b/boards/addons/gdisp/board_ED060SC4_example.h
index cb5a92b8..008e85d4 100644
--- a/boards/addons/gdisp/board_ED060SC4_example.h
+++ b/boards/addons/gdisp/board_ED060SC4_example.h
@@ -5,8 +5,10 @@
* http://ugfx.org/license.html
*/
-/* Board interface definitions for ED060SC4 PrimeView E-ink panel.
- *
+/**
+ * @file boards/addons/gdisp/board_ED060SC4_example.h
+ * @brief GDISP Graphic Driver subsystem board interface for the ED060SC4 display.
+ *
* This file corresponds to the connections shown in example_schematics.png,
* and is designed to interface with ChibiOS/RT.
*
diff --git a/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h b/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h
index f486841b..341f4366 100644
--- a/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h
+++ b/boards/addons/gdisp/board_HX8347D_stm32f4discovery.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h
+ * @file boards/addons/gdisp/board_HX8347D_stm32f4discovery.h
* @brief GDISP Graphic Driver subsystem board SPI interface for the HX8347D display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h b/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h
index 5315127b..0e399f1f 100644
--- a/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h
+++ b/boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h
- * @brief GDISP Graphic Driver subsystem board interface for the ILI9325 display.
+ * @file boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h
+ * @brief GDISP Graphic Driver subsystem board SPI interface for the ILI9325 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h b/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h
index 60508c1a..87c4530d 100644
--- a/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h
+++ b/boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h
@@ -19,8 +19,11 @@
/**
- * @file drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h
- * @brief GDISP Graphic Driver subsystem board interface for the ILI9325 display.
+ * @file boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h
+ * @brief GDISP Graphic Driver subsystem board SPI interface for the ILI9325 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_ILI9341_spi.h b/boards/addons/gdisp/board_ILI9341_spi.h
new file mode 100644
index 00000000..4b3b058d
--- /dev/null
+++ b/boards/addons/gdisp/board_ILI9341_spi.h
@@ -0,0 +1,222 @@
+/*
+ * 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 boards/addons/gdisp/board_ILI9341_spi.h
+ * @brief GDISP Graphic Driver subsystem board interface for the ILI9341 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
+ */
+
+#ifndef _GDISP_LLD_BOARD_H
+#define _GDISP_LLD_BOARD_H
+
+#define LCD_PORT GPIOB
+#define LCD_MOSI 15
+#define LCD_MISO 14
+#define LCD_SCK 13
+#define LCD_CS 12
+#define LCD_DC 11
+#define LCD_RES 10
+
+#define LCD_DC_CMD palClearPad(LCD_PORT, LCD_DC)
+#define LCD_DC_DATA palSetPad(LCD_PORT, LCD_DC)
+#define LCD_SCK_SET palSetPad(LCD_PORT, LCD_SCK)
+#define LCD_SCK_RES palClearPad(LCD_PORT, LCD_SCK)
+#define LCD_CS_RES palSetPad(LCD_PORT, LCD_CS)
+#define LCD_CS_SET palClearPad(LCD_PORT, LCD_CS)
+
+/**
+ * SPI configuration structure.
+ * Speed 12 MHz, CPHA=0, CPOL=0, 8bits frames, MSb transmitted first.
+ * Soft slave select.
+ */
+static const SPIConfig spi2cfg = {
+ NULL,
+ LCD_PORT,
+ LCD_CS,
+ (SPI_CR1_MSTR | SPI_CR1_SPE | SPI_CR1_SSM | SPI_CR1_SSI)
+};
+
+static void send_data(uint16_t data);
+
+/**
+ * @brief Initialise the board for the display.
+ *
+ * @param[in] g The GDisplay structure
+ *
+ * @note Set the g->board member to whatever is appropriate. For multiple
+ * displays this might be a pointer to the appropriate register set.
+ *
+ * @notapi
+ */
+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;
+
+ palSetPadMode(LCD_PORT, LCD_CS, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPadMode(LCD_PORT, LCD_DC, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPadMode(LCD_PORT, LCD_RES, PAL_MODE_OUTPUT_PUSHPULL);
+
+ spiStart(&SPID2, &spi2cfg);
+ spiSelectI(&SPID2);
+}
+
+/**
+ * @brief After the initialisation.
+ *
+ * @param[in] g The GDisplay structure
+ *
+ * @notapi
+ */
+static inline void post_init_board(GDisplay *g) {
+ (void) g;
+}
+
+/**
+ * @brief Set or clear the lcd reset pin.
+ *
+ * @param[in] g The GDisplay structure
+ * @param[in] state TRUE = lcd in reset, FALSE = normal operation
+ *
+ * @notapi
+ */
+static inline void setpin_reset(GDisplay *g, bool_t state) {
+ (void) g;
+
+ if (state == TRUE) {
+ palClearPad(LCD_PORT, LCD_RES);
+ } else {
+ palSetPad(LCD_PORT, LCD_RES);
+ }
+}
+
+/**
+ * @brief Set the lcd back-light level.
+ *
+ * @param[in] g The GDisplay structure
+ * @param[in] percent 0 to 100%
+ *
+ * @notapi
+ */
+static inline void set_backlight(GDisplay *g, uint8_t percent) {
+ (void) g;
+ (void) percent;
+}
+
+/**
+ * @brief Take exclusive control of the bus
+ *
+ * @param[in] g The GDisplay structure
+ *
+ * @notapi
+ */
+static inline void acquire_bus(GDisplay *g) {
+ (void) g;
+}
+
+/**
+ * @brief Release exclusive control of the bus
+ *
+ * @param[in] g The GDisplay structure
+ *
+ * @notapi
+ */
+static inline void release_bus(GDisplay *g) {
+ (void) g;
+}
+
+/**
+ * @brief Send data to the lcd.
+ *
+ * @param[in] data The data to send
+ *
+ * @notapi
+ */
+static inline void send_data(uint16_t data) {
+// http://forum.easyelectronics.ru/viewtopic.php?p=262122#p262122
+ while (!(SPI2->SR & SPI_SR_TXE)); // при входе на отправку проверяем - а пустой ли SPI_DR
+ SPI2->DR = data; // загрузили в SPI_DR код команды
+
+}
+
+/**
+ * @brief Send data to the index register.
+ *
+ * @param[in] g The GDisplay structure
+ * @param[in] index The index register to set
+ *
+ * @notapi
+ */
+static inline void write_index(GDisplay *g, uint16_t index) {
+ (void) g;
+
+ while (SPI2->SR & SPI_SR_BSY);
+ LCD_CS_RES;
+ LCD_DC_CMD; // переводим дисплей в режим команд
+ LCD_CS_SET;
+ send_data(index);
+ while (SPI2->SR & SPI_SR_BSY); // пока флаг установлен (==1) -- модуль SPI занят
+ /* лишний цикл ожидания окончания передачи команды позволяет в дальнейшем слать
+ * байты данных без ненужных ожиданий и задержек.
+ */
+ LCD_DC_DATA; // переводим дисплей в режим данных
+}
+
+/**
+ * @brief Send data to the lcd with DC control.
+ *
+ * @param[in] g The GDisplay structure
+ * @param[in] data The data to send
+ *
+ * @notapi
+ */
+static inline void write_data(GDisplay *g, uint16_t data) {
+ (void) g;
+
+ send_data(data);
+}
+
+/**
+ * @brief Set the bus in read mode
+ *
+ * @param[in] g The GDisplay structure
+ *
+ * @notapi
+ */
+static inline void setreadmode(GDisplay *g) {
+ (void) g;
+}
+
+/**
+ * @brief Set the bus back into write mode
+ *
+ * @param[in] g The GDisplay structure
+ *
+ * @notapi
+ */
+static inline void setwritemode(GDisplay *g) {
+ (void) g;
+}
+
+/**
+ * @brief Read data from the lcd.
+ * @return The data from the lcd
+ *
+ * @param[in] g The GDisplay structure
+ *
+ * @notapi
+ */
+static inline uint16_t read_data(GDisplay *g) {
+ (void) g;
+ return 0;
+}
+
+#endif /* _GDISP_LLD_BOARD_H */
+
diff --git a/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h b/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h
index 17bc554d..08cbaf3d 100644
--- a/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h
+++ b/boards/addons/gdisp/board_ILI9481_firebullstm32f103.h
@@ -6,9 +6,11 @@
*/
/**
- * @file drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h
- * @brief GDISP Graphics Driver subsystem low level driver source for
- * the ILI9481 and compatible HVGA display
+ * @file boards/addons/gdisp/board_ILI9481_firebullstm32f103.h
+ * @brief GDISP Graphics Driver subsystem low level driver source for the ILI9481 and compatible HVGA display
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_S6D1121_olimex_e407.h b/boards/addons/gdisp/board_S6D1121_olimex_e407.h
index e0bb8e26..1e2b53f7 100644
--- a/boards/addons/gdisp/board_S6D1121_olimex_e407.h
+++ b/boards/addons/gdisp/board_S6D1121_olimex_e407.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h
- * @brief GDISP Graphic Driver subsystem board interface for the S6D1121 display
+ * @file boards/addons/gdisp/board_S6D1121_olimex_e407.h
+ * @brief GDISP Graphic Driver subsystem board interface for the S6D1121 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h b/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h
index 1d86a67e..acbe16c0 100644
--- a/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h
+++ b/boards/addons/gdisp/board_SSD1289_stm32f4discovery.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h
+ * @file boards/addons/gdisp/board_SSD1289_stm32f4discovery.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1289 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_SSD1306_i2c.h b/boards/addons/gdisp/board_SSD1306_i2c.h
index 3f755f26..e147a918 100644
--- a/boards/addons/gdisp/board_SSD1306_i2c.h
+++ b/boards/addons/gdisp/board_SSD1306_i2c.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/SSD1306/board_SSD1306_i2c.h
+ * @file boards/addons/gdisp/board_SSD1306_i2c.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1306 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_SSD1306_spi.h b/boards/addons/gdisp/board_SSD1306_spi.h
index b476fec0..56e1abae 100644
--- a/boards/addons/gdisp/board_SSD1306_spi.h
+++ b/boards/addons/gdisp/board_SSD1306_spi.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/SSD1306/board_SSD1306_spi.h
+ * @file boards/addons/gdisp/board_SSD1306_spi.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1306 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_SSD1963_fsmc.h b/boards/addons/gdisp/board_SSD1963_fsmc.h
index 6c7119a4..55fabacc 100644
--- a/boards/addons/gdisp/board_SSD1963_fsmc.h
+++ b/boards/addons/gdisp/board_SSD1963_fsmc.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/SSD1963/board_SSD1963_fsmc.h
+ * @file boards/addons/gdisp/board_SSD1963_fsmc.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1963 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
diff --git a/boards/addons/gdisp/board_SSD1963_gpio.h b/boards/addons/gdisp/board_SSD1963_gpio.h
index 0b9c0135..cc7d1579 100644
--- a/boards/addons/gdisp/board_SSD1963_gpio.h
+++ b/boards/addons/gdisp/board_SSD1963_gpio.h
@@ -6,8 +6,11 @@
*/
/**
- * @file drivers/gdisp/SSD1963/board_SSD1963_gpio.h
+ * @file boards/addons/gdisp/board_SSD1963_gpio.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1963 display.
+ *
+ * @note This file contains a mix of hardware specific and operating system specific
+ * code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H