Expose PWM functions via analogWrite
and friends
#1
Labels
Component: DAC
Regarding the DAC component
Component: PWM
Regarding the PWM component
enhancement
New feature or request
Currently calling
analogWrite
will attempt to write the value into the DAC peripheral, producing an exact analog voltage.https://github.com/CommunityGD32Cores/GD32Core-New/blob/92bdf02a90e61e9a2b20ffc1adf81671175fbdc5/cores/arduino/wiring_analog.c#L127-L135
The regulard Arduino API analogWrite would start a PWM output with some default parameters (e.g., PWM frequency, PWM resolution etc.) on that pin.
The functionality should be changed so that
analogWrite
also starts a PWM wave and friend functions for setting resolution and frequency should be added.Currently, PWM functionality is available via the
PWM
classhttps://github.com/CommunityGD32Cores/GD32Core-New/blob/92bdf02a90e61e9a2b20ffc1adf81671175fbdc5/libraries/pwm/examples/pwmoutput/pwmoutput.ino#L1-L11
(and is partly not working, see #4)
The DAC functionality should still be accessible of course -- it has to be thought to which API it should be moved, or if an "auto-detection" between PWM and DAC should be made.
The text was updated successfully, but these errors were encountered: