Refactor out common code for sensors

There was a lot of duplicate code in the ADXL345, HMC5883L, and
ITG-3200 classes.  This commit pulls that common code out into the
SensorBase class from which the other classes derive.