Skip to content

Instantly share code, notes, and snippets.

@devyte
Last active November 15, 2019 02:40
Show Gist options
  • Save devyte/799c14d9dc5687d1eb722cde985d0269 to your computer and use it in GitHub Desktop.
Save devyte/799c14d9dc5687d1eb722cde985d0269 to your computer and use it in GitHub Desktop.
i2c_slave.cpp
void SDAcallback(void) __attribute__((weak));
void SDAcallback(void)
{
//weak functiom, used only whwn pure-master case is used. When slave is linked in, this function
//gets replaced by a strong-attributed one that is empty.
//Master collision detection logic goes here
//...
}
void SDAcallback(void)
{
//strong function, empty of code
//replaces weak function in master to remove it for slave case.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment