Created
August 26, 2015 16:08
-
-
Save gammy/148ea1898832776a99f0 to your computer and use it in GitHub Desktop.
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
for (uint32_t i = 0; i < byte_count; i += 2) | |
{ | |
uint8_t offset = i / 2; | |
unsigned char data_lo = rawdata[i + 1]; | |
unsigned char data_hi = rawdata[i]; | |
interimvalue[offset] = (1 << 0 ) * ((data_hi >> 0) & 0x1) + | |
(1 << 1 ) * ((data_hi >> 1) & 0x1) + | |
(1 << 2 ) * ((data_hi >> 2) & 0x1) + | |
(1 << 3 ) * ((data_hi >> 3) & 0x1) + | |
(1 << 4 ) * ((data_hi >> 4) & 0x1) + | |
(1 << 5 ) * ((data_hi >> 5) & 0x1) + | |
(1 << 6 ) * ((data_hi >> 6) & 0x1) + | |
(1 << 7 ) * ((data_hi >> 7) & 0x1) + | |
(1 << 8 ) * ((data_lo >> 0) & 0x1) + | |
(1 << 9 ) * ((data_lo >> 1) & 0x1) + | |
(1 << 10) * ((data_lo >> 2) & 0x1) - | |
(1 << 11) * ((data_lo >> 3) & 0x1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment