Make I2C API more generic, incorporate bvernoux changes.

Fix whitespace in other commits from 2-space to tabs.