i2c state machine (not finished)