1.测试了QMI8658的驱动,正常读出x,y,z轴数据,得到的pitch, roll, yaw正常

This commit is contained in:
Misaki
2025-08-23 01:13:16 +08:00
parent 48c2757af6
commit 80cfbec7df
10 changed files with 594 additions and 3 deletions
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <stdint.h>
#include <string.h> // For memcpy
#include "esp_log.h"
#include "driver/gpio.h"
#include "driver/i2c.h"
/********************* I2C *********************/
#define I2C_SCL_IO 10 /*!< GPIO number used for I2C master clock */
#define I2C_SDA_IO 11 /*!< GPIO number used for I2C master data */
#define I2C_MASTER_NUM 0 /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */
#define I2C_MASTER_FREQ_HZ 400000 /*!< I2C master clock frequency */
#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */
#define I2C_MASTER_RX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */
#define I2C_MASTER_TIMEOUT_MS 1000
void I2C_Init(void);
// Reg addr is 8 bit
esp_err_t I2C_Write(uint8_t Driver_addr, uint8_t Reg_addr, const uint8_t *Reg_data, uint32_t Length);
esp_err_t I2C_Read(uint8_t Driver_addr, uint8_t Reg_addr, uint8_t *Reg_data, uint32_t Length);