
Think of control registers as banks of On/Off switches, which you turn on by setting a bit to 1 and turn off by setting that bit to 0. Most sensors change how they operate based on the values stored in control registers. The functions named with the i2c_ prefix should be generic enough to work with most I☬ sensors, but I’ll also be referring to a few specific cases to show how you might need to modify those basic functions. There are many kinds of registers but for this introduction I am going to group them into three general types: Control, Data and Status registers, and provide brief examples of code that you can use to work with each of them. Even if you’ve never worked with registers before, jrowberg’s visual grid layout makes it easy to see how the sensor’s memory is divided into sections, which are doing different things.
