接前一篇文章:ICM20948 DMP代码详解(59)
上一回开始解析icm20948_set_fsr函数以及其中的inv_icm20948_set_fsr函数,本回继续。为了便于理解和回顾,再次贴出inv_icm20948_set_fsr函数源码,在EMD-Core\sources\Invn\Devices\Drivers\ICM20948\Icm20948Setup.c中,如下:
int inv_icm20948_set_fsr(struct inv_icm20948 * s, enum inv_icm20948_sensor sensor, const void * fsr)
{
int result = 0;
int * castedvalue = (int*) fsr;
if((sensor == INV_ICM20948_SENSOR_RAW_ACCELEROMETER) ||
(sensor == INV_ICM20948_SENSOR_ACCELEROMETER)){
enum mpu_accel_fs afsr;
if(*castedvalue == 2)
afsr = MPU_FS_2G;
else if(