I've been experimenting with using modern C++ to create a better way to access and modify registers.
Goals:
1. No #defines or macros
2. No special functions
3. Compiles down to code as efficient as writing it the "old" way
4. Reduce cut & paste errors
5. Single definitions and use for a given register, not the quadruplicate "mask, shift, apply" stuff
6. Access or modification is done with single or almost-single statements
7. Usable with bit-twiddling operations
8. Easy to use and read
9. Feels like its use is "out of the way" and without clutter
The repo (see src/main.cpp for some example use cases):
This is a work in progress and should be considered experimental. I'd love some feedback on whether I've truly achieved my goals. Please remember this is only a first go-around. I'm sure there's lots of room for improvement. Note that I've machine-checked (using Codex) the accuracy of all the values by comparing with NXP's SDK, but still, be cautious.
(@jmarsh, @luni: I'd love your input too.)
Other notes:
1. The Readme is not even close to being complete
Goals:
1. No #defines or macros
2. No special functions
3. Compiles down to code as efficient as writing it the "old" way
4. Reduce cut & paste errors
5. Single definitions and use for a given register, not the quadruplicate "mask, shift, apply" stuff
6. Access or modification is done with single or almost-single statements
7. Usable with bit-twiddling operations
8. Easy to use and read
9. Feels like its use is "out of the way" and without clutter
The repo (see src/main.cpp for some example use cases):
This is a work in progress and should be considered experimental. I'd love some feedback on whether I've truly achieved my goals. Please remember this is only a first go-around. I'm sure there's lots of room for improvement. Note that I've machine-checked (using Codex) the accuracy of all the values by comparing with NXP's SDK, but still, be cautious.
(@jmarsh, @luni: I'd love your input too.)
Other notes:
1. The Readme is not even close to being complete