# ICM42605 **Repository Path**: NackBT/icm42605 ## Basic Information - **Project Name**: ICM42605 - **Description**: 基于C++的 ICM42605库函数,高度封装,低耦合,使用I2C接口 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 1 - **Created**: 2022-03-13 - **Last Updated**: 2023-09-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: IMU, 飞控, 陀螺仪, ICM42605, stm32 ## README # ICM42605 #### 介绍 基于C++的 ICM42605库函数,高度封装,低耦合,使用I2C接口。 用户使用仅需重写WriteByte(),ReadByte(),delay_ms(),setI2C(); **_加速度计波形图_** ![输入图片说明](shot.png) **_陀螺仪波形图_** ![陀螺仪波形图](shot0.png) #### 软件架构 库函数(Public): -- setI2C() // 设置i2c句柄和icm42605的地址 -- getChipID() // 读取Who am I寄存器,返回ChipID -- reset() // 软复位icm42605 -- init() // 初始化函数,默认1000HZ 16g 2000dps -- init(ODR,ACCE_RANG,GYRO_RANG) // 初始化函数的重载函数 -- init(ACCE_RANG,GYRO_RANG) -- Updata() // 更新六轴数据,数据更新在imu.data里 #### 使用说明 1. 先设置I2C句柄 2. 检查ChipID (42605的ChipID为0x42),然后初始化 3. 调用Updata()读取数据 #### 初始化例程 icm42605 *imu = new icm42605; Serial.begin(&huart1); imu->setI2C(&hi2c1,ICM42605_ADDRESS); if (imu->getChipID() != 0x42) { Serial.print("IMU ERROR"); } Serial.print("IMU OK"); imu->init(); Serial.print("ACCE : \n"); Serial.print("X: %.2f\nY: %.2f\nZ: %.2f\n", imu->data->Acce[0],imu->data->Acce[1],imu->data->Acce[2]); HAL_Delay(50); Serial.print(" GYRO : \n"); Serial.print("X: %.2f\nY: %.2f\nZ: %.2f", imu->data->Gyro[0],imu->data->Gyro[1],imu->data->Gyro[2]); #### 参与贡献 1. Mr.C 开发 #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)