Commit e6a77a1
committed
Add support for PowerSupplyInformation record in MultiRecord area
There was no nice way to represent 12-bit fields as FixedField-s because
the bits appear to be disjoint with the bit and byte orders that are
used: MSB first for bits, LSB first for bytes.
Here is an illustration of two fields, 4-bit field A and 12-bit field B,
where field A is located in the most significant bits of a little-endian
2-byte memory area:
B7 B6 B5 B4 B3 B2 B1 B0 A3 A2 A1 A0 B11 B10 B9 B8
I could not find any way to unpack A and B using bitstruct.
So, I had to resort to using _mergeBitfield=True.
That flag reverses the order of all bytes in a record, thus, converting
any multi-byte little-endian fields to big-endian. That way, the bytes
and bits have the same ordering and the sub-fields become contiguous:
A3 A2 A1 A0 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0
bitstruct can handle this bit order naturally.
As a result of using _mergeBitfield, bytes are defined in the opposite
order comparing to Table 18-1.1 parent cb2fc9f commit e6a77a1
1 file changed
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
33 | 92 | | |
34 | 93 | | |
35 | 94 | | |
| |||
0 commit comments