rewriting magnetometer driver code.