Skip to content

Commit

Permalink
Fix the F_CPU frequency definition for the ESP32-S3 in esp32-hal.h (#…
Browse files Browse the repository at this point in the history
…7913)

* Add v2.0.7 in issue template (#7871)

* Fix the F_CPU frequency for the ESP32-S3

Hello, I was using the FastLED library and it was complaining about F_CPU not being defined. So, I just noticed that it is not defined for the ESP32-S3 module. So I made this change in the header file and it compiled. Therefore I wanted to propose this change to the HAL library to improve compatibility. Thank you for your time.

* Makes F_CPU generic based on the SoC frequency

Works for ESP32, ESP32C3, ESP32S2, ESP32S3

* Includes ESP32C3 in the F_CPU definition

Necessary for ESP32 Arduino Core 2.0.x based on IDF 4.4

---------

Co-authored-by: Vojtěch Bartoška <76958047+VojtechBartoska@users.noreply.github.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
  • Loading branch information
3 people committed Mar 31, 2023
1 parent a069764 commit 93903fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/Issue-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ body:
options:
- latest master (checkout manually)
- latest development Release Candidate (RC-X)
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
Expand Down
4 changes: 4 additions & 0 deletions cores/esp32/esp32-hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ extern "C" {
#ifndef F_CPU
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U)
#elif CONFIG_IDF_TARGET_ESP32C3
#define F_CPU (CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ * 1000000U)
#elif CONFIG_IDF_TARGET_ESP32S2
#define F_CPU (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000U)
#elif CONFIG_IDF_TARGET_ESP32S3
#define F_CPU (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000U)
#endif
#endif

Expand Down

0 comments on commit 93903fc

Please sign in to comment.