i2c code deduplication