cederom commented on code in PR #18730: URL: https://github.com/apache/nuttx/pull/18730#discussion_r3080178480
########## boards/xtensa/esp32s3/esp32s3-ws-lcd128/Kconfig: ########## @@ -0,0 +1,38 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_ESP32S3_WS_LCD128 + +choice + prompt "BOARD VARIANT" + default ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH + help + There are two variants of the board with [1] and without [2] touch screen. + These boards also have slightly different signals and capabilities. + Non-touch variant has two connectors with many more GPIO available. + + [1] https://www.waveshare.com/esp32-s3-touch-lcd-1.28.htm + [2] https://www.waveshare.com/esp32-s3-lcd-1.28.htm + + NOTE: Touch screen driver is not yet implemented! + +config ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH + bool "NO-TOUCH ESP32-S3-LCD-1.28" + select LCD + help + Mark this choice if your board has no touch screen module installed. + www.waveshare.com/esp32-s3-lcd-1.28.htm + +config ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH + bool "TOUCH ESP32-S3-Touch-LCD-1.28" + help + Mark this choice if your board has touch screen module installed. + www.waveshare.com/esp32-s3-touch-lcd-1.28.htm + + NOTE: Touch screen driver is not yet implemented! + +endchoice Review Comment: fixed thanks! :-) ########## 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: fixed thanks! :-) -- 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]
