LEDC: improved support for ESP32-C3 and refactored divisor calculation

As ESP32C3 does not have support for REF_TICK source clock, it is now not
possible to select it anymore.
Auto cfg clock has been improved for all boards.
This commit is contained in:
Omar Chebib
2021-06-02 20:19:09 +08:00
parent 534cd5bb31
commit aa2ca7dd94
17 changed files with 417 additions and 242 deletions

View File

@@ -26,6 +26,22 @@ extern "C" {
#endif
#define LEDC_LL_GET_HW() &LEDC
#define LEDC_LL_FRACTIONAL_BITS (8)
#define LEDC_LL_FRACTIONAL_MAX ((1 << LEDC_LL_FRACTIONAL_BITS) - 1)
#define LEDC_LL_GLOBAL_CLOCKS { \
LEDC_USE_APB_CLK, \
LEDC_USE_XTAL_CLK, \
LEDC_USE_RTC8M_CLK, \
}
#define LEDC_LL_TIMER_SPECIFIC_CLOCKS \
{\
{ \
.clk = LEDC_REF_TICK, \
.freq = LEDC_REF_CLK_HZ, \
} \
}
#define LEDC_LL_IS_TIMER_SPECIFIC_CLOCK(SPEED, CLK) ((CLK) == LEDC_USE_REF_TICK)
/**
* @brief Set LEDC low speed timer clock