boards/xtensa/esp32s3: New board WaveShare ESP32-S3-Touch-LCD-1.28 (WIP).

* Initial experimental / work in progress implementation.
* New board name is esp32s3-ws-lcd128.
* Supports Kconfig delectable w/wo touch variants (lcd gpios difference).
* IMU QMI8658 bringups is put into esp32s3/common/src to share with other
  boards. Pin defines are located at <board>include/board.h and referenced
  with `#include <arch/board/board.h>`.
* Supported configurations: nsh, ostest, coremark, touch-lvgl, notouch-lvgl,
  imu-qmi8658, watchdog.
* Does not have touch panel driver yet.
* Created board documentation. Added sphinx inline cross-references.
* TODO: Fix SPI GC9A01A LCD pixel format colors.
* TODO: Create I2C CST816S touch panel driver.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
This commit is contained in:
Tomasz 'CeDeROM' CEDRO
2026-03-15 21:04:29 +01:00
committed by Xiang Xiao
parent 04c4269ef0
commit 3efaf80d3d
42 changed files with 3436 additions and 0 deletions
@@ -74,6 +74,10 @@ ifeq ($(CONFIG_ESPRESSIF_ADC),y)
CSRCS += esp32s3_board_adc.c
endif
ifeq ($(CONFIG_SENSORS_QMI8658),y)
CSRCS += esp32s3_qmi8658.c
endif
ifeq ($(CONFIG_NET_LAN9250),y)
CSRCS += esp32s3_lan9250.c
endif
@@ -0,0 +1,89 @@
/****************************************************************************
* boards/xtensa/esp32s3/common/src/esp32s3_qmi8658.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 <nuttx/config.h>
#include <unistd.h>
#include <stdlib.h>
#include <debug.h>
#include <assert.h>
#include <arch/board/board.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/sensors/qmi8658.h>
#include "esp32s3_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_qmi8658_initialize
*
* Description:
* Initialize and register the QMI8658 6-axis IMU sensor driver.
*
* This function registers the uORB interface which creates:
* - "/dev/uorb/sensor_accel0" for accelerometer data
* - "/dev/uorb/sensor_gyro0" for gyroscope data
*
* This driver initialization expects defines at <board>/include/board.h:
* 1. QMI8658_I2C_PORT: I2C port used (remember to configure pins).
* 2. QMI8658_I2C_ADDR: chip address (0x6B for SA0=0 or 0x6A for SA0=1).
*
* Input Parameters:
* None
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int esp32s3_qmi8658_initialize(void)
{
struct i2c_master_s *i2c;
int ret;
/* Initialize I2C bus */
i2c = esp32s3_i2cbus_initialize(QMI8658_I2C_PORT);
if (!i2c)
{
i2cerr("Initialize I2C bus failed!\n");
return -EINVAL;
}
/* Register QMI8658 uORB sensor device */
ret = qmi8658_uorb_register(0, i2c, QMI8658_I2C_ADDR);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to register QMI8658 uORB driver: %d\n", ret);
}
return ret;
}
@@ -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
endif # ARCH_BOARD_ESP32S3_WS_LCD128
@@ -0,0 +1,42 @@
#
# 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_NDEBUG 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_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_BENCHMARK_COREMARK=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_DEBUG_CUSTOMOPT=y
CONFIG_DEBUG_OPTLEVEL="-O3"
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="coremark_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SMP=y
CONFIG_SMP_NCPUS=2
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_UART0_SERIAL_CONSOLE=y
@@ -0,0 +1,65 @@
#
# 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_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_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_UORB=y
CONFIG_ESP32S3_I2C0=y
CONFIG_ESP32S3_I2C0_SCLPIN=7
CONFIG_ESP32S3_I2C0_SDAPIN=6
CONFIG_ESPRESSIF_TEMP=y
CONFIG_ESPRESSIF_TEMP_UORB=y
CONFIG_ESPRESSIF_TEMP_UORB_POLL=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SENSORS=y
CONFIG_SENSORS_QMI8658=y
CONFIG_SENSORS_QMI8658_POLL=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UORB=y
CONFIG_UORB_LISTENER=y
CONFIG_UORB_STACKSIZE=4096
CONFIG_USENSOR=y
@@ -0,0 +1,74 @@
#
# 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_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_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ESP32S3_DMA=y
CONFIG_ESP32S3_PSRAM_2M=y
CONFIG_ESP32S3_SPEED_UP_ISR=y
CONFIG_ESP32S3_SPI2_CLKPIN=10
CONFIG_ESP32S3_SPI2_CSPIN=9
CONFIG_ESP32S3_SPI2_MISOPIN=12
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_FS_PROCFS=y
CONFIG_GRAPHICS_LVGL=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=8192
CONFIG_INIT_ENTRYPOINT="lvgldemo_main"
CONFIG_INIT_STACKSIZE=16384
CONFIG_INTELHEX_BINARY=y
CONFIG_LCD_FRAMEBUFFER=y
CONFIG_LCD_GC9A01_BGR=y
CONFIG_LCD_GC9A01_FREQUENCY=50000000
CONFIG_LCD_PORTRAIT=y
CONFIG_LINE_MAX=64
CONFIG_LV_FONT_MONTSERRAT_20=y
CONFIG_LV_USE_CLIB_MALLOC=y
CONFIG_LV_USE_CLIB_SPRINTF=y
CONFIG_LV_USE_CLIB_STRING=y
CONFIG_LV_USE_DEMO_WIDGETS=y
CONFIG_LV_USE_LOG=y
CONFIG_LV_USE_NUTTX=y
CONFIG_LV_USE_NUTTX_LCD=y
CONFIG_MM_REGIONS=2
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SPI_DRIVER=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
@@ -0,0 +1,47 @@
#
# 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_ESP32S3_RTC is not set
# 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_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_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=23
CONFIG_START_YEAR=2026
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
@@ -0,0 +1,50 @@
#
# 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_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_SETJMP_H=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_THREAD_LOCAL=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y
@@ -0,0 +1,75 @@
#
# 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_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ESP32S3_DMA=y
CONFIG_ESP32S3_PSRAM_2M=y
CONFIG_ESP32S3_SPEED_UP_ISR=y
CONFIG_ESP32S3_SPI2_CLKPIN=10
CONFIG_ESP32S3_SPI2_CSPIN=9
CONFIG_ESP32S3_SPI2_MISOPIN=12
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_FS_PROCFS=y
CONFIG_GRAPHICS_LVGL=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=8192
CONFIG_INIT_ENTRYPOINT="lvgldemo_main"
CONFIG_INIT_STACKSIZE=16384
CONFIG_INTELHEX_BINARY=y
CONFIG_LCD_FRAMEBUFFER=y
CONFIG_LCD_GC9A01_BGR=y
CONFIG_LCD_GC9A01_FREQUENCY=50000000
CONFIG_LCD_PORTRAIT=y
CONFIG_LINE_MAX=64
CONFIG_LV_FONT_MONTSERRAT_20=y
CONFIG_LV_USE_CLIB_MALLOC=y
CONFIG_LV_USE_CLIB_SPRINTF=y
CONFIG_LV_USE_CLIB_STRING=y
CONFIG_LV_USE_DEMO_WIDGETS=y
CONFIG_LV_USE_LOG=y
CONFIG_LV_USE_NUTTX=y
CONFIG_LV_USE_NUTTX_LCD=y
CONFIG_MM_REGIONS=2
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SPI_DRIVER=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
@@ -0,0 +1,54 @@
#
# 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_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_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ESP32S3_MWDT0=y
CONFIG_ESP32S3_MWDT1=y
CONFIG_ESP32S3_RWDT=y
CONFIG_EXAMPLES_WATCHDOG=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WATCHDOG=y
@@ -0,0 +1,59 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/include/board.h
*
* 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.
*
****************************************************************************/
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_H
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
/* The ESP32-S3 DevKit board is fitted with a 40MHz crystal */
#define BOARD_XTAL_FREQUENCY 40000000
#ifdef CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ
# define BOARD_CLOCK_FREQUENCY (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000)
#else
# define BOARD_CLOCK_FREQUENCY 80000000
#endif
/* LED definitions **********************************************************/
/* Define how many LEDs this board has (needed by userleds) */
#define BOARD_NLEDS 0
/* GPIO pins used by the GPIO Subsystem */
#define BOARD_NGPIOOUT 0 /* Amount of GPIO Output pins */
#define BOARD_NGPIOIN 0 /* Amount of GPIO Input without Interruption */
#define BOARD_NGPIOINT 0 /* Amount of GPIO Input w/ Interruption pins */
/* IMU definitions **********************************************************/
#define QMI8658_I2C_PORT (0)
#define QMI8658_I2C_ADDR (0x6B)
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_H */
@@ -0,0 +1,118 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/include/board_memorymap.h
*
* 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.
*
****************************************************************************/
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_MEMORYMAP_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_MEMORYMAP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Kernel ROM */
#define KIROM_START (uintptr_t)__kirom_start
#define KIROM_SIZE (uintptr_t)__kirom_size
#define KDROM_START (uintptr_t)__kdrom_start
#define KDROM_SIZE (uintptr_t)__kdrom_size
/* Kernel RAM */
#define KIRAM_START (uintptr_t)__kiram_start
#define KIRAM_SIZE (uintptr_t)__kiram_size
#define KIRAM_END (uintptr_t)__kiram_end
#define KDRAM_START (uintptr_t)__kdram_start
#define KDRAM_SIZE (uintptr_t)__kdram_size
#define KDRAM_END (uintptr_t)__kdram_end
/* Exception vectors */
#define VECTORS_START (uintptr_t)__vectors_start
#define VECTORS_END (uintptr_t)__vectors_end
/* User ROM */
#define UIROM_START (uintptr_t)__uirom_start
#define UIROM_SIZE (uintptr_t)__uirom_size
#define UIROM_END (uintptr_t)__uirom_end
#define UDROM_START (uintptr_t)__udrom_start
#define UDROM_SIZE (uintptr_t)__udrom_size
#define UDROM_END (uintptr_t)__udrom_end
/* User RAM */
#define UIRAM_START (uintptr_t)__uiram_start
#define UIRAM_SIZE (uintptr_t)__uiram_size
#define UIRAM_END (uintptr_t)__uiram_end
#define UDRAM_START (uintptr_t)__udram_start
#define UDRAM_SIZE (uintptr_t)__udram_size
#define UDRAM_END (uintptr_t)__udram_end
/****************************************************************************
* Public Data
****************************************************************************/
/* Kernel ROM (RX) */
extern uint8_t __kirom_start[];
extern uint8_t __kirom_size[];
extern uint8_t __kdrom_start[];
extern uint8_t __kdrom_size[];
/* Kernel RAM (RW) */
extern uint8_t __kiram_start[];
extern uint8_t __kiram_size[];
extern uint8_t __kiram_end[];
extern uint8_t __kdram_start[];
extern uint8_t __kdram_size[];
extern uint8_t __kdram_end[];
/* Exception vectors */
extern uint8_t __vectors_start[];
extern uint8_t __vectors_end[];
/* User ROM (RX) */
extern uint8_t __uirom_start[];
extern uint8_t __uirom_size[];
extern uint8_t __uirom_end[];
extern uint8_t __udrom_start[];
extern uint8_t __udrom_size[];
extern uint8_t __udrom_end[];
/* User RAM (RW) */
extern uint8_t __uiram_start[];
extern uint8_t __uiram_size[];
extern uint8_t __uiram_end[];
extern uint8_t __udram_start[];
extern uint8_t __udram_size[];
extern uint8_t __udram_end[];
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_MEMORYMAP_H */
@@ -0,0 +1,57 @@
############################################################################
# boards/xtensa/esp32s3/esp32s3-ws-lcd128/scripts/Make.defs
#
# 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.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/tools/esp32s3/Config.mk
include $(TOPDIR)/arch/xtensa/src/lx7/Toolchain.defs
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_peripherals.ld
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_rom_aliases.ld
# Pick the linker scripts from the board level if they exist, if not
# pick the common linker scripts.
ifeq ($(CONFIG_BUILD_PROTECTED),y)
ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld)
ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld)
ifneq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
ARCHSCRIPT += $(call FINDSCRIPT,esp32s3_sections.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
endif
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -fno-strength-reduce
endif
ARCHPICFLAGS = -fpic
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
@@ -0,0 +1,50 @@
############################################################################
# boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/Make.defs
#
# 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.
#
############################################################################
CSRCS = esp32s3_boot.c esp32s3_bringup.c
ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += esp32s3_appinit.c
ifeq ($(CONFIG_BOARDCTL_RESET),y)
CSRCS += esp32s3_reset.c
endif
endif
ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += esp32s3_buttons.c
endif
ifeq ($(CONFIG_DEV_GPIO),y)
CSRCS += esp32s3_gpio.c
endif
ifeq ($(CONFIG_LCD_GC9A01),y)
CSRCS += esp32s3_board_lcd_gc9a01.c
endif
ifeq ($(CONFIG_SPI),y)
CSRCS += esp32s3_board_spi.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
@@ -0,0 +1,207 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3-ws-lcd128.h
*
* 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.
*
****************************************************************************/
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_SRC_ESP32S3_WS_LCD128_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_SRC_ESP32S3_WS_LCD128_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* RMT gpio */
#define RMT_RXCHANNEL (4)
#define RMT_TXCHANNEL (0)
#ifdef CONFIG_RMT_LOOP_TEST_MODE
# define RMT_INPUT_PIN (0)
# define RMT_OUTPUT_PIN (0)
#else
# define RMT_INPUT_PIN (16)
#endif
#define RMT_OUTPUT_PIN (15)
/* LCD gpio */
#if defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH) && \
defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH)
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH is defined."
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH is defined."
# error "These options are exclusive!"
#elif !defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH) && \
!defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH)
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH is not defined."
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH is not defined."
# error "One of them must be defined!"
#elif defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH)
# ifdef CONFIG_LCD
# define DISPLAY_SPI (2)
# define DISPLAY_RST (14)
# define DISPLAY_DC (8)
# define DISPLAY_BCKL (2)
# endif
#elif defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH)
# ifdef CONFIG_LCD
# define DISPLAY_SPI (2)
# define DISPLAY_RST (12)
# define DISPLAY_DC (8)
# define DISPLAY_BCKL (40)
# endif
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp32s3_bringup
*
* Description:
* Perform architecture-specific initialization
*
* CONFIG_BOARD_LATE_INITIALIZE=y :
* Called from board_late_initialize().
*
* CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
* Called from the NSH library via board_app_initialize()
*
****************************************************************************/
int esp32s3_bringup(void);
/****************************************************************************
* Name: esp32s3_gpio_init
*
* Description:
* Configure the GPIO driver.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_DEV_GPIO
int esp32s3_gpio_init(void);
#endif
/****************************************************************************
* Name: board_spiflash_init
*
* Description:
* Initialize the SPIFLASH and register the MTD device.
*
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPIFLASH
int board_spiflash_init(void);
#endif
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_I2C_DRIVER
int board_i2c_init(void);
#endif
/****************************************************************************
* Name: board_i2sdev_initialize
*
* Description:
* This function is called by platform-specific, setup logic to configure
* and register the generic I2S audio driver. This function will register
* the driver as /dev/audio/pcm[x] where x is determined by the I2S port
* number.
*
* Input Parameters:
* port - The I2S port used for the device
* enable_tx - Register device as TX if true
* enable_rx - Register device as RX if true
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_ESPRESSIF_I2S
int board_i2sdev_initialize(int port, bool enable_tx, bool enable_rx);
#endif
#ifdef CONFIG_ESP32S3_TWAI
int esp32s3_twai_setup(void);
#endif
/****************************************************************************
* Name: board_lcd_initialize
*
* Description:
* Initialize the onboard GC9A01 LCD device.
*
****************************************************************************/
#if defined(CONFIG_LCD)
int board_lcd_initialize(void);
#endif
/****************************************************************************
* Name: esp32s3_qmi8658_initialize
*
* Description:
* Initialize the onboard QMI8658 IMU device uorb driver.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_QMI8658)
int esp32s3_qmi8658_initialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_SRC_ESP32S3_WS_LCD128_H */
@@ -0,0 +1,82 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_appinit.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 <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/board.h>
#include "esp32s3-ws-lcd128.h"
#ifdef CONFIG_BOARDCTL
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_app_initialize
*
* Description:
* Perform application specific initialization. This function is never
* called directly from application code, but only indirectly via the
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
*
* Input Parameters:
* arg - The boardctl() argument is passed to the board_app_initialize()
* implementation without modification. The argument has no
* meaning to NuttX; the meaning of the argument is a contract
* between the board-specific initialization logic and the
* matching application logic. The value could be such things as a
* mode enumeration value, a set of DIP switch settings, a
* pointer to configuration data read from a file or serial FLASH,
* or whatever you would like to do with it. Every implementation
* should accept zero/NULL as a default configuration.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/
int board_app_initialize(uintptr_t arg)
{
#ifdef CONFIG_BOARD_LATE_INITIALIZE
/* Board initialization already performed by board_late_initialize() */
return OK;
#else
/* Perform board-specific initialization */
return esp32s3_bringup();
#endif
}
#endif /* CONFIG_BOARDCTL */
@@ -0,0 +1,147 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_board_lcd_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_DEBUG, "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_DEBUG, "Initializing LCD SPI %d port.\n", DISPLAY_SPI);
g_spidev = esp32s3_spibus_initialize(DISPLAY_SPI);
if (!g_spidev)
{
syslog(LOG_ERR, "Failed to initialize LCD SPI port %d.\n",
DISPLAY_SPI);
return -ENODEV;
}
syslog(LOG_DEBUG, "Initializing GC9A01 LCD.\n");
g_lcd = gc9a01_lcdinitialize(g_spidev);
if (!g_lcd)
{
syslog(LOG_ERR, "Failed to initialize LCD %d.\n", 0);
return -ENODEV;
}
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
*
* Description:
* Return 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
{
syslog(LOG_INFO, "SPI port %d bound to LCD %d.\n", DISPLAY_SPI, devno);
return g_lcd;
}
return NULL;
}
/****************************************************************************
* Name: board_lcd_uninitialize
*
* Description:
* Uninitialize the LCD support
*
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* Turn the display off */
g_lcd->setpower(g_lcd, 0);
}
@@ -0,0 +1,161 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_board_spi.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 <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "espressif/esp_gpio.h"
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: spi_status
****************************************************************************/
static inline uint8_t spi_status(struct spi_dev_s *dev, uint32_t devid)
{
uint8_t status = 0;
#ifdef CONFIG_MMCSD_SPI
if (devid == SPIDEV_MMCSD(0))
{
status |= SPI_STATUS_PRESENT;
}
#endif
#if defined(CONFIG_LCD_ILI9341) || defined(CONFIG_LCD_SSD1680) || defined(CONFIG_LCD_ST7789) || defined(CONFIG_LCD_GC9A01)
if (devid == SPIDEV_DISPLAY(0))
{
status |= SPI_STATUS_PRESENT;
}
#endif
return status;
}
/****************************************************************************
* Name: spi_cmddata
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
static inline int spi_cmddata(struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
#if defined(CONFIG_LCD_ILI9341) || defined(CONFIG_LCD_SSD1680) || defined(CONFIG_LCD_ST7789) || defined(CONFIG_LCD_GC9A01)
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
esp_gpiowrite(DISPLAY_DC, !cmd);
return OK;
}
#endif
return -ENODEV;
}
#endif
#if defined(CONFIG_ESP32S3_SPI2) && defined(CONFIG_ESP32S3_SPI_UDCS)
void esp32s3_spi2_select(struct spi_dev_s *dev, uint32_t devid, bool select)
{
esp_gpiowrite(CONFIG_ESP32S3_SPI2_CSPIN, !select);
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_spi2_status
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPI2
uint8_t esp32s3_spi2_status(struct spi_dev_s *dev, uint32_t devid)
{
return spi_status(dev, devid);
}
#endif
/****************************************************************************
* Name: esp32s3_spi2_cmddata
****************************************************************************/
#if defined(CONFIG_ESP32S3_SPI2) && defined(CONFIG_SPI_CMDDATA)
int esp32s3_spi2_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
"data");
return spi_cmddata(dev, devid, cmd);
}
#endif
/****************************************************************************
* Name: esp32s3_spi3_status
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPI3
uint8_t esp32s3_spi3_status(struct spi_dev_s *dev, uint32_t devid)
{
return spi_status(dev, devid);
}
#endif
/****************************************************************************
* Name: esp32s3_spi3_cmddata
****************************************************************************/
#if defined(CONFIG_ESP32S3_SPI3) && defined(CONFIG_SPI_CMDDATA)
int esp32s3_spi3_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
"data");
return spi_cmddata(dev, devid, cmd);
}
#endif
@@ -0,0 +1,85 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_boot.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 <nuttx/config.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/mm/mm.h>
#include <arch/board/board.h>
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_board_initialize
*
* Description:
* All ESP32-S3 boards must provide the following entry point.
* This entry point is called early in the initialization -- after all
* memory has been configured and mapped but before any devices have been
* initialized.
*
****************************************************************************/
void esp32s3_board_initialize(void)
{
}
/****************************************************************************
* Name: board_late_initialize
*
* Description:
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_late_initialize(). board_late_initialize() will
* be called immediately after up_initialize() is called and just before
* the initial application is started. This additional initialization
* phase may be used, for example, to initialize board-specific device
* drivers.
*
****************************************************************************/
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
/* Perform board-specific initialization */
esp32s3_bringup();
}
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,166 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_buttons.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 <nuttx/config.h>
#include <assert.h>
#include <debug.h>
#include <stdbool.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include "esp32s3_gpio.h"
#include "hardware/esp32s3_gpio_sigmap.h"
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/
uint32_t board_button_initialize(void)
{
esp32s3_configgpio(BUTTON_BOOT, INPUT_FUNCTION_2 | PULLUP);
return 1;
}
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns an
* 8-bit bit set with each bit associated with a button. See the
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
*
****************************************************************************/
uint32_t board_buttons(void)
{
uint8_t ret = 0;
int i = 0;
int n = 0;
bool b0 = esp32s3_gpioread(BUTTON_BOOT);
for (i = 0; i < 10; i++)
{
up_mdelay(1);
bool b1 = esp32s3_gpioread(BUTTON_BOOT);
if (b0 == b1)
{
n++;
}
else
{
n = 0;
}
if (3 == n)
{
break;
}
b0 = b1;
}
iinfo("b=%d n=%d\n", b0, n);
/* Low value means that the button is pressed */
if (!b0)
{
ret = 0x1;
}
return ret;
}
/****************************************************************************
* Name: board_button_irq
*
* Description:
* board_button_irq() may be called to register an interrupt handler that
* will be called when a button is depressed or released. The ID value is
* a button enumeration value that uniquely identifies a button resource.
* See the BUTTON_* definitions in board.h for the meaning of enumeration
* value.
*
****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS
int board_button_irq(int id, xcpt_t irqhandler, void *arg)
{
int ret;
DEBUGASSERT(id == 0);
int irq = ESP32S3_PIN2IRQ(BUTTON_BOOT);
if (irqhandler != NULL)
{
/* Make sure the interrupt is disabled */
esp32s3_gpioirqdisable(irq);
ret = irq_attach(irq, irqhandler, arg);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: irq_attach() failed: %d\n", ret);
return ret;
}
gpioinfo("Attach %p\n", irqhandler);
gpioinfo("Enabling the interrupt\n");
/* Configure the interrupt for rising and falling edges */
esp32s3_gpioirqenable(irq, CHANGE);
}
else
{
gpioinfo("Disable the interrupt\n");
esp32s3_gpioirqdisable(irq);
}
return OK;
}
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,87 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_reset.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 <nuttx/config.h>
#include <stdlib.h>
#include <debug.h>
#include <assert.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include "esp32s3_systemreset.h"
#ifdef CONFIG_BOARDCTL_RESET
#if CONFIG_BOARD_ASSERT_RESET_VALUE == EXIT_SUCCESS
# error "CONFIG_BOARD_ASSERT_RESET_VALUE must not be equal to EXIT_SUCCESS"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_reset
*
* Description:
* Reset board. Support for this function is required by board-level
* logic if CONFIG_BOARDCTL_RESET is selected.
*
* Input Parameters:
* status - Status information provided with the reset event. This
* meaning of this status information is board-specific. If not
* used by a board, the value zero may be provided in calls to
* board_reset().
*
* Returned Value:
* If this function returns, then it was not possible to power-off the
* board due to some constraints. The return value in this case is a
* board-specific reason for the failure to shutdown.
*
****************************************************************************/
int board_reset(int status)
{
syslog(LOG_INFO, "reboot status=%d\n", status);
switch (status)
{
case EXIT_SUCCESS:
up_shutdown_handler();
break;
case CONFIG_BOARD_ASSERT_RESET_VALUE:
break;
default:
break;
}
up_systemreset();
return 0;
}
#endif /* CONFIG_BOARDCTL_RESET */