我见过的所有示例代码都通过轮询相应的寄存器来读取加速度和磁场值。
例如:
x.l = i2c_read(OUT_X_L_A);
x.h = i2c_read(OUT_X_H_A);
y.l = i2c_read(OUT_Y_L_A);
y.h = i2c_read(OUT_Y_H_A);
z.l = i2c_read(OUT_Z_L_A);
z.h = i2c_read(OUT_Z_H_A);
传感器何时更新寄存器值?我怎么知道何时读取寄存器?
我担心芯片可以在轮询OUT_X_L_A和OUT_X_L_H之间更新寄存器值,从而导致读取损坏。
谢谢,
特拉维斯
以上来自于谷歌翻译
以下为原文
All the example code I've seen reads the accelera
tion and magnetic field values by polling the appropriate registers.
For example:
x.l = i2c_read(OUT_X_L_A);
x.h = i2c_read(OUT_X_H_A);
y.l = i2c_read(OUT_Y_L_A);
y.h = i2c_read(OUT_Y_H_A);
z.l = i2c_read(OUT_Z_L_A);
z.h = i2c_read(OUT_Z_H_A);
When does the sensor update the register values? How do I know when to read the registers?
I am concerned that the chip could update the register value between polling the OUT_X_L_A and OUT_X_L_H, resulting in a corrupt reading.
Thanks,
Travis