You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use packed_struct to implement this protocol. Unfortunately it uses split integers. By that I mean an integer which is derived by concatenating multiple bit sequences together. For example, the subprotocol is the number one gets by the following expression: (buf[0] & 1)<<5 | (buf[1] & 0b11111) | (buf[26] & 0b11000000). Is it possible to make this work in packed_struct with reasonable effort?
Edit: Actually flipping bits would be useful as well, but there is ways to work around it.
The text was updated successfully, but these errors were encountered:
This seems like a very niche problem, if there are more protocols like this in the wild (I've never encountered one) then I might be interested in this. Internally, all of the fields are represented by bits ranges (from bit 0 to bit 7, for instance), so that would need to be rewritten into a list-of-ranges-or-bits structure.
For your use case, I'd define three fields with smaller bit widths, then simply implement a method on the structure to either set or get the final value from these three small integers.
Garmin's ANT+ Environment Profile also suffers from this problem, I think it was more of a design error though because I have yet to see it any other profile and I have read probably half of them
I want to use packed_struct to implement this protocol. Unfortunately it uses split integers. By that I mean an integer which is derived by concatenating multiple bit sequences together. For example, the subprotocol is the number one gets by the following expression:
(buf[0] & 1)<<5 | (buf[1] & 0b11111) | (buf[26] & 0b11000000)
. Is it possible to make this work in packed_struct with reasonable effort?Edit: Actually flipping bits would be useful as well, but there is ways to work around it.
The text was updated successfully, but these errors were encountered: