summaryrefslogtreecommitdiff
path: root/nuttx/configs/stm32f4discovery/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-01 14:55:01 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-01 14:55:01 +0000
commitbe55907da3658170e9f7af751dfe42275c7e797b (patch)
tree01cfe5a9c6fc35d47074ad2bb3f6f5f7d96cff52 /nuttx/configs/stm32f4discovery/src
parentfea804e242196196b82b1309bb25b8b6a53e67cd (diff)
downloadpx4-nuttx-be55907da3658170e9f7af751dfe42275c7e797b.tar.gz
px4-nuttx-be55907da3658170e9f7af751dfe42275c7e797b.tar.bz2
px4-nuttx-be55907da3658170e9f7af751dfe42275c7e797b.zip
Updates from Darcy Gong for UG-2864SWEG01 OLED
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5469 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/stm32f4discovery/src')
-rw-r--r--nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h5
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_spi.c28
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c2
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c6
4 files changed, 26 insertions, 15 deletions
diff --git a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
index eae09594c..7027b639b 100644
--- a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
+++ b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
@@ -113,7 +113,7 @@
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5)
#endif
-/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display:
+/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display (SPI 4-wire):
*
* --------------------------+----------------------------------------------
* Connector CON10 J1: | STM32F4Discovery
@@ -123,7 +123,7 @@
* 1 3v3 | 3,4 3v3 | P2 3V
* 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection)
* 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection)
- * 7 A0 | 9 A0 | P2 PB8 (Arbitrary selection)
+ * 7 A0|D/C | 9 A0|D/C | P2 PB8 (Arbitrary selection)
* 9 LED+ (N/C) | ----- | -----
* 2 5V Vcc | 1,2 Vcc | P2 5V
* 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1))
@@ -142,6 +142,7 @@
GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7)
# define GPIO_OLED_A0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN8)
+# define GPIO_OLED_DC GPIO_OLED_A0
#endif
/****************************************************************************************************
diff --git a/nuttx/configs/stm32f4discovery/src/up_spi.c b/nuttx/configs/stm32f4discovery/src/up_spi.c
index 7ef3138fd..5b812d50c 100644
--- a/nuttx/configs/stm32f4discovery/src/up_spi.c
+++ b/nuttx/configs/stm32f4discovery/src/up_spi.c
@@ -96,11 +96,16 @@
void weak_function stm32_spiinitialize(void)
{
#ifdef CONFIG_STM32_SPI1
- (void)stm32_configgpio(GPIO_CS_MEMS);
+ (void)stm32_configgpio(GPIO_CS_MEMS); /* MEMS chip select */
#endif
-#ifdef CONFIG_LCD_UG2864AMBAG01
+#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
(void)stm32_configgpio(GPIO_OLED_CS); /* OLED chip select */
+# if defined(CONFIG_LCD_UG2864AMBAG01)
(void)stm32_configgpio(GPIO_OLED_A0); /* OLED Command/Data */
+# endif
+# if defined(CONFIG_LCD_UG2864HSWEG01)
+ (void)stm32_configgpio(GPIO_OLED_DC); /* OLED Command/Data */
+# endif
#endif
}
@@ -134,7 +139,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
{
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
-#ifdef CONFIG_LCD_UG2864AMBAG01
+#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
if (devid == SPIDEV_DISPLAY)
{
stm32_gpiowrite(GPIO_OLED_CS, !selected);
@@ -180,9 +185,9 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
* Name: stm32_spi1cmddata
*
* Description:
- * Set or clear the SD1329 D/Cn bit to select data (true) or command
- * (false). This function must be provided by platform-specific logic.
- * This is an implementation of the cmddata method of the SPI
+ * Set or clear the SH1101A A0 or SD1306 D/C n bit to select data (true)
+ * or command (false). This function must be provided by platform-specific
+ * logic. This is an implementation of the cmddata method of the SPI
* interface defined by struct spi_ops_s (see include/nuttx/spi.h).
*
* Input Parameters:
@@ -203,18 +208,23 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_STM32_SPI1
int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
{
-#ifdef CONFIG_LCD_UG2864AMBAG01
+#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
if (devid == SPIDEV_DISPLAY)
{
/* "This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*
- * A0 = “H”: the inputs at D0 to D7 are treated as display data.
- * A0 = “L”: the inputs at D0 to D7 are transferred to the command
+ * A0 = "H": the inputs at D0 to D7 are treated as display data.
+ * A0 = "L": the inputs at D0 to D7 are transferred to the command
* registers."
*/
+# if defined(CONFIG_LCD_UG2864AMBAG01)
(void)stm32_gpiowrite(GPIO_OLED_A0, !cmd);
+# endif
+# if defined(CONFIG_LCD_UG2864HSWEG01)
+ (void)stm32_gpiowrite(GPIO_OLED_DC, !cmd);
+# endif
return OK;
}
#endif
diff --git a/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c b/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c
index 2f2133116..42ad0c2a5 100644
--- a/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c
+++ b/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c
@@ -66,7 +66,7 @@
#endif
/* Pin Configuration ********************************************************/
-/* UG-2864AMBAG01 OLED Display:
+/* UG-2864AMBAG01 OLED Display (SPI 4-wire):
*
* --------------------------+----------------------------------------------
* Connector CON10 J1: | STM32F4Discovery
diff --git a/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c b/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c
index 4eee077a1..b6fe354d3 100644
--- a/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c
+++ b/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c
@@ -66,7 +66,7 @@
#endif
/* Pin Configuration ********************************************************/
-/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display:
+/* UG-2864HSWEG01 OLED Display (SPI 4-wire):
*
* --------------------------+----------------------------------------------
* Connector CON10 J1: | STM32F4Discovery
@@ -76,7 +76,7 @@
* 1 3v3 | 3,4 3v3 | P2 3V
* 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection)
* 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection)(2)
- * 7 A0 | 9 A0 | P2 PB8 (Arbitrary selection)(2)
+ * 7 D/C | 9 D/C | P2 PB8 (Arbitrary selection)(2)
* 9 LED+ (N/C) | ----- | -----
* 2 5V Vcc | 1,2 Vcc | P2 5V
* 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1))
@@ -85,7 +85,7 @@
* 10 GND | 20 GND | P2 GND
* --------------+-----------+----------------------------------------------
* (1) Required because of on-board MEMS
- * (2) Note that the OLED CS and A0 are managed in the up_spi.c file.
+ * (2) Note that the OLED CS and D/C are managed in the up_spi.c file.
* -------------------------------------------------------------------------
*/