-
Notifications
You must be signed in to change notification settings - Fork 6
Add UID, Tag, Heartbeat and Version registers to core interface specification
#178
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
base: main
Are you sure you want to change the base?
Conversation
|
@glopesdev |
…on with detailed payload specifications
2e982ab to
d191d25
Compare
|
@bruno-f-cruz I will have a more in-depth look, but a first quick question is about the "deprecated" attribute. Is that part of the schema yet? I can't seem to find it anywhere. |
I targeted #154, assuming that it would get accepted. I can split in two, but some of the registers need to be deprecated in this PR anyway. |
@bruno-f-cruz I had a look and for this specific register it might be easier to leverage a custom converter and go for a simpler schema: Version:
address: 19
type: U8
length: 32
access: Event
payloadSpec:
ProtocolVersion:
offset: 0
interfaceType: HarpVersion
FirmwareVersion:
offset: 3
interfaceType: HarpVersion
HardwareVersion:
offset: 6
interfaceType: HarpVersion
SdkId:
offset: 9
interfaceType: string
InterfaceHash:
offset: 12
interfaceType: string
converter: RawPayloadThis generates the following payload type: public VersionPayload(
HarpVersion protocolVersion,
HarpVersion firmwareVersion,
HarpVersion hardwareVersion,
string sdkId,
string interfaceHash)
{
ProtocolVersion = protocolVersion;
FirmwareVersion = firmwareVersion;
HardwareVersion = hardwareVersion;
SdkId = sdkId;
InterfaceHash = interfaceHash;
}and the partial conversion stubs: private static partial VersionPayload ParsePayload(ArraySegment<byte> payload);
private static partial ArraySegment<byte> FormatPayload(VersionPayload value);The changes we would need to make this effective is to extend Later for harp-python we can have a custom converter as well. Since this is a well-defined core register there may be no need to overcomplicate the spec further since we can have control over the core packages. |
|
Sounds good to me. One small detail is whether the patch should be nullable or default to 0.
It sounds like we should consider making it 0? Or do you have a different interpretation? |
The This allows us to do version matching, where something with a version 1.0.x will match against both 1.0.0 and 1.0.1. To avoid breaking changes, the new member would have to be nullable. We can discuss pros and cons of this, but from what I experimented with in bonsai-rx/harp#103, adding |
|
Did not realize they were nullable. In that case it makes sense, sure! |
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.
@glopesdev I was looking at this deprecated spec again and wondering if we can make this generally more useful. Looking at pydantic's interface, they allow deprecated to be a null | string type. If null (default) the register would be deemed not deprecated; else, the register is deprecated with the string message. I think this would be quite a useful feature to potentially help surface these deprecated warnings to the regenerated code.
What do you think?
This PR updates the core.yml with the missing registers and bit fields.
UID,Tag,HeartbeatandVersionregistersR_TIMESTAMP_OFFSETfrom Device specification #113 , we deprecate thie register and remove its mention from the interfaceR_RESETregister