Skip to content

Commit dc61350

Browse files
authored
Pulse Counter support for esp32p4. (#401)
The various pulse counter bindings are now enabled for esp32p4. Additionally, a target for riscv32imafc-esp-espidf has been added.
1 parent 0d95720 commit dc61350

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ rustflags = ["--cfg", "espidf_time64"]
2222
linker = "ldproxy"
2323
rustflags = ["--cfg", "espidf_time64"]
2424

25+
[target.riscv32imafc-esp-espidf]
26+
linker = "ldproxy"
27+
rustflags = ["--cfg", "espidf_time64"]
28+
2529
[env]
2630
ESP_IDF_SDKCONFIG_DEFAULTS = ".github/configs/sdkconfig.defaults"
2731
ESP_IDF_VERSION = "v5.3.2"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- Compatibility with ESP-IDF v5.4.X, v5.5.x
2424
- Support for `esp32c5` and `esp32c61`
2525
- Add raw bindings for `esp_lcd_mipi_dsi.h` and `esp_ldo_regulator.h` (#398)
26+
- Pulse counter bindings for esp32p4
2627

2728
### Fixed
2829
- Fix the `esp_app_desc!` macro so the reserv3 field is correct for ESP IDF v5.4

src/include/esp-idf/bindings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445

446446
// PCNT
447447
#if OLD_DRIVER_COMP || defined(ESP_IDF_COMP_ESP_DRIVER_PCNT_ENABLED)
448-
#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C5) || defined(CONFIG_IDF_TARGET_ESP32C6) // defined(CONFIG_IDF_TARGET_ESP32P4) // not yet supported in esp-idf
448+
#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C5) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32P4)
449449
#if ESP_IDF_VERSION_MAJOR < 6
450450
#include "driver/pcnt.h"
451451
#endif

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub use bindings::*;
1818
pub use error::*;
1919

2020
// Don't use esp_idf_soc_pcnt_supported; that's only on ESP-IDF v5.x+.
21-
#[cfg(any(esp32, esp32s2, esp32s3, esp32c5, esp32c6, esp32h2))]
21+
#[cfg(any(esp32, esp32s2, esp32s3, esp32c5, esp32c6, esp32h2, esp32p4))]
2222
pub use pcnt::*;
2323

2424
#[doc(hidden)]
@@ -44,7 +44,7 @@ mod app_desc;
4444
mod error;
4545
mod panic;
4646
mod patches;
47-
#[cfg(any(esp32, esp32s2, esp32s3, esp32c5, esp32c6, esp32h2))]
47+
#[cfg(any(esp32, esp32s2, esp32s3, esp32c5, esp32c6, esp32h2, esp32p4))]
4848
mod pcnt;
4949

5050
mod start;
@@ -82,7 +82,7 @@ pub fn link_patches() -> PatchesRef {
8282
#[allow(improper_ctypes)] // TODO: For now, as 5.0 spits out tons of these
8383
#[allow(dead_code)]
8484
mod bindings {
85-
#[cfg(any(esp32, esp32s2, esp32s3, esp32c5, esp32c6, esp32h2))]
85+
#[cfg(any(esp32, esp32s2, esp32s3, esp32c5, esp32c6, esp32h2, esp32p4))]
8686
use crate::pcnt::*;
8787

8888
include!(env!("EMBUILD_GENERATED_BINDINGS_FILE"));

0 commit comments

Comments
 (0)