Skip to content

Commit

Permalink
optimize imu header file
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Oct 17, 2024
1 parent 66958c0 commit 827850f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions components/ext_dev/include/maix_imu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace maix::ext_dev::imu {
* @brief imu mode
* @maixpy maix.ext_dev.imu.Mode
*/
enum Mode {
enum class Mode {
ACC_ONLY = 0,
GYRO_ONLY,
DUAL
Expand All @@ -27,7 +27,7 @@ enum Mode {
* @brief imu acc scale
* @maixpy maix.ext_dev.imu.AccScale
*/
enum AccScale {
enum class AccScale {
ACC_SCALE_2G = 0,
ACC_SCALE_4G,
ACC_SCALE_8G,
Expand All @@ -38,7 +38,7 @@ enum AccScale {
* @brief imu acc output data rate
* @maixpy maix.ext_dev.imu.AccOdr
*/
enum AccOdr {
enum class AccOdr {
ACC_ODR_8000, // Accelerometer ODR set to 8000 Hz.
ACC_ODR_4000, // Accelerometer ODR set to 4000 Hz.
ACC_ODR_2000, // Accelerometer ODR set to 2000 Hz.
Expand All @@ -58,7 +58,7 @@ enum AccOdr {
* @brief imu gyro scale
* @maixpy maix.ext_dev.imu.GyroScale
*/
enum GyroScale {
enum class GyroScale {
GYRO_SCALE_16DPS = 0, // Gyroscope scale set to ±16 degrees per second.
GYRO_SCALE_32DPS, // Gyroscope scale set to ±32 degrees per second.
GYRO_SCALE_64DPS, // Gyroscope scale set to ±64 degrees per second.
Expand All @@ -73,7 +73,7 @@ enum GyroScale {
* @brief imu gyro output data rate
* @maixpy maix.ext_dev.imu.GyroOdr
*/
enum GyroOdr {
enum class GyroOdr {
GYRO_ODR_8000, // Gyroscope ODR set to 8000 Hz.
GYRO_ODR_4000, // Gyroscope ODR set to 4000 Hz.
GYRO_ODR_2000, // Gyroscope ODR set to 2000 Hz.
Expand Down
10 changes: 5 additions & 5 deletions examples/encode_demo/main/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ static void *_imu_thread_process(void *arg) {

// qmi init
ext_dev::qmi8658::QMI8658 qmi8658(4, 0x6B, 400000,
maix::ext_dev::qmi8658::Mode::DUAL,
maix::ext_dev::qmi8658::AccScale::ACC_SCALE_16G,
maix::ext_dev::qmi8658::AccOdr::ACC_ODR_8000,
maix::ext_dev::qmi8658::GyroScale::GYRO_SCALE_1024DPS,
maix::ext_dev::qmi8658::GyroOdr::GYRO_ODR_8000);
maix::ext_dev::imu::Mode::DUAL,
maix::ext_dev::imu::AccScale::ACC_SCALE_16G,
maix::ext_dev::imu::AccOdr::ACC_ODR_8000,
maix::ext_dev::imu::GyroScale::GYRO_SCALE_1024DPS,
maix::ext_dev::imu::GyroOdr::GYRO_ODR_8000);
time::sleep_ms(1000);
// bias init
float gyro_x_bias = 0, gyro_y_bias = 0, gyro_z_bias = 0;
Expand Down

0 comments on commit 827850f

Please sign in to comment.