adkron / grovepi

Use the GrovePi in Elixir
Apache License 2.0
47 stars 9 forks source link

Simplify PCA9685 initialization and updates #32

Closed fhunleth closed 6 years ago

fhunleth commented 6 years ago

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:

fhunleth commented 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.

adkron commented 6 years ago

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.

adkron commented 6 years ago

Thanks, @fhunleth. 🤖 ❤️

adkron commented 6 years ago

Good catch on the rename!

fhunleth commented 6 years ago

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.

axelclark commented 6 years ago

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!