Decode a 2-byte string as a 16-bit integer @param data byte array of size 2 that represents the integer @return decoded integer
(data)
| 69 | |
| 70 | |
| 71 | def decode_uint16(data): |
| 72 | """ |
| 73 | Decode a 2-byte string as a 16-bit integer |
| 74 | @param data byte array of size 2 that represents the integer |
| 75 | @return decoded integer |
| 76 | """ |
| 77 | #Byte arrays need to be converted into arrays to be unpackable by struct |
| 78 | if isinstance(data, bytearray): |
| 79 | data = array.array('B', data) |
| 80 | return struct.unpack('<H', data)[0] |
| 81 | |
| 82 | |
| 83 | def encode_axis(axis): |
nothing calls this directly
no outgoing calls
no test coverage detected