toolchain: implemented corecode's i2c recommendations, fixed bugs

* Removed references to the glitch filter
* Changed the callback invocation
* Got rid of the i2c.h macros; too intransparent (and would break in
    loops)
* Replaced 'UNUSED' dummy read with a void cast, inspection of the
    generated assembly verifies that it does the right thing
* Created enum for read/write, clearer that way
* Invoke callback after everything else is done
* Removed a debug statement that I missed
* Little bit more code deduplication
* Misc style changes