From d6f4749dc0fae284b3996a29f40cfd6dfb20c284 Mon Sep 17 00:00:00 2001 From: Ihor Nehrutsa Date: Thu, 14 Nov 2024 10:21:28 +0200 Subject: [PATCH] Update ledc_check.c --- .../ledc/ledc_check/main/ledc_check.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/peripherals/ledc/ledc_check/main/ledc_check.c b/examples/peripherals/ledc/ledc_check/main/ledc_check.c index 1a11ca4e489..c2218955654 100755 --- a/examples/peripherals/ledc/ledc_check/main/ledc_check.c +++ b/examples/peripherals/ledc/ledc_check/main/ledc_check.c @@ -1,6 +1,6 @@ -/* LEDC (LED Controller) basic example +/* LEDC (LED Controller) basic checks example - This example code is in the Public Domain (or CC0 licensed, at your option.) + This code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR @@ -16,16 +16,16 @@ #define CHECK_SET 0 // 1 #if CHECK_SET != 0 -Add to the esp-idf/components/esp_driver_ledc/include/driver/ledc.h +Add to the esp-idf//components//esp_driver_ledc//include//driver//ledc.h uint32_t ledc_calculate_divisor(uint32_t src_clk_freq, int freq_hz, uint32_t precision); #endif -#define CHECK_ALL 0 // 1 -#define FDIV 1 // 2 // 5 +#define CHECK_ALL 0 // 1 // Set CHECK_ALL to 1 for test all frequencies from 1Hz to 40MHz +#define FDIV 1 // 2 // 5 // Test not all frequencies, but more frequencies #define DELAY_ms 500 // 3000 -#undef ESP_ERROR_CHECK -#define ESP_ERROR_CHECK(err) do {if (err != ESP_OK) {printf("freq=%lu, err=%d, LINE=%d\n", freq, err, __LINE__);} } while (0); +// #undef ESP_ERROR_CHECK +// #define ESP_ERROR_CHECK(err) do {if (err != ESP_OK) {printf("freq=%lu, err=%d, LINE=%d\n", freq, err, __LINE__);} } while (0); #define LEDC_OUTPUT_IO (26) // Define the output GPIO #define LEDC_TIMER LEDC_TIMER_0 @@ -102,7 +102,8 @@ static void check(uint32_t freq) } } -void app_main(void) { +void app_main(void) +{ uint32_t freq; for (freq = 1; freq <= 40000000; freq += 1) { #if CHECK_ALL != 1