Factor out I2C register reading
Add licence