Closed neildavis closed 1 year ago
Marking as 'draft' for now as tackling the second issue from my opening comment may lead to a major refactor. Feedback is still welcome though if anyone has the time and interest!
I think this is ready for review now. Thanks to @sago35 for pointing me at the TinyGo dev
branch which resolved my USB serial debugging issues on my Tiny2040, I was able to further investigate the AS5600's behavior around the interaction of setting ZPOS/MPOS/MANG. Whilst this logic is not particularly clear from the datasheet, and introduces a little more complexity than we'd like, I think it's best to handle this in the driver where I can document it rather than every client program struggling to deal with with it!
I made a few comments @neildavis but they are just coding style things. You obviously know a lot about these devices, thank you very much for working on this!
I made a few comments @neildavis but they are just coding style things. You obviously know a lot about these devices, thank you very much for working on this!
@deadprogram Many thanks for the review, and in particular the hint on avoiding allocs when returning errors. Great spot!
I've made all the suggested changes and rebased against latest dev
branch.
The research on this device is pretty impressive @neildavis thanks for all the work! Now merging.
Resolves #510. I think it's time to get some eyes on this :)
Issues I'd appreciate opinions on:
STATUS
for magnet position/strength,BURN
count limit logic) All device functionality is available via the lower-level register access methods, but should we wrap them all?An openTODO:
in theAngle(units AngleUnit)
method when the value is requested in degrees andMPOS
/MANG
have been set. See the comment in the method. Maybe just drop conversion to degrees from the driver and let the caller do it?