Closed fhunleth closed 6 years ago
I have a few other changes in mind as well, but didn't want to step on any plans especially since I see that there's work going on with the tests. I did want to get in the "auto-increment" change, since I like how it makes the code and hopefully you'll like it too.
The PR looks good to me. It appears like I need to get a PivotPi so I can be testing this stuff out too. I'd like to see us get some types and documentation around these soon. Documentation is extra important for the GrovePi project since it is aimed at beginner hardware developers.
Thanks, @fhunleth. 🤖 ❤️
Good catch on the rename!
Yes - there's a bit that I wanted to add like docs, typespecs, and a few other things, but I didn't want to step on any in progress work.
Fwiw, I'm looking into the PivotPi for ElixirConf EU training as an option to add motors to the class. It seems like a really good deal except that it requires batteries and those batteries can't power the RPi. Anyway, I'll try to coordinate with everyone with my next set of updates, but I think those will be a while so don't wait for me.
The auto-increment change is really nice! I need to go back in the datasheet to see how it works. Also looking forward to seeing PivotPi included in the training. Servos give you a lot of new options!
The PCA9685 has an auto-increment mode (abbreviated AI) that lets you set multiple registers in one I2C transaction. If this is enabled, it's possible to update LEDs in one go with a properly constructed binary pattern. This made it possible to remove quite a few calculations and merge the "all LEDs" register setting code.
This also includes a couple other changes:
set_pwm_on
andset_pwm_off
to set the channels to 100% on or 100% off. This felt more obvious than callingset_pwm
with 0x1000.