本帖最后由 电子烂人 于 2024-6-21 01:44 编辑
继续回来更新:
生成代码后会发现,根目录多了一个x-cube-mems1的文件夹,里面包含几种传感器
先来介绍下这三个代码文件的含义:
1.Custom_mems_conf_app.h:这里面包含了传感器的几种参数,如量程、速度等;
#ifdef USE_CUSTOM_MOTION_SENSOR_LSM6DSO_0
#if (USE_CUSTOM_MOTION_SENSOR_LSM6DSO_0 == 1)
#ifndef CUSTOM_ACC_INSTANCE_0
#define CUSTOM_ACC_INSTANCE_0 CUSTOM_LSM6DSO_0
#define CUSTOM_ACC_INSTANCE_NAME_0 "LSM6DSO"
#define CUSTOM_ACC_INSTANCE_ODR_0 {10, 12.5, 26, 52, 104, 208, 417, 833, 1667, 3333, 6667} /* Hz */
#define CUSTOM_ACC_INSTANCE_FS_0 {4, 2, 4, 8, 16} /* g */
#ifndef ACC_GYR_UNICLEO_ID
#define ACC_GYR_UNICLEO_ID LSM6DSO_UNICLEO_ID
#endif
#endif
#ifndef CUSTOM_GYR_INSTANCE_0
#define CUSTOM_GYR_INSTANCE_0 CUSTOM_LSM6DSO_0
#define CUSTOM_GYR_INSTANCE_NAME_0 "LSM6DSO"
#define CUSTOM_GYR_INSTANCE_ODR_0 {10, 12.5, 26, 52, 104, 208, 417, 833, 1667, 3333, 6667} /* Hz */
#define CUSTOM_GYR_INSTANCE_FS_0 {5, 125, 250, 500, 1000, 2000} /* dps */
#ifndef ACC_GYR_UNICLEO_ID
#define ACC_GYR_UNICLEO_ID LSM6DSO_UNICLEO_ID
#endif
#endif
#endif
#endif
2. Custom_mems_conf.h:这里面包含着传感器的初始化、读取写入等指令操作
#define USE_CUSTOM_MOTION_SENSOR_LSM6DSO_0 0U
#define CUSTOM_LSM6DSO_0_I2C_Init BSP_I2C1_Init
#define CUSTOM_LSM6DSO_0_I2C_DeInit BSP_I2C1_DeInit
#define CUSTOM_LSM6DSO_0_I2C_ReadReg BSP_I2C1_ReadReg
#define CUSTOM_LSM6DSO_0_I2C_WriteReg BSP_I2C1_WriteReg
#ifdef __cplusplus
}
#endif
3.sensor_unicleo.h:这里面包含着诸多传感器的UNICLEO_ID,用于 Unicleo-GUI 应用程序区分诸多传感器。
#define LSM6DSO_UNICLEO_ID 7
|