fix(control)!: unify response frame format#20
Open
rkuester wants to merge 3 commits into
Open
Conversation
Add response packet format for both success and error cases, per-command response payloads, the framing recovery mechanism, and the undocumented I2C SetFrequency (0x10) command.
Add an explicit status code byte to all responses and make the length field mean total packet length, matching commands. 1) There was no way to distinguish a success response from an error response on the wire. The error code occupied the same position as the first data byte. For example, an I2C read returning 0x10 was indistinguishable from a Timeout error, or a red LED response (R=0xFF) from an error with message. 2) The length field had different semantics depending on whether the response was success or error. Success used payload-only length while error used total packet length. A host parser could not use the length to frame a read without first knowing the response type. Both are resolved by giving every response a status code at byte 3: 0x00 for success, existing codes for errors. BREAKING CHANGE: response format adds a status byte at offset 3
The previous commit changed the response frame format. Bump the firmware version so the host can distinguish protocol versions via bcdDevice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an explicit status code byte to all responses and make the length field mean total packet length, matching commands.
There was no way to distinguish a success response from an error response on the wire. The error code occupied the same position as the first data byte.
The length field had different semantics depending on whether the response was success or error. Success used payload-only length while error used total packet length.
Both are resolved by giving every response a status code at byte 3: 0x00 for success, existing codes for errors.
Bumps firmware version to v5.1.0 so the host can distinguish protocol versions via bcdDevice.
BREAKING CHANGE: response format adds a status byte at offset 3