[讨论] (已解决)Sensor Tile 的源码中 传感器的ODR FS设置

wbhb2011   2017-1-21 20:30 楼主
          有哪位同学找到源码中 ODR FS的设置在哪? 代码太抽象看不懂~ 找了半天也找不到
1.bmp

回复评论 (3)

LSM6DSM_ACC_GYRO_driver_HL.c文件中的LSM6DSM_G_Init函数里设置

static DrvStatusTypeDef LSM6DSM_G_Init( DrvContextTypeDef *handle )

{

 

  GYRO_Data_t *pData = ( GYRO_Data_t * )handle->pData;

  LSM6DSM_G_Data_t *pComponentData = ( LSM6DSM_G_Data_t * )pData->pComponentData;

  LSM6DSM_Combo_Data_t *comboData = pComponentData->comboData;

 

  if ( LSM6DSM_Check_WhoAmI( handle ) == COMPONENT_ERROR )

  {

    return COMPONENT_ERROR;

  }

 

  /* Enable register address automatically incremented during a multiple byte

     access with a serial interface. */

  if ( LSM6DSM_ACC_GYRO_W_IF_Addr_Incr( (void *)handle, LSM6DSM_ACC_GYRO_IF_INC_ENABLED ) == MEMS_ERROR )

  {

    return COMPONENT_ERROR;

  }

 

  /* Enable BDU */

  if ( LSM6DSM_ACC_GYRO_W_BDU( (void *)handle, LSM6DSM_ACC_GYRO_BDU_BLOCK_UPDATE ) == MEMS_ERROR )

  {

    return COMPONENT_ERROR;

  }

 

  /* FIFO mode selection */

  if ( LSM6DSM_ACC_GYRO_W_FIFO_MODE( (void *)handle, LSM6DSM_ACC_GYRO_FIFO_MODE_BYPASS ) == MEMS_ERROR )

  {

    return COMPONENT_ERROR;

  }

 

  /* Select default output data rate. */

  pComponentData->Previous_ODR = 104.0f;

 

  /* Output data rate selection - power down */

  if ( LSM6DSM_ACC_GYRO_W_ODR_G( (void *)handle, LSM6DSM_ACC_GYRO_ODR_G_POWER_DOWN ) == MEMS_ERROR )

  {

    return COMPONENT_ERROR;

  }

 

  /* Full scale selection. */

  if ( LSM6DSM_G_Set_FS( handle, FS_HIGH ) == COMPONENT_ERROR )

  {

    return COMPONENT_ERROR;

  }

 

  comboData->isGyroInitialized = 1;

 

  handle->isInitialized = 1;

 

  return COMPONENT_OK;

}

 

 

虾扯蛋,蛋扯虾,虾扯蛋扯虾
点赞  2017-1-21 22:23
引用: littleshrimp 发表于 2017-1-21 22:23
在LSM6DSM_ACC_GYRO_driver_HL.c文件中的LSM6DSM_G_Init函数里设置



  
  static DrvStatusTyp ...

大神  驱动程序也都看懂了啊 牛 我现在底层没时间关注 工作中也都是应用协议层开发
点赞  2017-1-22 08:37
引用: littleshrimp 发表于 2017-1-21 22:23
在LSM6DSM_ACC_GYRO_driver_HL.c文件中的LSM6DSM_G_Init函数里设置



  
  static DrvStatusTyp ...

谢谢!~ 我还看了这个.c 擦肩而过.... 大神啊
点赞  2017-1-22 10:08
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复