https://uditagarwal.in/diy-generating-ramp-sawtooth-from-pwm/
DIY: Generating Ramp/Sawtooth from PWM