This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 771bd8ca17ef8eed32309af32eb101aab6b04893
Author: SPRESENSE <[email protected]>
AuthorDate: Mon Apr 11 20:10:54 2022 +0900

    board/spresense: Add pin selection of ILI934x
    
    Add Kconfig choice for selecting RST and DC pins on ILI934x LCD.
---
 boards/arm/cxd56xx/spresense/Kconfig               | 183 +++++++++++++++++++++
 boards/arm/cxd56xx/spresense/include/board.h       |  11 +-
 .../arm/cxd56xx/spresense/include/board_lcdpins.h  | 146 ++++++++++++++++
 3 files changed, 334 insertions(+), 6 deletions(-)

diff --git a/boards/arm/cxd56xx/spresense/Kconfig 
b/boards/arm/cxd56xx/spresense/Kconfig
index 57323d459e..872b400409 100644
--- a/boards/arm/cxd56xx/spresense/Kconfig
+++ b/boards/arm/cxd56xx/spresense/Kconfig
@@ -514,6 +514,189 @@ config LCD_ON_MAIN_BOARD
                Display connected to main board.
 
 endchoice
+
+if LCD_ON_MAIN_BOARD
+
+choice
+       prompt "LCD ILI934x RST Pin selection"
+       default LCD_RSTPIN_I2S0_BCK
+
+config LCD_RSTPIN_UART2_TX
+       bool "UART2_TX (D01) PIN"
+
+config LCD_RSTPIN_UART2_RX
+       bool "UART2_RX (D00) PIN"
+
+config LCD_RSTPIN_UART2_RTS
+       bool "UART2_RTS (D28) PIN"
+
+config LCD_RSTPIN_UART2_CTS
+       bool "UART2_CTS (D27) PIN"
+
+config LCD_RSTPIN_I2S0_BCK
+       bool "I2S0_BCK (D26) PIN"
+
+config LCD_RSTPIN_I2S0_LRCK
+       bool "I2S0_LRCK (D25) PIN"
+
+config LCD_RSTPIN_SEN_IRQ_IN
+       bool "SEN_IRQ_IN (D22) PIN"
+
+config LCD_RSTPIN_EMMC_DATA3
+       bool "EMMC_DATA3 (D21) PIN"
+
+config LCD_RSTPIN_EMMC_DATA2
+       bool "EMMC_DATA2 (D20) PIN"
+
+config LCD_RSTPIN_I2S0_DATA_IN
+       bool "I2S0_DATA_IN (D19) PIN"
+
+config LCD_RSTPIN_I2S0_DATA_OUT
+       bool "I2S0_DATA_OUT (D18) PIN"
+
+config LCD_RSTPIN_I2C0_SCL
+       bool "I2C0_SCL (D15) PIN"
+
+config LCD_RSTPIN_I2C0_SDA
+       bool "I2C0_SDA (D14) PIN"
+
+endchoice
+
+choice
+       prompt "LCD ILI934x DC Pin selection"
+       default LCD_DCPIN_I2S0_LRCK
+
+config LCD_DCPIN_UART2_TX
+       bool "UART2_TX (D01) PIN"
+
+config LCD_DCPIN_UART2_RX
+       bool "UART2_RX (D00) PIN"
+
+config LCD_DCPIN_UART2_RTS
+       bool "UART2_RTS (D28) PIN"
+
+config LCD_DCPIN_UART2_CTS
+       bool "UART2_CTS (D27) PIN"
+
+config LCD_DCPIN_I2S0_BCK
+       bool "I2S0_BCK (D26) PIN"
+
+config LCD_DCPIN_I2S0_LRCK
+       bool "I2S0_LRCK (D25) PIN"
+
+config LCD_DCPIN_SEN_IRQ_IN
+       bool "SEN_IRQ_IN (D22) PIN"
+
+config LCD_DCPIN_EMMC_DATA3
+       bool "EMMC_DATA3 (D21) PIN"
+
+config LCD_DCPIN_EMMC_DATA2
+       bool "EMMC_DATA2 (D20) PIN"
+
+config LCD_DCPIN_I2S0_DATA_IN
+       bool "I2S0_DATA_IN (D19) PIN"
+
+config LCD_DCPIN_I2S0_DATA_OUT
+       bool "I2S0_DATA_OUT (D18) PIN"
+
+config LCD_DCPIN_I2C0_SCL
+       bool "I2C0_SCL (D15) PIN"
+
+config LCD_DCPIN_I2C0_SDA
+       bool "I2C0_SDA (D14) PIN"
+
+endchoice
+
+endif
+
+if LCD_ON_EXTENSION_BOARD
+
+choice
+       prompt "LCD ILI934x RST Pin selection"
+       default LCD_RSTPIN_SPI2_MISO
+
+config LCD_RSTPIN_I2C0_SCL_E
+       bool "I2C0_SCL (D15) PIN"
+
+config LCD_RSTPIN_I2C0_SDA_E
+       bool "I2C0_SDA (D14) PIN"
+
+config LCD_RSTPIN_PWM2
+       bool "PWM2 (D09) PIN"
+
+config LCD_RSTPIN_SPI2_MISO
+       bool "SPI2_MISO (D08) PIN"
+
+config LCD_RSTPIN_SPI3_CS1_X
+       bool "SPI3_CS1_X (D07) PIN"
+
+config LCD_RSTPIN_PWM0
+       bool "PWM0 (D06) PIN"
+
+config LCD_RSTPIN_PWM1
+       bool "PWM1 (D05) PIN"
+
+config LCD_RSTPIN_SPI2_MOSI
+       bool "SPI2_MOSI (D04) PIN"
+
+config LCD_RSTPIN_PWM3
+       bool "PWM3 (D03) PIN"
+
+config LCD_RSTPIN_HIF_IRQ_OUT
+       bool "HIF_IRQ_OUT (D02) PIN"
+
+config LCD_RSTPIN_UART2_TX_E
+       bool "UART2_TX (D01) PIN"
+
+config LCD_RSTPIN_UART2_RX_E
+       bool "UART2_RX (D00) PIN"
+
+endchoice
+
+choice
+       prompt "LCD ILI934x DC Pin selection"
+       default LCD_DCPIN_PWM2
+
+config LCD_DCPIN_I2C0_SCL_E
+       bool "I2C0_SCL (D15) PIN"
+
+config LCD_DCPIN_I2C0_SDA_E
+       bool "I2C0_SDA (D14) PIN"
+
+config LCD_DCPIN_PWM2
+       bool "PWM2 (D09) PIN"
+
+config LCD_DCPIN_SPI2_MISO
+       bool "SPI2_MISO (D08) PIN"
+
+config LCD_DCPIN_SPI3_CS1_X
+       bool "SPI3_CS1_X (D07) PIN"
+
+config LCD_DCPIN_PWM0
+       bool "PWM0 (D06) PIN"
+
+config LCD_DCPIN_PWM1
+       bool "PWM1 (D05) PIN"
+
+config LCD_DCPIN_SPI2_MOSI
+       bool "SPI2_MOSI (D04) PIN"
+
+config LCD_DCPIN_PWM3
+       bool "PWM3 (D03) PIN"
+
+config LCD_DCPIN_HIF_IRQ_OUT
+       bool "HIF_IRQ_OUT (D02) PIN"
+
+config LCD_DCPIN_UART2_TX_E
+       bool "UART2_TX (D01) PIN"
+
+config LCD_DCPIN_UART2_RX_E
+       bool "UART2_RX (D00) PIN"
+
+endchoice
+
+endif
+
 endif
 
 choice
diff --git a/boards/arm/cxd56xx/spresense/include/board.h 
b/boards/arm/cxd56xx/spresense/include/board.h
index 029ac60671..20cce16a99 100644
--- a/boards/arm/cxd56xx/spresense/include/board.h
+++ b/boards/arm/cxd56xx/spresense/include/board.h
@@ -30,6 +30,8 @@
 #include <sys/boardctl.h>
 #include <stdbool.h>
 
+#include "board_lcdpins.h"
+
 #include "cxd56_clock.h"
 #include "cxd56_power.h"
 #include "cxd56_flash.h"
@@ -212,9 +214,6 @@ enum board_power_device
 
 #if defined(CONFIG_LCD_ON_MAIN_BOARD) /* Display connected to main board. */
 
-#define DISPLAY_RST     PIN_I2S0_BCK
-#define DISPLAY_DC      PIN_I2S0_LRCK
-
 #define DISPLAY_SPI     5
 
 #define DISPLAY_DMA_TXCH       (4)
@@ -226,9 +225,6 @@ enum board_power_device
 
 #else /* Display is connected through extension board. */
 
-#define DISPLAY_RST     PIN_SPI2_MISO
-#define DISPLAY_DC      PIN_PWM2
-
 #define DISPLAY_SPI     4
 
 #define DISPLAY_DMA_TXCH       (2)
@@ -240,6 +236,9 @@ enum board_power_device
 
 #endif
 
+#define DISPLAY_RST     ILI934X_RST_PIN
+#define DISPLAY_DC      ILI934X_DC_PIN
+
 /* Sensor device bus definitions ********************************************/
 
 #define SENSOR_I2C      0
diff --git a/boards/arm/cxd56xx/spresense/include/board_lcdpins.h 
b/boards/arm/cxd56xx/spresense/include/board_lcdpins.h
new file mode 100644
index 0000000000..f17d394fe2
--- /dev/null
+++ b/boards/arm/cxd56xx/spresense/include/board_lcdpins.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+ * boards/arm/cxd56xx/spresense/include/board_lcdpins.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_BOARD_LCDPINS_H
+#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_BOARD_LCDPINS_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* ILI934X RST pin definition */
+
+#if defined(CONFIG_LCD_RSTPIN_UART2_TX) \
+    || defined(CONFIG_LCD_RSTPIN_UART2_TX_E)
+# define ILI934X_RST_PIN PIN_UART2_TXD
+#elif defined(CONFIG_LCD_RSTPIN_UART2_RX) \
+    || defined(CONFIG_LCD_RSTPIN_UART2_RX_E)
+# define ILI934X_RST_PIN PIN_UART2_RXD
+#elif defined(CONFIG_LCD_RSTPIN_UART2_RTS)
+# define ILI934X_RST_PIN PIN_UART2_RTS
+#elif defined(CONFIG_LCD_RSTPIN_UART2_CTS)
+# define ILI934X_RST_PIN PIN_UART2_CTS
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_BCK)
+# define ILI934X_RST_PIN PIN_I2S0_BCK
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_LRCK)
+# define ILI934X_RST_PIN PIN_I2S0_LRCK
+#elif defined(CONFIG_LCD_RSTPIN_SEN_IRQ_IN)
+# define ILI934X_RST_PIN PIN_SEN_IRQ_IN
+#elif defined(CONFIG_LCD_RSTPIN_EMMC_DATA3)
+# define ILI934X_RST_PIN PIN_EMMC_DATA3
+#elif defined(CONFIG_LCD_RSTPIN_EMMC_DATA2)
+# define ILI934X_RST_PIN PIN_EMMC_DATA2
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_DATA_IN)
+# define ILI934X_RST_PIN PIN_I2S0_DATA_IN
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_DATA_OUT)
+# define ILI934X_RST_PIN PIN_I2S0_DATA_OUT
+#elif defined(CONFIG_LCD_RSTPIN_I2C0_SCL) \
+    || defined(CONFIG_LCD_RSTPIN_I2C0_SCL_E)
+# define ILI934X_RST_PIN PIN_I2C0_BCK
+#elif defined(CONFIG_LCD_RSTPIN_I2C0_SDA) \
+    || defined(CONFIG_LCD_RSTPIN_I2C0_SDA_E)
+# define ILI934X_RST_PIN PIN_I2C0_BDT
+#elif defined(CONFIG_LCD_RSTPIN_PWM2)
+# define ILI934X_RST_PIN PIN_PWM2
+#elif defined(CONFIG_LCD_RSTPIN_SPI2_MISO)
+# define ILI934X_RST_PIN PIN_SPI2_MISO
+#elif defined(CONFIG_LCD_RSTPIN_SPI3_CS1_X)
+# define ILI934X_RST_PIN PIN_SPI3_CS1_X
+#elif defined(CONFIG_LCD_RSTPIN_PWM0)
+# define ILI934X_RST_PIN PIN_PWM0
+#elif defined(CONFIG_LCD_RSTPIN_PWM1)
+# define ILI934X_RST_PIN PIN_PWM1
+#elif defined(CONFIG_LCD_RSTPIN_SPI2_MOSI)
+# define ILI934X_RST_PIN PIN_SPI2_MOSI
+#elif defined(CONFIG_LCD_RSTPIN_PWM3)
+# define ILI934X_RST_PIN PIN_PWM3
+#elif defined(CONFIG_LCD_RSTPIN_HIF_IRQ_OUT)
+# define ILI934X_RST_PIN PIN_HIF_IRQ_OUT
+#endif
+
+/* ILI934X DC pin definition */
+
+#if defined(CONFIG_LCD_DCPIN_UART2_TX) \
+    || defined(CONFIG_LCD_DCPIN_UART2_TX_E)
+# define ILI934X_DC_PIN PIN_UART2_TXD
+#elif defined(CONFIG_LCD_DCPIN_UART2_RX) \
+    || defined(CONFIG_LCD_DCPIN_UART2_RX_E)
+# define ILI934X_DC_PIN PIN_UART2_RXD
+#elif defined(CONFIG_LCD_DCPIN_UART2_RTS)
+# define ILI934X_DC_PIN PIN_UART2_RTS
+#elif defined(CONFIG_LCD_DCPIN_UART2_CTS)
+# define ILI934X_DC_PIN PIN_UART2_CTS
+#elif defined(CONFIG_LCD_DCPIN_I2S0_BCK)
+# define ILI934X_DC_PIN PIN_I2S0_BCK
+#elif defined(CONFIG_LCD_DCPIN_I2S0_LRCK)
+# define ILI934X_DC_PIN PIN_I2S0_LRCK
+#elif defined(CONFIG_LCD_DCPIN_SEN_IRQ_IN)
+# define ILI934X_DC_PIN PIN_SEN_IRQ_IN
+#elif defined(CONFIG_LCD_DCPIN_EMMC_DATA3)
+# define ILI934X_DC_PIN PIN_EMMC_DATA3
+#elif defined(CONFIG_LCD_DCPIN_EMMC_DATA2)
+# define ILI934X_DC_PIN PIN_EMMC_DATA2
+#elif defined(CONFIG_LCD_DCPIN_I2S0_DATA_IN)
+# define ILI934X_DC_PIN PIN_I2S0_DATA_IN
+#elif defined(CONFIG_LCD_DCPIN_I2S0_DATA_OUT)
+# define ILI934X_DC_PIN PIN_I2S0_DATA_OUT
+#elif defined(CONFIG_LCD_DCPIN_I2C0_SCL) \
+    || defined(CONFIG_LCD_DCPIN_I2C0_SCL_E)
+# define ILI934X_DC_PIN PIN_I2C0_BCK
+#elif defined(CONFIG_LCD_DCPIN_I2C0_SDA) \
+    || defined(CONFIG_LCD_DCPIN_I2C0_SDA_E)
+# define ILI934X_DC_PIN PIN_I2C0_BDT
+#elif defined(CONFIG_LCD_DCPIN_PWM2)
+# define ILI934X_DC_PIN PIN_PWM2
+#elif defined(CONFIG_LCD_DCPIN_SPI2_MISO)
+# define ILI934X_DC_PIN PIN_SPI2_MISO
+#elif defined(CONFIG_LCD_DCPIN_SPI3_CS1_X)
+# define ILI934X_DC_PIN PIN_SPI3_CS1_X
+#elif defined(CONFIG_LCD_DCPIN_PWM0)
+# define ILI934X_DC_PIN PIN_PWM0
+#elif defined(CONFIG_LCD_DCPIN_PWM1)
+# define ILI934X_DC_PIN PIN_PWM1
+#elif defined(CONFIG_LCD_DCPIN_SPI2_MOSI)
+# define ILI934X_DC_PIN PIN_SPI2_MOSI
+#elif defined(CONFIG_LCD_DCPIN_PWM3)
+# define ILI934X_DC_PIN PIN_PWM3
+#elif defined(CONFIG_LCD_DCPIN_HIF_IRQ_OUT)
+# define ILI934X_DC_PIN PIN_HIF_IRQ_OUT
+#endif
+
+#if !defined(CONFIG_LCD)
+
+# if !defined(ILI934X_RST_PIN)
+#  define ILI934X_RST_PIN 0
+# endif
+
+# if !defined(ILI934X_DC_PIN)
+#  define ILI934X_DC_PIN 0
+# endif
+
+#endif
+
+#endif  /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_BOARD_LCDPINS_H */

Reply via email to