The MicroPython firmware are available for many microcontroller-ESP based built. You will see several firmware on the list.
The basic question here is how to pass a MicroPython object to a C function in a custom C module. In this case a PWM object.