Hi all,
I am not sure I understand the application you are trying to develop, but I have been working lately with the ledc API, and perhaps I can provide some info (from the API reference).
first, the type declaration is:
"
enum ledc_intr_type_t
Values:
LEDC_INTR_DISABLE = 0
Disable LEDC interrupt
LEDC_INTR_FADE_END
Enable LEDC interrupt
LEDC_INTR_MAX
"
"When configuring an LEDC channel, one of the parameters selected within ledc_channel_config_t is ledc_intr_type_t which triggers an interrupt on fade completion."
The only valid values are
LEDC_INTR_DISABLE
LEDC_INTR_FADE_END
I understood that LEDC_INTR_MAX behaves like and "non valid value", I could not find any other explanation about it, because the interrupt can only be enabled or disabled. I assumed that also because a similar syntax appears in other types, with that meaning.
However, the interrupt is fired when the fade cycle ends, so it is expected you perform a complete "fade" operation, either ledc_set_fade_with_time or ledc_fade_with_step.
And here comes my confusion: you are saying you want "to use LEDC as a 1 bit D/A, sampling a waveform table. Therefore I need to change the duty cycle every time the counter reaches the duty cycle
My understanding is that ledc will provide you a steady stream of pulses or a perfect fade cycle, but not one pulse at a time, so you cannot control de duty cycle of the "next" pulse.
You will get one interrupt for the whole fade cycle, not for each pulse.
i am not an expert, but it seems you need to design your application in a different way.
If you want to do some prototyping, I just posted a repository, with one Arduino sketch to do "interactive" prototyping with the ledc and esp32-hal-ledc (Arduiino) libraries.
There is one function in the Arduino library (hal-ledc) that is not implemented in the sketch, "tone()", but for the rest it may provide you a quick "hands on" on ledc.
the repository is at
https://abellisco.github.io/liscolab
Hope this helped