Regmap WIP
Split i2c into separate module

This splits the i2c code into a separate module. i2c_machine is the core
machine, which shouldn't need to be modified in order to implement an
application. i2c_slave_defs can be used to define a slave address and
register map, which allows easy implementation of different slaves.

It also implements access control for i2c registers, allowing individual
bits to be either read-write or read-only.

The behaviour of the i2c state machine has been slightly modified, in
that after a read or write transaction completes the register pointer is
reset.

The application's main loop should call i2c_check_stop() to terminate
any i2c transactions. This will return non-zero if a write transaction
has finished, so that the application can deal with the new register
values.
Add some tests for the i2c slave code

This adds a test application for the i2c slave code. It uses i2c-dev to
interact with the slave from a linux host.
Switch to ADC polling instead of interrupt

Soak-testing with the test application found a problem whereby the clock
signal is corrupted if the ADC interrupt fires immediately before a
start condition.

As a workaround, this moves the ADC reads to the main loop which fixes
the problem. It also makes the stop condition detector more correct.
Implement some STATUS reg functionality

This implements some functionality for the bits in the status register
as described in the regmap file: RST, CMIE/CMIF/CMP, LED[1:0].

Still TODO: CAL.
Update CMIF description in regmap.md

This fixes the description of the CMIF bit in the STATUS register.