-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-volatile memory counter and flag refactor with unit tests #93
Conversation
… into hardware-abstraction-registers
Co-authored-by: Nate Gay <[email protected]>
… into hardware-abstraction-registers
@property | ||
def burnarm(self) -> bitFlag: | ||
return self.f_burnarm | ||
|
||
@burnarm.setter | ||
def burnarm(self, value: bitFlag) -> None: | ||
self.f_burnarm: bitFlag = value | ||
|
||
@property | ||
def burned(self) -> bitFlag: | ||
return self.f_burned | ||
|
||
@burned.setter | ||
def burned(self, value: bitFlag) -> None: | ||
self.f_burned: bitFlag = value | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers, these fns were unused. Instead of updating the flag implementations, we removed them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: All but nvm registers _BOOTCNT, _ERRORCNT, and _FLAG were removed due to not being able to find any further usage of them across the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked over all the changes and everything looks good.
Summary
This PR replaces the
bitflags
module with annvm
module that is designed to help with interactions with non-volatile memory (nvm) on the microcontroller. This change started with making a hardware abstraction layer for NVM interactions so we could write unit tests for thebitflags
module. Most of thebitflags.multibitflag
package was tested and working in e576ae8After getting that far, we worked to reduce the features implemented by the
multiBitFlag
class to only what the current version of the flight software uses. We ended up with a simpleCounter
class with two methodsget()
andincrement()
.Also we built a stub for
ByteArray
which is the interface definition used to back CircuitPython's NVM implementation. I have attempted to contribute this upstream: adafruit/Adafruit_CircuitPython_Typing#46Next @TaylorGilg converted the
bitFlag
class to a class namedFlag
which offers two methodsget()
andtoggle()
and added tests.Testing
Added unit tests
Tested on board