Skip to content

Instantly share code, notes, and snippets.

@patrickelectric
Created November 13, 2014 15:34
Show Gist options
  • Save patrickelectric/96298336806d4ab40778 to your computer and use it in GitHub Desktop.
Save patrickelectric/96298336806d4ab40778 to your computer and use it in GitHub Desktop.
// must be called in:
// slave tx event callback
// or after beginTransmission(address)
size_t TwoWire::write(const uint8_t *data, size_t quantity)
{
if(transmitting){
// in master transmitter mode
for(size_t i = 0; i < quantity; ++i){
write(data[i]);
}
}else{
// in slave send mode
// reply to master
twi_transmit(data, quantity);
}
return quantity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment