applet.sensor.qmc5883p: initial implementation#1122
applet.sensor.qmc5883p: initial implementation#1122i-infra wants to merge 11 commits intoGlasgowEmbedded:mainfrom
Conversation
…883p magnetometer sensor (i2c @ 0x2C) - tested working with GY-271 breakout ie) https://www.aliexpress.us/item/2251832421287528.html. shoutout adafruit (referenced their libs)
whitequark
left a comment
There was a problem hiding this comment.
At a glance this looks great! The only issues I can see without closely looking through the functionality is ones that were already a problem in the codebase before you started working on your applet.
Please do the following in addition to inline comments:
- Add yourself to CODEOWNERS for this applet
- Add a documentation page at least for the CLI
- Add types to the
Interfaceclass (if this is something you would normally use in your code) - Document the
Interfaceclass and add an API documentation section to the documentation page (I will merge the applet without this but it is preferred to have API docs for new applets like this one)
|
Regarding code formatting, there is a Ruff configuration and a pre-commit file that invokes it, this configuration is the one appropriate for Glasgow source code. |
…, add docs, add types, switch to enums for parameters
whitequark
left a comment
There was a problem hiding this comment.
I did a rough pass (not a final one), looks better. By the way, I'm not sure why but "requesting review" from me on GitHub doesn't seem like it sends me an email; leaving a comment is the best way to get my attention.
…, add stub for rst autogen, add qmc5883 to index
|
I think it's good to go? Need to figure out legacy vs appletv2 stuff eventually, but check it out when you get a sec! Suspect it's approaching mergable. |
…nsupported interpolation
Oh I somehow missed that you were still using the legacy applet infrastructure. New legacy applets are a big "no", I've been trying to migrate all of them to the new infrastructure for months already. |
…'t use unsupported interpolation" This reverts commit fdab077 since AppletV1 is to be avoided at all costs
|
@whitequark I think this is good for re-review! |
|
Thanks, will take a look once I'm done with some urgent bureaucracy. |
| _CHIPID = 0x00 | ||
| _XOUT_LSB = 0x01 | ||
| _XOUT_MSB = 0x02 | ||
| _YOUT_LSB = 0x03 | ||
| _YOUT_MSB = 0x04 | ||
| _ZOUT_LSB = 0x05 | ||
| _ZOUT_MSB = 0x06 | ||
| _STATUS = 0x09 | ||
| _CONTROL1 = 0x0A | ||
| _CONTROL2 = 0x0B |
There was a problem hiding this comment.
Could you also use an enum here?
Also, generally I avoid making things such as "register enumerations" IntEnums unless there's a specific reason to do so; accidentally doing something like _XOUT_LSB + 1 (in a more complex code path) and getting a nonsense result hurts a lot when debugging.
There was a problem hiding this comment.
I think you're missing the enum here, unless it's intentional.
class Register(enum.Enum):
CHIPID = 0x00
XOUT_LSB = 0x01
...
|
This should be mergeable after the last review is addressed. |
|
Ah sorry, missed two really important points I stated elsewhere:
|
…st.py, move regmap to enum.Enum, keep reg addy constants as plain ints - addresses review by @whitequark
|
|
||
| .. module:: glasgow.applet.sensor.qmc5883p | ||
|
|
||
| .. autoexception:: QMC5883PError |
There was a problem hiding this comment.
I think you're missing a lot of the newly added enumerations (the ones that now get surfaced in the public API).
| _CHIPID = 0x00 | ||
| _XOUT_LSB = 0x01 | ||
| _XOUT_MSB = 0x02 | ||
| _YOUT_LSB = 0x03 | ||
| _YOUT_MSB = 0x04 | ||
| _ZOUT_LSB = 0x05 | ||
| _ZOUT_MSB = 0x06 | ||
| _STATUS = 0x09 | ||
| _CONTROL1 = 0x0A | ||
| _CONTROL2 = 0x0B |
There was a problem hiding this comment.
I think you're missing the enum here, unless it's intentional.
class Register(enum.Enum):
CHIPID = 0x00
XOUT_LSB = 0x01
...
Initial implementation for the qmc5883p magnetometer sensor - i2c @ 0x2C.
This code is tested working with the GY-271 breakout ie) https://www.aliexpress.us/item/2251832421287528.html.
Shoutout @adafruit (referenced their libs)
Datasheet for part @ https://www.qstcorp.com/upload/pdf/202512/2C939E5AA0704285BC3BE71132B8629B.pdf
PS: sending sm love to the glasgow team <3