Implemented i2c device write function