Skip to content

Commit

Permalink
Update ledc_check.c
Browse files Browse the repository at this point in the history
  • Loading branch information
IhorNehrutsa authored Nov 14, 2024
1 parent 5f741af commit d6f4749
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions examples/peripherals/ledc/ledc_check/main/ledc_check.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d6f4749

Please sign in to comment.