mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 23:28:29 +08:00
esp32s3: Add support to PWM using LEDC
This commit is contained in:
committed by
Xiang Xiao
parent
94970f32d7
commit
453d9688c7
@@ -346,6 +346,15 @@ config ESP32S3_I2C1
|
||||
select ESP32S3_I2C
|
||||
select I2C
|
||||
|
||||
config ESP32S3_LEDC
|
||||
bool "LEDC (PWM)"
|
||||
default n
|
||||
select PWM
|
||||
select ARCH_HAVE_PWM_MULTICHAN
|
||||
---help---
|
||||
Enable support to PWM on ESP32S3 using LEDC peripheral.
|
||||
|
||||
|
||||
config ESP32S3_USBSERIAL
|
||||
bool "USB-Serial Driver"
|
||||
default n
|
||||
@@ -927,6 +936,91 @@ endif # ESP32S3_SPIFLASH
|
||||
|
||||
endmenu # SPI Flash configuration
|
||||
|
||||
menu "LEDC Configuration"
|
||||
depends on ESP32S3_LEDC
|
||||
|
||||
menuconfig ESP32S3_LEDC_TIM0
|
||||
bool "Timer 0"
|
||||
default n
|
||||
|
||||
if ESP32S3_LEDC_TIM0
|
||||
|
||||
config ESP32S3_LEDC_TIM0_CHANNELS
|
||||
int "Number of Timer 0 channels"
|
||||
default 2
|
||||
|
||||
endif # ESP32S3_LEDC_TIM0
|
||||
|
||||
menuconfig ESP32S3_LEDC_TIM1
|
||||
bool "Timer 1"
|
||||
default n
|
||||
|
||||
if ESP32S3_LEDC_TIM1
|
||||
|
||||
config ESP32S3_LEDC_TIM1_CHANNELS
|
||||
int "Number of Timer 1 channels"
|
||||
default 2
|
||||
|
||||
endif # ESP32S3_LEDC_TIM1
|
||||
|
||||
menuconfig ESP32S3_LEDC_TIM2
|
||||
bool "Timer 2"
|
||||
default n
|
||||
|
||||
if ESP32S3_LEDC_TIM2
|
||||
|
||||
config ESP32S3_LEDC_TIM2_CHANNELS
|
||||
int "Number of Timer 2 channels"
|
||||
default 2
|
||||
|
||||
endif # ESP32S3_LEDC_TIM2
|
||||
|
||||
menuconfig ESP32S3_LEDC_TIM3
|
||||
bool "Timer 3"
|
||||
default n
|
||||
|
||||
if ESP32S3_LEDC_TIM3
|
||||
|
||||
config ESP32S3_LEDC_TIM3_CHANNELS
|
||||
int "Number of Timer 3 channels"
|
||||
default 2
|
||||
|
||||
endif # ESP32S3_LEDC_TIM2
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL0_PIN
|
||||
int "Channel 0 pin"
|
||||
default 2
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL1_PIN
|
||||
int "Channel 1 pin"
|
||||
default 3
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL2_PIN
|
||||
int "Channel 2 pin"
|
||||
default 4
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL3_PIN
|
||||
int "Channel 3 pin"
|
||||
default 5
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL4_PIN
|
||||
int "Channel 4 pin"
|
||||
default 6
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL5_PIN
|
||||
int "Channel 5 pin"
|
||||
default 7
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL6_PIN
|
||||
int "Channel 6 pin"
|
||||
default 8
|
||||
|
||||
config ESP32S3_LEDC_CHANNEL7_PIN
|
||||
int "Channel 7 pin"
|
||||
default 9
|
||||
|
||||
endmenu # LEDC configuration
|
||||
|
||||
menu "Application Image Configuration"
|
||||
|
||||
choice
|
||||
|
||||
@@ -57,6 +57,10 @@ ifeq ($(CONFIG_ESP32S3_RNG),y)
|
||||
CHIP_CSRCS += esp32s3_rng.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_LEDC),y)
|
||||
CHIP_CSRCS += esp32s3_ledc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_USBSERIAL),y)
|
||||
CHIP_CSRCS += esp32s3_usbserial.c
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_ledc.h
|
||||
*
|
||||
* 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 __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_LEDC_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_LEDC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/timers/pwm.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ledc_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize one LEDC timer for use with the upper_level PWM driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* timer - A number identifying the timer use.
|
||||
*
|
||||
* Returned Value:
|
||||
* On success, a pointer to the ESP32S3-C3 LEDC lower half PWM driver is
|
||||
* returned. NULL is returned on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct pwm_lowerhalf_s *esp32s3_ledc_init(int timer);
|
||||
|
||||
#endif /* __ARCH_RISCV_SRC_ESP32S3_ESP32S3_LEDC_H */
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user