electro-smith / libDaisy

Hardware Library for the Daisy Audio Platform
https://www.electro-smith.com/daisy
MIT License
314 stars 131 forks source link

C++ GPIO #451

Closed stephenhensley closed 2 years ago

stephenhensley commented 2 years ago

This is essentially a duplicate of the work done in #354 except that it preserves the C-style GPIO API. Idea being that we'll add planned deprecation of the current usage without breaking any code. Some time next year we'll remove the old C style, but this will allow for a gradual replacement.

We'll need to go through and adapt the rest of the library to use the new Pin type instead of the old, dsy_gpio_pin, but it doesn't have to happen right away. We can do that as gradually as we need to. I've added an operator for a conversion to the old type. So the new struct can already be used anywhere that the old one was used without any other changes necessary.

List of changes:

These changes stage a few things for future removal. At some point likely Q2-Q3 of 2022 we'll do more substantial update that actually removes these old mechanics, and cleans up the library a bit.

For now we're trying to improve accessibility, and ease of use without breaking existing code.

github-actions[bot] commented 2 years ago

Unit Test Results

    1 files  ±0    16 suites  +1   0s :stopwatch: ±0s 145 tests +4  145 :heavy_check_mark: +4  0 :zzz: ±0  0 :x: ±0 

Results for commit e3a7d532. ± Comparison against base commit 2d3f3d00.

:recycle: This comment has been updated with latest results.

stephenhensley commented 2 years ago

Found something pretty funky: GPIOPort::PI is a big red flag because... well.. it's PI.. 🥧

So we'll loop back around on the naming -- leading contender for the port names now is PORTA, PORTI, etc.