resolved with the following function...
and obviously the creation of WordData in the struct.
uint8_t Talkie::getBits(uint8_t bits) {
uint8_t value = 0;
for (; bits; WordDataBit--, WordData >>= 1, bits--) {
value <<= 1; // NULL on first pass
if (!WordDataBit) { // regular byte rollover junk...
WordData = pgm_read_byte(WordDataPointer);
WordDataPointer++;
WordDataBit = 8;
}
value |= (WordData & 0x01); // OR a 1 into value if the MSB of WordData is set
}
return value;
}
resolved with the following function... and obviously the creation of WordData in the struct.
uint8_t Talkie::getBits(uint8_t bits) { uint8_t value = 0; for (; bits; WordDataBit--, WordData >>= 1, bits--) { value <<= 1; // NULL on first pass if (!WordDataBit) { // regular byte rollover junk...
WordData = pgm_read_byte(WordDataPointer); WordDataPointer++; WordDataBit = 8; } value |= (WordData & 0x01); // OR a 1 into value if the MSB of WordData is set
}
return value;
}