boards/esp32s3: Move PWM setup to common

Move PWM setup from esp32s3-devkit/src/esp32s3_ledc.c to common/src/esp32s3_board_ledc.c.
Fix esp32s3_pwm_setup() undefined error for esp32s3-korvo-2.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3
2025-03-26 12:15:44 +08:00
committed by Lup Yuen Lee
parent bfcc283694
commit 7d288a9894
8 changed files with 76 additions and 23 deletions
@@ -0,0 +1,69 @@
/****************************************************************************
* boards/xtensa/esp32s3/common/include/esp32s3_board_ledc.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_COMMON_INCLUDE_ESP32S3_BOARD_LEDC_H
#define __BOARDS_XTENSA_ESP32S3_COMMON_INCLUDE_ESP32S3_BOARD_LEDC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp32s3_pwm_setup
*
* Description:
* Initialize LEDC PWM and register the PWM device.
*
****************************************************************************/
#ifdef CONFIG_ESP32S3_LEDC
int esp32s3_pwm_setup(void);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_XTENSA_ESP32S3_COMMON_INCLUDE_ESP32S3_BOARD_LEDC_H */
@@ -94,6 +94,10 @@ ifeq ($(CONFIG_USBMSC),y)
CSRCS += esp32s3_usbmsc.c
endif
ifeq ($(CONFIG_ESP32S3_LEDC),y)
CSRCS += esp32s3_board_ledc.c
endif
DEPPATH += --dep-path src
VPATH += :src
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_ledc.c
* boards/xtensa/esp32s3/common/src/esp32s3_board_ledc.c
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -49,10 +49,6 @@ ifeq ($(CONFIG_DEV_GPIO),y)
CSRCS += esp32s3_gpio.c
endif
ifeq ($(CONFIG_PWM),y)
CSRCS += esp32s3_ledc.c
endif
ifeq ($(CONFIG_LCD_ST7735),y)
CSRCS += esp32s3_st7735.c
endif
@@ -216,18 +216,6 @@ int esp32s3_cs4344_initialize(int port);
int esp32s3_djoy_initialize(void);
#endif
/****************************************************************************
* Name: esp32s3_ledc_setup
*
* Description:
* Initialize LEDC PWM and register the PWM device.
*
****************************************************************************/
#ifdef CONFIG_ESP32S3_LEDC
int esp32s3_pwm_setup(void);
#endif
#ifdef CONFIG_ESP32S3_TWAI
int esp32s3_twai_setup(void);
#endif
@@ -89,7 +89,7 @@
#endif
#ifdef CONFIG_ESP32S3_LEDC
# include "esp32s3_ledc.h"
# include "esp32s3_board_ledc.h"
#endif
#ifdef CONFIG_ESP32S3_PARTITION_TABLE
@@ -45,10 +45,6 @@ ifeq ($(CONFIG_DEV_GPIO),y)
CSRCS += esp32s3_gpio.c
endif
ifeq ($(CONFIG_PWM),y)
CSRCS += esp32s3_ledc.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
@@ -86,7 +86,7 @@
#endif
#ifdef CONFIG_ESP32S3_LEDC
# include "esp32s3_ledc.h"
# include "esp32s3_board_ledc.h"
#endif
#ifdef CONFIG_ESP32S3_PARTITION_TABLE