It has taken me some time to understand how to write a slave driver for this chip so here is a simple example. Every byte received is written to port D so that it can be seen, and when a stop condition is detected all pins on port D are toggled. Reading data from it returns the next value of an 8 bit counter.