fdcavalcanti commented on code in PR #18730:
URL: https://github.com/apache/nuttx/pull/18730#discussion_r3079226207


##########
boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_board_lcd_gc9a01.c:
##########
@@ -0,0 +1,147 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/common/src/esp32s3_gc9a01.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+#include <arch/board/board.h>
+#include <debug.h>
+#include <errno.h>
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <nuttx/config.h>
+#include <nuttx/spi/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/gc9a01.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <syslog.h>
+
+#include "espressif/esp_gpio.h"
+#include "esp32s3_spi.h"
+#include "esp32s3-ws-lcd128.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct spi_dev_s *g_spidev;
+static struct lcd_dev_s *g_lcd = NULL;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  board_lcd_initialize
+ *
+ * Description:
+ *   Initialize the LCD video hardware.  The initial state of the LCD is
+ *   fully initialized, display memory cleared, and the LCD ready to use, but
+ *   with the power setting at 0 (full off).
+ *
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+
+  syslog(LOG_INFO, "Initializing LCD GPIO pins.");
+
+  /* SPI RX is not used. Same pin is used as LCD Data/Command control */
+
+  esp_configgpio(DISPLAY_DC, OUTPUT);
+  esp_gpiowrite(DISPLAY_DC, true);
+
+  /* Pull LCD_RESET high */
+
+  esp_configgpio(DISPLAY_RST, OUTPUT);
+  esp_gpiowrite(DISPLAY_RST, false);
+  up_mdelay(50);
+  esp_gpiowrite(DISPLAY_RST, true);
+  up_mdelay(50);
+
+  /* Set full brightness */
+
+  esp_configgpio(DISPLAY_BCKL, OUTPUT);
+  esp_gpiowrite(DISPLAY_BCKL, true);
+
+  syslog(LOG_INFO, "Initializing LCD SPI port.");
+
+  lcdinfo("Initializing SPI port %d\n", DISPLAY_SPI);
+
+  g_spidev = esp32s3_spibus_initialize(DISPLAY_SPI);
+  if (!g_spidev)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n", DISPLAY_SPI);
+      return -ENODEV;
+    }
+
+  lcdinfo("Initialized SPI port %d\n", DISPLAY_SPI);
+
+  g_lcd = gc9a01_lcdinitialize(g_spidev);
+  if (!g_lcd) {
+       lcderr("ERROR: Failed to initialize LCD %d\n", 0);
+      return -ENODEV;
+  }
+
+  return OK;
+}
+
+/****************************************************************************
+ * Name:  board_lcd_getdev
+ *
+ * Description:
+ *   Return a a reference to the LCD object for the specified LCD.  This

Review Comment:
   Small typo
   ```suggestion
    *   Return a reference to the LCD object for the specified LCD.  This
   ```



##########
boards/xtensa/esp32s3/esp32s3-ws-lcd128/configs/notouch-lvgl/defconfig:
##########
@@ -0,0 +1,84 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="xtensa"
+CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
+CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH=y
+CONFIG_ARCH_CHIP="esp32s3"
+CONFIG_ARCH_CHIP_ESP32S3=y
+CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_IRQ_TO_NDX=y
+CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
+CONFIG_ARCH_NUSER_INTERRUPTS=2
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_XTENSA=y
+CONFIG_BOARD_INITTHREAD_STACKSIZE=8192
+CONFIG_BOARD_LATE_INITIALIZE=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_GPIO=y
+CONFIG_DEBUG_GPIO_ERROR=y
+CONFIG_DEBUG_LCD=y

Review Comment:
   See if all those debug options are needed for the defconfig



##########
boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_board_lcd_gc9a01.c:
##########
@@ -0,0 +1,147 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/common/src/esp32s3_gc9a01.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+#include <arch/board/board.h>
+#include <debug.h>
+#include <errno.h>
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <nuttx/config.h>
+#include <nuttx/spi/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/gc9a01.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <syslog.h>
+
+#include "espressif/esp_gpio.h"
+#include "esp32s3_spi.h"
+#include "esp32s3-ws-lcd128.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct spi_dev_s *g_spidev;
+static struct lcd_dev_s *g_lcd = NULL;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  board_lcd_initialize
+ *
+ * Description:
+ *   Initialize the LCD video hardware.  The initial state of the LCD is
+ *   fully initialized, display memory cleared, and the LCD ready to use, but
+ *   with the power setting at 0 (full off).
+ *
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+
+  syslog(LOG_INFO, "Initializing LCD GPIO pins.");
+
+  /* SPI RX is not used. Same pin is used as LCD Data/Command control */
+
+  esp_configgpio(DISPLAY_DC, OUTPUT);
+  esp_gpiowrite(DISPLAY_DC, true);
+
+  /* Pull LCD_RESET high */
+
+  esp_configgpio(DISPLAY_RST, OUTPUT);
+  esp_gpiowrite(DISPLAY_RST, false);
+  up_mdelay(50);
+  esp_gpiowrite(DISPLAY_RST, true);
+  up_mdelay(50);
+
+  /* Set full brightness */
+
+  esp_configgpio(DISPLAY_BCKL, OUTPUT);
+  esp_gpiowrite(DISPLAY_BCKL, true);
+
+  syslog(LOG_INFO, "Initializing LCD SPI port.");
+
+  lcdinfo("Initializing SPI port %d\n", DISPLAY_SPI);
+
+  g_spidev = esp32s3_spibus_initialize(DISPLAY_SPI);
+  if (!g_spidev)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n", DISPLAY_SPI);
+      return -ENODEV;
+    }
+
+  lcdinfo("Initialized SPI port %d\n", DISPLAY_SPI);
+
+  g_lcd = gc9a01_lcdinitialize(g_spidev);
+  if (!g_lcd) {
+       lcderr("ERROR: Failed to initialize LCD %d\n", 0);
+      return -ENODEV;
+  }
+
+  return OK;
+}
+
+/****************************************************************************
+ * Name:  board_lcd_getdev
+ *
+ * Description:
+ *   Return a a reference to the LCD object for the specified LCD.  This
+ *   allows support for multiple LCD devices.
+ *
+ ****************************************************************************/
+
+struct lcd_dev_s *board_lcd_getdev(int devno)
+{
+  if (!g_lcd)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to LCD %d\n",
+             DISPLAY_SPI, devno);
+      return NULL;
+    }
+  else
+    {
+      lcdinfo("SPI port %d bound to LCD %d\n", DISPLAY_SPI, devno);

Review Comment:
   Keep using syslog instead of lcdinfo, as you use syslog right above.



##########
boards/xtensa/esp32s3/esp32s3-ws-lcd128/configs/touch-lvgl/defconfig:
##########
@@ -0,0 +1,84 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="xtensa"
+CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
+CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH=y
+CONFIG_ARCH_CHIP="esp32s3"
+CONFIG_ARCH_CHIP_ESP32S3=y
+CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_IRQ_TO_NDX=y
+CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
+CONFIG_ARCH_NUSER_INTERRUPTS=2
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_XTENSA=y
+CONFIG_BOARD_INITTHREAD_STACKSIZE=8192
+CONFIG_BOARD_LATE_INITIALIZE=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_GPIO=y

Review Comment:
   See if all those debug options are needed for this defconfig



##########
boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_board_lcd_gc9a01.c:
##########
@@ -0,0 +1,147 @@
+/****************************************************************************
+ * boards/xtensa/esp32s3/common/src/esp32s3_gc9a01.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+#include <arch/board/board.h>
+#include <debug.h>
+#include <errno.h>
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <nuttx/config.h>
+#include <nuttx/spi/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/gc9a01.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <syslog.h>
+
+#include "espressif/esp_gpio.h"
+#include "esp32s3_spi.h"
+#include "esp32s3-ws-lcd128.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct spi_dev_s *g_spidev;
+static struct lcd_dev_s *g_lcd = NULL;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  board_lcd_initialize
+ *
+ * Description:
+ *   Initialize the LCD video hardware.  The initial state of the LCD is
+ *   fully initialized, display memory cleared, and the LCD ready to use, but
+ *   with the power setting at 0 (full off).
+ *
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+
+  syslog(LOG_INFO, "Initializing LCD GPIO pins.");
+
+  /* SPI RX is not used. Same pin is used as LCD Data/Command control */
+
+  esp_configgpio(DISPLAY_DC, OUTPUT);
+  esp_gpiowrite(DISPLAY_DC, true);
+
+  /* Pull LCD_RESET high */
+
+  esp_configgpio(DISPLAY_RST, OUTPUT);
+  esp_gpiowrite(DISPLAY_RST, false);
+  up_mdelay(50);
+  esp_gpiowrite(DISPLAY_RST, true);
+  up_mdelay(50);
+
+  /* Set full brightness */
+
+  esp_configgpio(DISPLAY_BCKL, OUTPUT);
+  esp_gpiowrite(DISPLAY_BCKL, true);
+
+  syslog(LOG_INFO, "Initializing LCD SPI port.");
+
+  lcdinfo("Initializing SPI port %d\n", DISPLAY_SPI);

Review Comment:
   Personally I prefer to stick with syslog at board level instead of mixing 
syslog and lcdinfo. Either way we should stick to one



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to