Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/esp pulse cnt #15079

Merged
merged 6 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/platforms/risc-v/esp32c6/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Int. Temp. No
LED No
LED_PWM Yes
MCPWM Yes
Pulse Counter No
Pulse Counter Yes
RMT No
RNG No
RSA No
Expand Down
2 changes: 1 addition & 1 deletion Documentation/platforms/risc-v/esp32h2/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Int. Temp. No
LED No
LED_PWM Yes
MCPWM No
Pulse Counter No
Pulse Counter Yes
RMT No
RNG No
RSA No
Expand Down
31 changes: 20 additions & 11 deletions arch/risc-v/src/common/espressif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,20 @@ config ESP_MCPWM
config ESP_PCNT
bool "Pulse Counter (PCNT / QE) Module"
default n
select CAPTURE
depends on ESPRESSIF_ESP32H2 || ESPRESSIF_ESP32C6
---help---
Pulse Counter is currently used to implement Quadrature
Encoder.

menu "Pulse Counter (PCNT) Configuration"
depends on ESP_PCNT

config ESP_PCNT_TEST_MODE
bool "Pulse Counter character driver loopback test mode (for testing only)"
default n
---help---
This enables a loopback test mode that attaches the transmitter
to the receiver internally, being able to test the PCNT
peripheral without any external connection.

config ESP_PCNT_AS_QE
bool
default n
Expand All @@ -561,7 +567,7 @@ if ESP_PCNT_U0

config ESP_PCNT_U0_QE
bool "Use this PCNT Unit as Quadrature Encoder"
default y
default n
select ESP_PCNT_AS_QE

config ESP_PCNT_U0_CH0_EDGE_PIN
Expand All @@ -571,15 +577,15 @@ config ESP_PCNT_U0_CH0_EDGE_PIN

config ESP_PCNT_U0_CH0_LEVEL_PIN
int "PCNT_U0 CH0 Level/Control Pin Number"
default 4
default 4 if !ESP_PCNT_U0_QE
default -1 if ESP_PCNT_U0_QE
range -1 39
depends on !ESP_PCNT_U0_QE

config ESP_PCNT_U0_CH1_EDGE_PIN
int "PCNT_U0 CH1 Edge/Pulse Pin Number"
default 0
default 0 if !ESP_PCNT_U0_QE
default -1 if ESP_PCNT_U0_QE
range -1 39
depends on !ESP_PCNT_U0_QE

config ESP_PCNT_U0_CH1_LEVEL_PIN
int "PCNT_U0 CH1 Level/Control Pin Number"
Expand All @@ -605,13 +611,14 @@ endif # ESP_PCNT_U0

config ESP_PCNT_U1
bool "Enable PCNT Unit 1"
depends on ESP_PCNT_U0
default n

if ESP_PCNT_U1

config ESP_PCNT_U1_QE
bool "Use this PCNT Unit as Quadrature Encoder"
default y
default n
select ESP_PCNT_AS_QE

config ESP_PCNT_U1_CH0_EDGE_PIN
Expand Down Expand Up @@ -655,13 +662,14 @@ endif # ESP_PCNT_U1

config ESP_PCNT_U2
bool "Enable PCNT Unit 2"
depends on ESP_PCNT_U1
default n

if ESP_PCNT_U2

config ESP_PCNT_U2_QE
bool "Use this PCNT Unit as Quadrature Encoder"
default y
default n
select ESP_PCNT_AS_QE

config ESP_PCNT_U2_CH0_EDGE_PIN
Expand Down Expand Up @@ -705,13 +713,14 @@ endif # ESP_PCNT_U2

config ESP_PCNT_U3
bool "Enable PCNT Unit 3"
depends on ESP_PCNT_U2
default n

if ESP_PCNT_U3

config ESP_PCNT_U3_QE
bool "Use this PCNT Unit as Quadrature Encoder"
default y
default n
select ESP_PCNT_AS_QE

config ESP_PCNT_U3_CH0_EDGE_PIN
Expand Down
7 changes: 5 additions & 2 deletions arch/risc-v/src/common/espressif/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ ifeq ($(CONFIG_ESPRESSIF_LEDC),y)
CHIP_CSRCS += esp_ledc.c
endif

ifeq ($(CONFIG_ESP_PCNT_AS_QE),y)
CHIP_CSRCS += esp_qencoder.c
ifeq ($(CONFIG_ESP_PCNT),y)
CHIP_CSRCS += esp_pcnt.c
ifeq ($(CONFIG_ESP_PCNT_AS_QE),y)
CHIP_CSRCS += esp_qencoder.c
endif
endif

ifeq ($(CONFIG_ESPRESSIF_USBSERIAL),y)
Expand Down
Loading