Skip to content

Commit bbd171a

Browse files
authored
feat(qmi8658): Add QMI8658 6-axis IMU component (#473)
* feat(qmi8658): Add QMI8658 6-axis IMU component * remove unused * readme: update * add missing format cases
1 parent d5000e7 commit bbd171a

17 files changed

+1206
-0
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ jobs:
144144
target: esp32s3
145145
- path: 'components/pid/example'
146146
target: esp32
147+
- path: 'components/qmi8658/example'
148+
target: esp32s3
147149
- path: 'components/qtpy/example'
148150
target: esp32
149151
- path: 'components/qtpy/example'

.github/workflows/upload_components.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
components/neopixel
9090
components/nvs
9191
components/pid
92+
components/qmi8658
9293
components/qtpy
9394
components/qwiicnes
9495
components/rmt

components/qmi8658/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
idf_component_register(
2+
INCLUDE_DIRS "include"
3+
REQUIRES "base_peripheral" "math"
4+
)

components/qmi8658/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# QMI8658 Example
2+
3+
[![Badge](https://components.espressif.com/components/espp/qmi8658/badge.svg)](https://components.espressif.com/components/espp/qmi8658)
4+
5+
The `Qmi8658` component provides a driver for the QMI8658 6-Axis
6+
Inertial Measurement Units (IMUs).
7+
8+
It supports configuring and reading:
9+
* 3-axis acceleration data
10+
* 3-axis gyroscope data
11+
12+
It also supports providing a filter function for computing orientation data from
13+
the raw sensor data.
14+
15+
## Example
16+
17+
The [example](./example) shows how to use the `espp::Qmi8658` component to initialize and
18+
communicate with an QMI8658 6-axis IMU.
19+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The following lines of boilerplate have to be in your project's CMakeLists
2+
# in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.20)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
7+
# add the component directories that we want to use
8+
set(EXTRA_COMPONENT_DIRS
9+
"../../../components/"
10+
)
11+
12+
set(
13+
COMPONENTS
14+
"main esptool_py i2c qmi8658 filters"
15+
CACHE STRING
16+
"List of components to include"
17+
)
18+
19+
project(qmi8658_example)
20+
21+
set(CMAKE_CXX_STANDARD 20)

components/qmi8658/example/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# QMI8658 Example
2+
3+
This example shows how to use the `espp::Qmi8658` component to initialize and
4+
communicate with an QMI8658 6-axis IMU.
5+
6+
<img width="3952" height="2247" alt="CleanShot 2025-07-12 at 18 18 49" src="https://github.com/user-attachments/assets/d9e09dae-2568-46c5-b500-104714704e4c" />
7+
8+
## How to use example
9+
10+
### Hardware Required
11+
12+
This example is designed to run on a custom board with a QMI8658 IMU.
13+
You will need to configure the I2C pins for your specific hardware.
14+
15+
### Build and Flash
16+
17+
Build the project and flash it to the board, then run monitor tool to view
18+
serial output:
19+
20+
```
21+
idf.py -p PORT flash monitor
22+
```
23+
24+
(Replace PORT with the name of the serial port to use.)
25+
26+
(To exit the serial monitor, type ``Ctrl-]``.)
27+
28+
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
29+
30+
## Example Output
31+
32+
<img width="2032" height="1179" alt="CleanShot 2025-07-12 at 18 19 39" src="https://github.com/user-attachments/assets/b8c1ebb2-8516-4d22-a36e-3cc56cbf3f63" />
33+
34+
```console
35+
I (304) main_task: Calling app_main()
36+
[QMI8658 Example/I][0.035]: Starting example!
37+
[QMI8658 Example/I][0.041]: Creating IMU
38+
% Time (s), Accel X (m/s^2), Accel Y (m/s^2), Accel Z (m/s^2), Gyro X (rad/s), Gyro Y (rad/s), Gyro Z (rad/s), Temp (C), Kalman Roll (rad), Kalman Pitch (rad), Kalman Yaw (rad), Kalman Gravity X, Kalman Gravity Y, Kalman Gravity Z, Madgwick Roll (rad), Madgwick Pitch (rad), Magwick Yaw (rad), Madgwick Gravity X, Madgwick Gravity Y, Madgwick Gravity Z
39+
[QMI8658 Example/I][0.075]: Starting IMU task
40+
0.091,0.969,0.141,0.069,0.984,-1.484,0.891,38.6,1.115,-1.409,0.000,-0.987,-0.144,-0.071,0.000,-0.000,0.000,-0.000,-0.000,-1.000
41+
0.104,0.983,0.141,0.072,1.359,-1.969,0.953,38.6,1.099,-1.412,0.000,-0.987,-0.141,-0.072,0.001,-0.003,0.000,-0.003,-0.001,-1.000
42+
0.117,0.990,0.140,0.069,1.078,-2.812,1.047,38.6,1.115,-1.414,0.000,-0.988,-0.140,-0.069,0.001,-0.006,0.000,-0.006,-0.001,-1.000
43+
0.130,0.979,0.143,0.068,0.750,-0.984,0.625,38.6,1.129,-1.411,0.000,-0.987,-0.144,-0.068,0.002,-0.009,0.001,-0.009,-0.002,-1.000
44+
0.143,0.966,0.146,0.070,0.656,0.906,-0.312,38.6,1.122,-1.405,0.000,-0.986,-0.149,-0.072,0.002,-0.011,0.001,-0.011,-0.002,-1.000
45+
0.156,0.957,0.146,0.073,0.562,1.031,-0.828,38.6,1.107,-1.401,0.000,-0.986,-0.151,-0.075,0.003,-0.014,0.000,-0.014,-0.003,-1.000
46+
0.169,0.965,0.144,0.075,1.297,-2.125,1.016,38.6,1.089,-1.404,0.000,-0.986,-0.147,-0.077,0.004,-0.017,0.001,-0.017,-0.004,-1.000
47+
0.182,0.979,0.142,0.068,1.750,-5.609,3.156,38.6,1.125,-1.411,0.000,-0.987,-0.143,-0.069,0.004,-0.021,0.001,-0.021,-0.004,-1.000
48+
0.195,0.985,0.137,0.063,1.859,-6.734,4.016,38.6,1.139,-1.418,0.000,-0.988,-0.138,-0.064,0.005,-0.025,0.002,-0.025,-0.005,-1.000
49+
0.208,0.979,0.135,0.057,1.281,-3.359,2.359,38.6,1.170,-1.422,0.000,-0.989,-0.137,-0.058,0.006,-0.028,0.003,-0.028,-0.006,-1.000
50+
0.221,0.969,0.137,0.059,0.203,2.172,-0.594,38.6,1.163,-1.418,0.000,-0.988,-0.140,-0.061,0.006,-0.030,0.003,-0.030,-0.006,-1.000
51+
0.234,0.960,0.139,0.065,-0.109,5.188,-2.547,38.6,1.133,-1.413,0.000,-0.988,-0.143,-0.067,0.006,-0.031,0.002,-0.031,-0.006,-0.999
52+
0.247,0.965,0.142,0.074,0.125,4.453,-3.250,38.6,1.091,-1.406,0.000,-0.987,-0.145,-0.076,0.007,-0.033,0.001,-0.033,-0.007,-0.999
53+
0.260,0.981,0.145,0.074,1.000,0.812,-0.594,38.6,1.098,-1.407,0.000,-0.987,-0.146,-0.074,0.008,-0.035,0.001,-0.035,-0.008,-0.999
54+
0.273,0.990,0.146,0.075,1.266,-3.250,1.234,38.6,1.095,-1.407,0.000,-0.987,-0.145,-0.075,0.008,-0.039,0.001,-0.039,-0.008,-0.999
55+
0.286,0.986,0.146,0.072,1.125,-2.641,1.500,38.6,1.110,-1.407,0.000,-0.987,-0.146,-0.072,0.009,-0.042,0.002,-0.042,-0.009,-0.999
56+
0.299,0.973,0.147,0.073,0.531,-0.516,0.031,38.6,1.111,-1.404,0.000,-0.986,-0.149,-0.074,0.009,-0.045,0.002,-0.044,-0.009,-0.999
57+
0.312,0.965,0.146,0.073,0.188,1.625,-0.812,38.6,1.110,-1.403,0.000,-0.986,-0.150,-0.074,0.010,-0.047,0.001,-0.047,-0.010,-0.999
58+
0.325,0.965,0.146,0.076,0.594,0.359,-0.500,38.6,1.089,-1.402,0.000,-0.986,-0.149,-0.078,0.010,-0.049,0.001,-0.049,-0.010,-0.999
59+
0.338,0.972,0.145,0.076,1.328,-3.547,1.969,38.6,1.088,-1.404,0.000,-0.986,-0.147,-0.077,0.011,-0.053,0.002,-0.053,-0.011,-0.999
60+
0.351,0.976,0.142,0.070,1.750,-5.719,3.656,38.6,1.115,-1.410,0.000,-0.987,-0.144,-0.070,0.012,-0.056,0.003,-0.056,-0.012,-0.998
61+
0.364,0.979,0.138,0.066,1.656,-5.156,3.219,38.6,1.123,-1.415,0.000,-0.988,-0.140,-0.067,0.012,-0.060,0.003,-0.060,-0.012,-0.998
62+
0.377,0.980,0.137,0.063,1.203,-2.859,1.109,38.6,1.141,-1.418,0.000,-0.988,-0.138,-0.063,0.013,-0.063,0.003,-0.063,-0.013,-0.998
63+
0.390,0.978,0.141,0.061,0.891,-0.547,-3.969,38.6,1.161,-1.415,0.000,-0.988,-0.143,-0.062,0.014,-0.066,0.002,-0.066,-0.014,-0.998
64+
0.403,0.973,0.144,0.064,-0.062,2.141,-1.172,38.6,1.150,-1.410,0.000,-0.987,-0.146,-0.065,0.014,-0.068,0.002,-0.068,-0.014,-0.998
65+
0.416,0.972,0.145,0.073,0.516,3.078,-1.188,38.6,1.104,-1.405,0.000,-0.986,-0.147,-0.074,0.015,-0.070,0.002,-0.070,-0.014,-0.997
66+
0.429,0.969,0.148,0.076,0.594,0.828,-0.500,38.6,1.095,-1.400,0.000,-0.986,-0.151,-0.078,0.015,-0.072,0.002,-0.072,-0.015,-0.997
67+
0.442,0.969,0.145,0.075,1.094,-2.031,1.484,38.6,1.090,-1.404,0.000,-0.986,-0.147,-0.077,0.016,-0.075,0.002,-0.075,-0.016,-0.997
68+
0.455,0.968,0.141,0.073,1.656,-5.109,3.062,38.6,1.095,-1.409,0.000,-0.987,-0.144,-0.074,0.016,-0.079,0.003,-0.079,-0.016,-0.997
69+
0.468,0.972,0.139,0.066,2.234,-6.969,4.094,38.6,1.130,-1.414,0.000,-0.988,-0.141,-0.067,0.017,-0.083,0.004,-0.083,-0.017,-0.996
70+
0.481,0.977,0.136,0.056,1.859,-5.938,3.375,38.6,1.179,-1.421,0.000,-0.989,-0.138,-0.057,0.018,-0.087,0.004,-0.087,-0.018,-0.996
71+
0.494,0.982,0.137,0.055,1.078,-1.797,1.328,38.6,1.190,-1.422,0.000,-0.989,-0.138,-0.055,0.018,-0.090,0.005,-0.090,-0.018,-0.996
72+
0.507,0.978,0.137,0.060,0.141,4.328,-2.516,38.6,1.159,-1.419,0.000,-0.989,-0.138,-0.060,0.019,-0.092,0.004,-0.092,-0.019,-0.996
73+
0.520,0.969,0.142,0.071,-0.781,8.203,-4.453,38.6,1.106,-1.409,0.000,-0.987,-0.144,-0.072,0.019,-0.092,0.003,-0.092,-0.019,-0.996
74+
0.533,0.968,0.148,0.084,-0.656,7.719,-3.906,38.6,1.057,-1.397,0.000,-0.985,-0.151,-0.085,0.020,-0.093,0.002,-0.093,-0.019,-0.995
75+
0.546,0.971,0.150,0.088,0.844,0.750,-1.594,38.6,1.042,-1.394,0.000,-0.984,-0.152,-0.089,0.020,-0.095,0.002,-0.095,-0.020,-0.995
76+
0.559,0.980,0.154,0.086,1.969,-5.188,1.484,38.6,1.059,-1.393,0.000,-0.984,-0.154,-0.087,0.021,-0.099,0.002,-0.099,-0.021,-0.995
77+
0.572,0.977,0.150,0.073,2.562,-9.938,5.984,38.6,1.121,-1.401,0.000,-0.986,-0.152,-0.073,0.022,-0.104,0.003,-0.104,-0.022,-0.994
78+
0.585,0.970,0.141,0.064,2.391,-9.188,6.594,38.6,1.141,-1.412,0.000,-0.987,-0.144,-0.066,0.023,-0.109,0.005,-0.108,-0.022,-0.994
79+
0.598,0.969,0.135,0.059,1.562,-4.500,3.219,38.6,1.157,-1.420,0.000,-0.989,-0.138,-0.061,0.023,-0.112,0.005,-0.112,-0.023,-0.993
80+
0.611,0.974,0.135,0.058,0.672,-0.047,-0.219,38.6,1.167,-1.421,0.000,-0.989,-0.138,-0.059,0.024,-0.115,0.005,-0.115,-0.024,-0.993
81+
```
82+
83+
Running with `esp-cpp/uart-serial-plotter`:
84+
<img width="3952" height="2247" alt="CleanShot 2025-07-12 at 18 18 49" src="https://github.com/user-attachments/assets/d9e09dae-2568-46c5-b500-104714704e4c" />
85+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
idf_component_register(SRC_DIRS "."
2+
INCLUDE_DIRS ".")
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
menu "Example Configuration"
2+
3+
choice EXAMPLE_HARDWARE
4+
prompt "Hardware"
5+
default EXAMPLE_HARDWARE_ESP_BOX
6+
help
7+
Select the hardware to run this example on.
8+
9+
config EXAMPLE_HARDWARE_ESP_BOX
10+
depends on IDF_TARGET_ESP32S3
11+
bool "ESP32-S3-BOX or ESP32-S3-BOX-3"
12+
13+
config EXAMPLE_HARDWARE_CUSTOM
14+
bool "Custom"
15+
endchoice
16+
17+
config EXAMPLE_I2C_SCL_GPIO
18+
int "SCL GPIO Num"
19+
range 0 50
20+
default 18 if EXAMPLE_HARDWARE_ESP_BOX
21+
default 19 if EXAMPLE_HARDWARE_CUSTOM
22+
help
23+
GPIO number for I2C Master clock line.
24+
25+
config EXAMPLE_I2C_SDA_GPIO
26+
int "SDA GPIO Num"
27+
range 0 50
28+
default 8 if EXAMPLE_HARDWARE_ESP_BOX
29+
default 22 if EXAMPLE_HARDWARE_CUSTOM
30+
help
31+
GPIO number for I2C Master data line.
32+
33+
config EXAMPLE_I2C_CLOCK_SPEED_HZ
34+
int "I2C Clock Speed"
35+
range 100 1000000
36+
default 400000
37+
help
38+
I2C clock speed in Hz.
39+
40+
endmenu
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#include <chrono>
2+
#include <vector>
3+
4+
#include "i2c.hpp"
5+
#include "kalman_filter.hpp"
6+
#include "madgwick_filter.hpp"
7+
#include "qmi8658.hpp"
8+
9+
using namespace std::chrono_literals;
10+
11+
extern "C" void app_main(void) {
12+
espp::Logger logger({.tag = "QMI8658 Example", .level = espp::Logger::Verbosity::INFO});
13+
logger.info("Starting example!");
14+
15+
//! [qmi8658 example]
16+
using Imu = espp::Qmi8658<espp::qmi8658::Interface::I2C>;
17+
18+
// make the i2c we'll use to communicate
19+
static constexpr auto i2c_port = I2C_NUM_0;
20+
static constexpr auto i2c_clock_speed = CONFIG_EXAMPLE_I2C_CLOCK_SPEED_HZ;
21+
static constexpr gpio_num_t i2c_sda = (gpio_num_t)CONFIG_EXAMPLE_I2C_SDA_GPIO;
22+
static constexpr gpio_num_t i2c_scl = (gpio_num_t)CONFIG_EXAMPLE_I2C_SCL_GPIO;
23+
espp::I2c i2c({.port = i2c_port,
24+
.sda_io_num = i2c_sda,
25+
.scl_io_num = i2c_scl,
26+
.sda_pullup_en = GPIO_PULLUP_ENABLE,
27+
.scl_pullup_en = GPIO_PULLUP_ENABLE,
28+
.clk_speed = i2c_clock_speed});
29+
30+
// make the orientation filter to compute orientation from accel + gyro
31+
static constexpr float angle_noise = 0.001f;
32+
static constexpr float rate_noise = 0.1f;
33+
static espp::KalmanFilter<2> kf;
34+
kf.set_process_noise(rate_noise);
35+
kf.set_measurement_noise(angle_noise);
36+
auto kalman_filter_fn = [](float dt, const Imu::Value &accel,
37+
const Imu::Value &gyro) -> Imu::Value {
38+
// Apply Kalman filter
39+
float accelRoll = atan2(accel.y, accel.z);
40+
float accelPitch = atan2(-accel.x, sqrt(accel.y * accel.y + accel.z * accel.z));
41+
kf.predict({espp::deg_to_rad(gyro.x), espp::deg_to_rad(gyro.y)}, dt);
42+
kf.update({accelRoll, accelPitch});
43+
float roll, pitch;
44+
std::tie(roll, pitch) = kf.get_state();
45+
// return the computed orientation
46+
Imu::Value orientation{};
47+
orientation.roll = roll;
48+
orientation.pitch = pitch;
49+
orientation.yaw = 0.0f;
50+
return orientation;
51+
};
52+
53+
static constexpr float beta = 0.1f;
54+
static espp::MadgwickFilter madgwick(beta);
55+
auto madgwick_filter_fn = [](float dt, const Imu::Value &accel,
56+
const Imu::Value &gyro) -> Imu::Value {
57+
// Apply Madgwick filter
58+
madgwick.update(dt, accel.x, accel.y, accel.z, espp::deg_to_rad(gyro.x),
59+
espp::deg_to_rad(gyro.y), espp::deg_to_rad(gyro.z));
60+
float roll, pitch, yaw;
61+
madgwick.get_euler(roll, pitch, yaw);
62+
// return the computed orientation
63+
Imu::Value orientation{};
64+
orientation.pitch = espp::deg_to_rad(pitch);
65+
orientation.roll = espp::deg_to_rad(roll);
66+
orientation.yaw = espp::deg_to_rad(yaw);
67+
return orientation;
68+
};
69+
70+
// make the IMU config
71+
Imu::Config config{
72+
.device_address = Imu::DEFAULT_ADDRESS,
73+
.write = std::bind(&espp::I2c::write, &i2c, std::placeholders::_1, std::placeholders::_2,
74+
std::placeholders::_3),
75+
.read = std::bind(&espp::I2c::read, &i2c, std::placeholders::_1, std::placeholders::_2,
76+
std::placeholders::_3),
77+
.imu_config =
78+
{
79+
.accelerometer_range = Imu::AccelerometerRange::RANGE_8G,
80+
.accelerometer_odr = Imu::ODR::ODR_250_HZ,
81+
.gyroscope_range = Imu::GyroscopeRange::RANGE_512_DPS,
82+
.gyroscope_odr = Imu::ODR::ODR_250_HZ,
83+
},
84+
.orientation_filter = kalman_filter_fn,
85+
.auto_init = true,
86+
};
87+
88+
// create the IMU
89+
logger.info("Creating IMU");
90+
Imu imu(config);
91+
92+
// make a task to read out the IMU data and print it to console
93+
espp::Task imu_task({.callback = [&](std::mutex &m, std::condition_variable &cv) -> bool {
94+
// sleep first in case we don't get IMU data and need to exit early
95+
{
96+
std::unique_lock<std::mutex> lock(m);
97+
cv.wait_for(lock, 10ms);
98+
}
99+
100+
auto now = esp_timer_get_time(); // time in microseconds
101+
static auto t0 = now;
102+
auto t1 = now;
103+
float dt = (t1 - t0) / 1'000'000.0f; // convert us to s
104+
t0 = t1;
105+
106+
std::error_code ec;
107+
// update the imu data
108+
if (!imu.update(dt, ec)) {
109+
return false;
110+
}
111+
112+
// get accel
113+
auto accel = imu.get_accelerometer();
114+
auto gyro = imu.get_gyroscope();
115+
auto temp = imu.get_temperature();
116+
auto orientation = imu.get_orientation();
117+
auto gravity_vector = imu.get_gravity_vector();
118+
119+
// print time and raw IMU data
120+
std::string text = "";
121+
text += fmt::format("{:.3f},", now / 1'000'000.0f);
122+
text += fmt::format("{:02.3f},{:02.3f},{:02.3f},", (float)accel.x,
123+
(float)accel.y, (float)accel.z);
124+
text += fmt::format("{:03.3f},{:03.3f},{:03.3f},", (float)gyro.x,
125+
(float)gyro.y, (float)gyro.z);
126+
text += fmt::format("{:02.1f},", temp);
127+
// print kalman filter outputs
128+
text += fmt::format("{:03.3f},{:03.3f},{:03.3f},", (float)orientation.x,
129+
(float)orientation.y, (float)orientation.z);
130+
text += fmt::format("{:03.3f},{:03.3f},{:03.3f},", (float)gravity_vector.x,
131+
(float)gravity_vector.y, (float)gravity_vector.z);
132+
133+
auto madgwick_orientation = madgwick_filter_fn(dt, accel, gyro);
134+
float roll = madgwick_orientation.roll;
135+
float pitch = madgwick_orientation.pitch;
136+
float yaw = madgwick_orientation.yaw;
137+
float vx = sin(pitch);
138+
float vy = -cos(pitch) * sin(roll);
139+
float vz = -cos(pitch) * cos(roll);
140+
141+
// print madgwick filter outputs
142+
text += fmt::format("{:03.3f},{:03.3f},{:03.3f},", roll, pitch, yaw);
143+
text += fmt::format("{:03.3f},{:03.3f},{:03.3f}", vx, vy, vz);
144+
145+
fmt::print("{}\n", text);
146+
147+
return false;
148+
},
149+
.task_config = {
150+
.name = "IMU",
151+
.stack_size_bytes = 6 * 1024,
152+
.priority = 10,
153+
.core_id = 0,
154+
}});
155+
156+
// print the header for the IMU data (for plotting)
157+
fmt::print("% Time (s), "
158+
// raw IMU data (accel, gyro, temp)
159+
"Accel X (m/s^2), Accel Y (m/s^2), Accel Z (m/s^2), "
160+
"Gyro X (rad/s), Gyro Y (rad/s), Gyro Z (rad/s), "
161+
"Temp (C), "
162+
// kalman filter outputs
163+
"Kalman Roll (rad), Kalman Pitch (rad), Kalman Yaw (rad), "
164+
"Kalman Gravity X, Kalman Gravity Y, Kalman Gravity Z, "
165+
// madgwick filter outputs
166+
"Madgwick Roll (rad), Madgwick Pitch (rad), Magwick Yaw (rad), "
167+
"Madgwick Gravity X, Madgwick Gravity Y, Madgwick Gravity Z\n");
168+
169+
logger.info("Starting IMU task");
170+
imu_task.start();
171+
172+
// loop forever
173+
while (true) {
174+
std::this_thread::sleep_for(1s);
175+
}
176+
//! [qmi8658 example]
177+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CONFIG_IDF_TARGET="esp32s3"
2+
3+
CONFIG_FREERTOS_HZ=1000
4+
5+
# set compiler optimization level to -O2 (compile for performance)
6+
CONFIG_COMPILER_OPTIMIZATION_PERF=y
7+
8+
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
9+
CONFIG_ESPTOOLPY_FLASHSIZE="16MB"
10+
# over twice as fast as DIO
11+
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
12+
13+
# ESP32-specific
14+
#
15+
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
16+
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240
17+
18+
# Common ESP-related
19+
#
20+
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096
21+
CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384
22+
23+
# Set esp-timer task stack size to 6KB
24+
CONFIG_ESP_TIMER_TASK_STACK_SIZE=6144
25+
26+
# set the functions into IRAM
27+
CONFIG_SPI_MASTER_IN_IRAM=y

0 commit comments

Comments
 (0)