Skip to content

Instantly share code, notes, and snippets.

@mroger
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroger/46804aa3053a62ba9d21 to your computer and use it in GitHub Desktop.
Save mroger/46804aa3053a62ba9d21 to your computer and use it in GitHub Desktop.
Shows how to update transmission data after status bytes are read in reception_data
void TEA5767N::loadFrequency() {
readStatus();
transmission_data[FIRST_DATA] = (transmission_data[FIRST_DATA] & 0xC0) | (reception_data[FIRST_DATA] & 0x3F);
transmission_data[SECOND_DATA] = reception_data[SECOND_DATA];
}
void TEA5767N::readStatus() {
Wire.requestFrom (TEA5767_I2C_ADDRESS, 5);
if (Wire.available ()) {
for (int i = 0; i < 5; i++) {
reception_data[i] = Wire.read();
}
}
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment