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


##########
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:
   Updated to syslog.. but other implementations use lcdifo as this is part of 
lcd debug wrappers :-) Can update as needed in future too :-)



##########
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:
   updated, as above :-)



-- 
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