- // add raw to bitarray
- num_to_bytebits(raw, 64, data);
-
- // add crc to bitarray
- num_to_bytebits(crc, 16, data+64);
-
- // add extended data to bitarray
- num_to_bytebits(extended, 24, data+64+16);
-
- //reverse array
- printf("ICE:\n %s\n", sprint_bin(data, 104) );
- for (uint8_t i = 0; i <104/2; ++i) {
- uint8_t tmp = data[i];
- data[i] = data[104-i];
- data[104-i] = tmp;
- }
- printf("ICE:\n %s\n", sprint_bin(data, 104) );
-
- // add parity always EVEN (2), every 8bits
- // into output array
- uint8_t bitlen = addParity(data, bits+11, 104, 9, 2);
- if (bitlen != 117 )
- printf("ICE ERROR PARITY BITLEN 119 != %d\n", bitlen);
-