I've got most of the code I need for my current robot project working, so I've decided it's time for a release. Sources at https://github.com/mwm/Micropython-Drivers
Notes
I use my own pwm2 PWM driver rather than the common one, because I wanted to automate finding timers to use. For now, that expects to find the pins_af.py module created when the board is built. I'm hoping there's a better way, as Pin.af_list() returns the list of timers, but I haven't been able to get the associated channel. If someone has a way to do this, I'd love to hear it. Otherwise, at some point I'll write a script to generate a more compact/faster data structure from pins_af.py. This also allows "timed change" of the PWM pulse width to support Servo & motor drivers with acceleration.
The HCSR04 driver is interrupt driven so you can do ranging operations in the background, though it doesn't time out yet.
There's a generic h-bridge diver supporting both the common direction/speed control mechanism, plus a couple of direct control mechanisms if you want to use them. I've made them work so that the direction remains the same using a TI DRV8835 driver which has both modes, but I'm not sure that's true for other chips.
I have some stepper motors to play with adding support for those, but I need to finish building the hardware, and have major surgery next Tuesday which will probably leave me unable to do much for a month or two, so who knows.
Some robotic device drivers
Re: Some robotic device drivers
I think there is machine.PWM that gives you much simpler interface.
Re: Some robotic device drivers
Machine.PWM is only available for the ESP8266, at least in the source tree I have (post 1.9.2) and the docs. It's not at all clear the interface is simpler, but it is clear that it's missing features that other drivers depend on, in particular the ability to specify a timed change in the pulse.
From looking at the sources, it seems that the ESP8266 hardware used to generate PWM is different from the STM32 hardware, I don't have an ESP8266, so can't test it, and have never tried building µpython for one. And that fails with lib/axtls/config not being around.
From looking at the sources, it seems that the ESP8266 hardware used to generate PWM is different from the STM32 hardware, I don't have an ESP8266, so can't test it, and have never tried building µpython for one. And that fails with lib/axtls/config not being around.