Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(icm42670): Add ICM42607 / ICM42670 IMU component #392

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

finger563
Copy link
Contributor

Description

  • Add new component for IMU
  • Add IMU to esp-box component and test it in the example

Motivation and Context

IMUs are nice, and exposing the IMU via the hardware component / bsp (esp-box in this case) is even better. Testing / showcasing the IMU in the bsp example is even better.

How has this been tested?

Build and run esp-box/example on ESP-BOX and ensure the IMU works by looking at the on-screen-display while moving the box around various orientations.

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

* Add new component for IMU
* Add IMU to esp-box component and test it in the example

IMUs are nice, and exposing the IMU via the hardware component / bsp (esp-box in this case) is even better. Testing / showcasing the IMU in the bsp example is _even_ better.

Build and run `esp-box/example` on ESP-BOX and ensure the IMU works by looking at the on-screen-display while moving the box around various orientations.
Copy link

github-actions bot commented Mar 3, 2025

⚡ Static analysis result ⚡

🔴 cppcheck found 117 issues! Click here to see details.

static void IRAM_ATTR lcd_spi_pre_transfer_callback(spi_transaction_t *t) {
static auto lcd_dc_io = WroverKit::get_lcd_dc_gpio();
uint32_t user_flags = (uint32_t)(t->user);
bool dc_level = user_flags & DC_LEVEL_BIT;
gpio_set_level(lcd_dc_io, dc_level);
}

!Line: 21 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_pre_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 64 - note: You might need to cast the function pointer here
!Line: 21 - note: Parameter 't' can be declared as pointer to const

static void IRAM_ATTR lcd_spi_post_transfer_callback(spi_transaction_t *t) {
uint16_t user_flags = (uint32_t)(t->user);
bool should_flush = user_flags & FLUSH_BIT;
if (should_flush) {
lv_display_t *disp = lv_display_get_default();
lv_display_flush_ready(disp);

!Line: 31 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_post_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 65 - note: You might need to cast the function pointer here
!Line: 31 - note: Parameter 't' can be declared as pointer to const

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/ftp/include/ftp_client.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/cli/include/line_input.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/cli/include/cli.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

History get_history() const { return input_history_; }
/**
* @brief Replace any existing input history with \p history.
* @note If \p history is longer than the current history_size, it will be
* truncated (oldest removed) to have size equal to history_size.

!Line: 87 - performance: Function 'get_history()' should return member 'input_history_' by const reference. [returnByReference]

bool set_accelerometer_power_mode(AccelerometerPowerMode power_mode, std::error_code &ec) {
uint8_t bitmask = 0x03;
set_bits_in_register_by_mask(static_cast<uint8_t>(Register::PWR_MGMT0), bitmask,
static_cast<uint8_t>(power_mode) & bitmask, ec);
return !ec;
}

!Line: 345 - performance: inconclusive: Function parameter 'power_mode' should be passed by const reference. [passedByValue]

bool set_gyroscope_power_mode(GyroscopePowerMode power_mode, std::error_code &ec) {
uint8_t bitmask = 0x03;
set_bits_in_register_by_mask(static_cast<uint8_t>(Register::PWR_MGMT0), bitmask << 2,
(static_cast<uint8_t>(power_mode) & bitmask) << 2, ec);
return !ec;
}

!Line: 356 - performance: inconclusive: Function parameter 'power_mode' should be passed by const reference. [passedByValue]

bool set_accelerometer_filter(SensorFilterBandwidth bw, std::error_code &ec) {
// ACCEL_FILT_BW is bits 2-0 in ACCEL_CONFIG1
uint8_t mask = 0x07;
uint8_t data = static_cast<uint8_t>(bw) & mask;
set_bits_in_register_by_mask(static_cast<uint8_t>(Register::ACCEL_CONFIG1), mask, data, ec);
return !ec;

!Line: 367 - performance: inconclusive: Function parameter 'bw' should be passed by const reference. [passedByValue]

bool set_gyroscope_filter(SensorFilterBandwidth bw, std::error_code &ec) {
// GYRO_FILT_BW is bits 2-0 in GYRO_CONFIG1
uint8_t mask = 0x07;
uint8_t data = static_cast<uint8_t>(bw) & mask;
set_bits_in_register_by_mask(static_cast<uint8_t>(Register::GYRO_CONFIG1), mask, data, ec);
return !ec;

!Line: 379 - performance: inconclusive: Function parameter 'bw' should be passed by const reference. [passedByValue]

bool set_dmp_odr(DmpODR odr, std::error_code &ec) {
// DMP ODR is bits 1-0 in APEX_CONFIG1
uint8_t mask = 0x03;
uint8_t data = static_cast<uint8_t>(odr) & mask;
set_bits_in_register_by_mask(static_cast<uint8_t>(Register::APEX_CONFIG1), mask, data, ec);
return !ec;

!Line: 415 - performance: inconclusive: Function parameter 'odr' should be passed by const reference. [passedByValue]

bool configure_fifo(FifoMode mode, bool bypassed, std::error_code &ec) {
// FIFO_MODE is bit 1, FIFO_BYPASS is bit 0
uint8_t data = (static_cast<uint8_t>(mode) << 1) | (bypassed ? 1 : 0);
write_u8_to_register(static_cast<uint8_t>(Register::FIFO_CONFIG1), data, ec);
return !ec;
}

!Line: 507 - performance: inconclusive: Function parameter 'mode' should be passed by const reference. [passedByValue]

static float accelerometer_range_to_sensitivty(AccelerometerRange range) {
switch (range) {
case AccelerometerRange::RANGE_16G:
return ACCEL_FS_16G_SENS;
case AccelerometerRange::RANGE_8G:
return ACCEL_FS_8G_SENS;

!Line: 833 - performance: inconclusive: Function parameter 'range' should be passed by const reference. [passedByValue]

static float gyroscope_range_to_sensitivty(GyroscopeRange range) {
switch (range) {
case GyroscopeRange::RANGE_2000DPS:
return GYRO_FS_2000_SENS;
case GyroscopeRange::RANGE_1000DPS:
return GYRO_FS_1000_SENS;

!Line: 848 - performance: inconclusive: Function parameter 'range' should be passed by const reference. [passedByValue]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/file_system/src/file_system.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

std::string button_component_name = "button";
// create a button
espp::Button button({
.name = "Button 12",
.interrupt_config =

!Line: 34 - style: Variable 'button_component_name' is assigned a value that is never used. [unreadVariable]

std::atomic<bool> quit_test = false;
fmt::print("Starting ft5x06 example\n");
//! [ft5x06 example]
// make the I2C that we'll use to communicate
espp::I2c i2c({
.port = I2C_NUM_0,

!Line: 13 - style: Variable 'quit_test' is assigned a value that is never used. [unreadVariable]

std::error_code ec;
// and finally, make the task to periodically poll the max1704x and print
// the state. NOTE: the Max1704x does not internally manage its own state
// update, so whatever rate we use here is the rate at which the state will
// update.

!Line: 28 - style: Unused variable: ec [unusedVariable]

.callback = [&ads](auto &m, auto &cv) -> bool {
static uint32_t io_num;
// block until we get a message from the interrupt handler
if (xQueueReceive(gpio_evt_queue, &io_num, portMAX_DELAY)) {
// see if it's the mute button
if (io_num == (int)ALERT_PIN) {

!Line: 128 - style: Parameter 'm' can be declared as reference to const [constParameterReference]

.callback = [&ads](auto &m, auto &cv) -> bool {
static uint32_t io_num;
// block until we get a message from the interrupt handler
if (xQueueReceive(gpio_evt_queue, &io_num, portMAX_DELAY)) {
// see if it's the mute button
if (io_num == (int)ALERT_PIN) {

!Line: 128 - style: Parameter 'cv' can be declared as reference to const [constParameterReference]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/binary-log/example/main/binary_log_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

std::atomic<bool> quit_test = false;
fmt::print("Starting chsc6x example\n");
//! [chsc6x example]
// make the I2C that we'll use to communicate
espp::I2c i2c({
.port = I2C_NUM_0,

!Line: 13 - style: Variable 'quit_test' is assigned a value that is never used. [unreadVariable]

bool task_callback(std::mutex &m, std::condition_variable &cv, bool &task_notified) {
EventData event_data;
// record the min number of free spaces in the queue
size_t free_spaces = uxQueueSpacesAvailable(queue_);
if (free_spaces < min_queue_size_) {
min_queue_size_ = free_spaces;

!Line: 410 - style: Parameter 'm' can be declared as reference to const. However it seems that 'task_callback' is a callback function, if 'm' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 176 - note: You might need to cast the function pointer here
!Line: 410 - note: Parameter 'm' can be declared as reference to const

bool task_callback(std::mutex &m, std::condition_variable &cv, bool &task_notified) {
EventData event_data;
// record the min number of free spaces in the queue
size_t free_spaces = uxQueueSpacesAvailable(queue_);
if (free_spaces < min_queue_size_) {
min_queue_size_ = free_spaces;

!Line: 410 - style: Parameter 'cv' can be declared as reference to const. However it seems that 'task_callback' is a callback function, if 'cv' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 176 - note: You might need to cast the function pointer here
!Line: 410 - note: Parameter 'cv' can be declared as reference to const

bool task_callback(std::mutex &m, std::condition_variable &cv, bool &task_notified) {
EventData event_data;
// record the min number of free spaces in the queue
size_t free_spaces = uxQueueSpacesAvailable(queue_);
if (free_spaces < min_queue_size_) {
min_queue_size_ = free_spaces;

!Line: 410 - style: Parameter 'task_notified' can be declared as reference to const. However it seems that 'task_callback' is a callback function, if 'task_notified' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 176 - note: You might need to cast the function pointer here
!Line: 410 - note: Parameter 'task_notified' can be declared as reference to const

std::atomic<bool> quit_test = false;
fmt::print("Starting cst816 example\n");
//! [cst816 example]
// make the I2C that we'll use to communicate
espp::I2c i2c({
.port = I2C_NUM_0,

!Line: 13 - style: Variable 'quit_test' is assigned a value that is never used. [unreadVariable]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/ble_gatt_server/include/ble_gatt_server_menu.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/ble_gatt_server/example/main/ble_gatt_server_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

nearby_platform_status nearby_platform_GetBatteryInfo(nearby_platform_BatteryInfo *battery_info) {
// TODO: Implement
return kNearbyStatusOK;
}
// Initializes battery module

!Line: 6 - style: Parameter 'battery_info' can be declared as pointer to const [constParameterPointer]

nearby_platform_BatteryInit(nearby_platform_BatteryInterface *battery_interface) {
// TODO: Implement
return kNearbyStatusOK;
}

!Line: 15 - style: Parameter 'battery_interface' can be declared as pointer to const [constParameterPointer]

void nearby_platform_GetConnectionBitmap(uint8_t *bitmap, size_t *length) {
// TODO: implement
}
// Returns true is SASS state in On
bool nearby_platform_IsSassOn() {

!Line: 66 - style: Parameter 'bitmap' can be declared as pointer to const [constParameterPointer]

void nearby_platform_GetConnectionBitmap(uint8_t *bitmap, size_t *length) {
// TODO: implement
}
// Returns true is SASS state in On
bool nearby_platform_IsSassOn() {

!Line: 66 - style: Parameter 'length' can be declared as pointer to const [constParameterPointer]

.connect_callback = [&](NimBLEConnInfo &conn_info) { logger.info("Device connected"); },
.disconnect_callback = [&](auto &conn_info,
auto reason) { logger.info("Device disconnected: {}", reason); },
.authentication_complete_callback =
[&](const NimBLEConnInfo &conn_info) { logger.info("Device authenticated"); },
.get_passkey_callback = [&]() { return NimBLEDevice::getSecurityPasskey(); },

!Line: 24 - style: Parameter 'conn_info' can be declared as reference to const [constParameterReference]

.disconnect_callback = [&](auto &conn_info,
auto reason) { logger.info("Device disconnected: {}", reason); },
.authentication_complete_callback =
[&](const NimBLEConnInfo &conn_info) { logger.info("Device authenticated"); },
.get_passkey_callback = [&]() { return NimBLEDevice::getSecurityPasskey(); },
.confirm_passkey_callback =

!Line: 25 - style: Parameter 'conn_info' can be declared as reference to const [constParameterReference]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/event_manager/src/event_manager.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

.connect_callback = [&](NimBLEConnInfo &conn_info) { logger.info("Device connected"); },
.disconnect_callback = [&](auto &conn_info,
auto reason) { logger.info("Device disconnected: {}", reason); },
.authentication_complete_callback =
[&](const NimBLEConnInfo &conn_info) { logger.info("Device authenticated"); },
// NOTE: this is optional, if you don't provide this callback, it will

!Line: 27 - style: Parameter 'conn_info' can be declared as reference to const [constParameterReference]

.disconnect_callback = [&](auto &conn_info,
auto reason) { logger.info("Device disconnected: {}", reason); },
.authentication_complete_callback =
[&](const NimBLEConnInfo &conn_info) { logger.info("Device authenticated"); },
// NOTE: this is optional, if you don't provide this callback, it will
// perform the exactly function as below:

!Line: 28 - style: Parameter 'conn_info' can be declared as reference to const [constParameterReference]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/hid_service/example/main/hid_service_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

.connect_callback = [&](NimBLEConnInfo &conn_info) { logger.info("Device connected"); },
.disconnect_callback = [&](auto &conn_info,
auto reason) { logger.info("Device disconnected: {}", reason); },
.authentication_complete_callback =
[&](const NimBLEConnInfo &conn_info) { logger.info("Device authenticated"); },
// NOTE: this is optional, if you don't provide this callback, it will

!Line: 72 - style: Parameter 'conn_info' can be declared as reference to const [constParameterReference]

.disconnect_callback = [&](auto &conn_info,
auto reason) { logger.info("Device disconnected: {}", reason); },
.authentication_complete_callback =
[&](const NimBLEConnInfo &conn_info) { logger.info("Device authenticated"); },
// NOTE: this is optional, if you don't provide this callback, it will
// perform the exactly function as below:

!Line: 73 - style: Parameter 'conn_info' can be declared as reference to const [constParameterReference]

counter = prev_counter;
// set the joysticks to 0 since their config may not put them at 0
set_left_joystick(0, 0);
set_right_joystick(0, 0);
}

!Line: 195 - style: Variable 'counter' is assigned an expression that holds the same value. [redundantAssignment]

!Line: 191 - note: prev_counter is assigned 'counter' here.
!Line: 195 - note: Variable 'counter' is assigned an expression that holds the same value.

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/color/src/color.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

rmt_encode_state_t *ret_state) -> size_t {
// divide by 2 since we have both duration0 and duration1 in the reset code
static uint16_t reset_ticks =
WS2812_FREQ_HZ / MICROS_PER_SEC * 50 / 2; // reset code duration defaults to 50us
static rmt_symbol_word_t led_reset_code = (rmt_symbol_word_t){
.duration0 = reset_ticks,

!Line: 54 - style: Parameter 'ret_state' can be declared as pointer to const [constParameterPointer]

std::atomic<bool> quit_test = false;
fmt::print("Starting tt2100 example\n");
//! [tt21100 example]
// make the I2C that we'll use to communicate
espp::I2c i2c({
.port = I2C_NUM_0,

!Line: 13 - style: Variable 'quit_test' is assigned a value that is never used. [unreadVariable]

static void IRAM_ATTR lcd_spi_pre_transfer_callback(spi_transaction_t *t) {
static auto lcd_dc_io = TDongleS3::get_lcd_dc_gpio();
uint32_t user_flags = (uint32_t)(t->user);
bool dc_level = user_flags & DC_LEVEL_BIT;
gpio_set_level(lcd_dc_io, dc_level);
}

!Line: 128 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_pre_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 170 - note: You might need to cast the function pointer here
!Line: 128 - note: Parameter 't' can be declared as pointer to const

static void IRAM_ATTR lcd_spi_post_transfer_callback(spi_transaction_t *t) {
uint16_t user_flags = (uint32_t)(t->user);
bool should_flush = user_flags & FLUSH_BIT;
if (should_flush) {
lv_display_t *disp = lv_disp_get_default();
lv_display_flush_ready(disp);

!Line: 138 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_post_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 171 - note: You might need to cast the function pointer here
!Line: 138 - note: Parameter 't' can be declared as pointer to const

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/input_drivers/include/touchpad_input.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/input_drivers/include/keypad_input.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

extern const char wav_start[] asm("_binary_click_wav_start");
extern const char wav_end[] asm("_binary_click_wav_end");
// -1 due to the size being 1 byte too large, I think because end is the byte
// immediately after the last byte in the memory but I'm not sure - cmm 2022-08-20
//

!Line: 246 - error: syntax error [syntaxError]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/gt911/include/gt911.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

static void lcd_spi_pre_transfer_callback(spi_transaction_t *t) {
static auto lcd_dc_io = EspBox::get_lcd_dc_gpio();
uint32_t user_flags = (uint32_t)(t->user);
bool dc_level = user_flags & DC_LEVEL_BIT;
gpio_set_level(lcd_dc_io, dc_level);
}

!Line: 18 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_pre_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 60 - note: You might need to cast the function pointer here
!Line: 18 - note: Parameter 't' can be declared as pointer to const

static void lcd_spi_post_transfer_callback(spi_transaction_t *t) {
uint16_t user_flags = (uint32_t)(t->user);
bool should_flush = user_flags & FLUSH_BIT;
if (should_flush) {
lv_display_t *disp = lv_display_get_default();
lv_display_flush_ready(disp);

!Line: 28 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_post_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 61 - note: You might need to cast the function pointer here
!Line: 28 - note: Parameter 't' can be declared as pointer to const

std::atomic<bool> quit_test = false;
fmt::print("Starting gt911 example\n");
//! [gt911 example]
// make the I2C that we'll use to communicate
espp::I2c i2c({
.port = I2C_NUM_0,

!Line: 13 - style: Variable 'quit_test' is assigned a value that is never used. [unreadVariable]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/nvs/example/main/nvs_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/matouch-rotary-display/example/main/matouch_rotary_display_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

std::atomic<bool> quit_test = false;
fmt::print("Starting tt2100 example\n");
//! [bm8563 example]
// make the I2C that we'll use to communicate
espp::I2c i2c({
.port = I2C_NUM_0,

!Line: 13 - style: Variable 'quit_test' is assigned a value that is never used. [unreadVariable]

static void IRAM_ATTR lcd_spi_pre_transfer_callback(spi_transaction_t *t) {
static auto lcd_dc_io = MatouchRotaryDisplay::get_lcd_dc_gpio();
uint32_t user_flags = (uint32_t)(t->user);
bool dc_level = user_flags & DC_LEVEL_BIT;
gpio_set_level(lcd_dc_io, dc_level);
}

!Line: 215 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_pre_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 257 - note: You might need to cast the function pointer here
!Line: 215 - note: Parameter 't' can be declared as pointer to const

static void IRAM_ATTR lcd_spi_post_transfer_callback(spi_transaction_t *t) {
uint16_t user_flags = (uint32_t)(t->user);
bool should_flush = user_flags & FLUSH_BIT;
if (should_flush) {
lv_display_t *disp = lv_display_get_default();
lv_display_flush_ready(disp);

!Line: 225 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_post_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 258 - note: You might need to cast the function pointer here
!Line: 225 - note: Parameter 't' can be declared as pointer to const

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/rtsp/include/jpeg_header.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/rtsp/include/rtsp_client.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/rtsp/include/jpeg_frame.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/rtsp/include/rtsp_server.hpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/monitor/example/main/monitor_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

State_2::ChildState COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE_OBJ;
DeepHistoryState COMPLEX_OBJ__STATE_2_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ;
State_2::ChildState2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ;
State_2::ChildState3::Grand COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ;
State_2::ChildState3::Grand2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ;
State_2::ChildState3 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ;

!Line: 656 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations. [initializerList]

!Line: 240 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.
!Line: 656 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.

DeepHistoryState COMPLEX_OBJ__STATE_2_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ;
State_2::ChildState2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ;
State_2::ChildState3::Grand COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ;
State_2::ChildState3::Grand2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ;
State_2::ChildState3 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;

!Line: 657 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations. [initializerList]

!Line: 241 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.
!Line: 657 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.

State_2::ChildState2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ;
State_2::ChildState3::Grand COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ;
State_2::ChildState3::Grand2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ;
State_2::ChildState3 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
State_2 COMPLEX_OBJ__STATE_2_OBJ;

!Line: 658 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations. [initializerList]

!Line: 242 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.
!Line: 658 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.

State_2::ChildState3::Grand COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ;
State_2::ChildState3::Grand2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ;
State_2::ChildState3 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
State_2 COMPLEX_OBJ__STATE_2_OBJ;
State3::ChildState2 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ;

!Line: 659 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' due to the order of declarations. [initializerList]

!Line: 243 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' due to the order of declarations.
!Line: 659 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' due to the order of declarations.

State_2::ChildState3::Grand2 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ;
State_2::ChildState3 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
State_2 COMPLEX_OBJ__STATE_2_OBJ;
State3::ChildState2 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;

!Line: 660 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' due to the order of declarations. [initializerList]

!Line: 245 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' due to the order of declarations.
!Line: 660 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ__GRAND2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' due to the order of declarations.

State_2::ChildState3 COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
State_2 COMPLEX_OBJ__STATE_2_OBJ;
State3::ChildState2 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
DeepHistoryState COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ;

!Line: 661 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations. [initializerList]

!Line: 247 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.
!Line: 661 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__CHILDSTATE3_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.

ShallowHistoryState COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
State_2 COMPLEX_OBJ__STATE_2_OBJ;
State3::ChildState2 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
DeepHistoryState COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ;
State3::ChildState COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ;

!Line: 662 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations. [initializerList]

!Line: 248 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.
!Line: 662 - note: Member variable 'Root::COMPLEX_OBJ__STATE_2_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE_2_OBJ' due to the order of declarations.

State3::ChildState2 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ;
ShallowHistoryState COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
DeepHistoryState COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ;
State3::ChildState COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ;
State3::ChildState3 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ;
State3 COMPLEX_OBJ__STATE3_OBJ;

!Line: 664 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations. [initializerList]

!Line: 250 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.
!Line: 664 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE2_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.

ShallowHistoryState COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ;
DeepHistoryState COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ;
State3::ChildState COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ;
State3::ChildState3 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ;
State3 COMPLEX_OBJ__STATE3_OBJ;
// END state object

!Line: 665 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations. [initializerList]

!Line: 251 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.
!Line: 665 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__SHALLOW_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.

DeepHistoryState COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ;
State3::ChildState COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ;
State3::ChildState3 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ;
State3 COMPLEX_OBJ__STATE3_OBJ;
// END state object
End_State COMPLEX_OBJ__END_STATE_OBJ;

!Line: 666 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations. [initializerList]

!Line: 252 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.
!Line: 666 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__DEEP_HISTORY_PSEUDOSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.

State3::ChildState COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ;
State3::ChildState3 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ;
State3 COMPLEX_OBJ__STATE3_OBJ;
// END state object
End_State COMPLEX_OBJ__END_STATE_OBJ;
// Keep a _root for easier templating, it will point to us

!Line: 667 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations. [initializerList]

!Line: 253 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.
!Line: 667 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.

State3::ChildState3 COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ;
State3 COMPLEX_OBJ__STATE3_OBJ;
// END state object
End_State COMPLEX_OBJ__END_STATE_OBJ;
// Keep a _root for easier templating, it will point to us
Root *_root;

!Line: 668 - style: inconclusive: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations. [initializerList]

!Line: 254 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.
!Line: 668 - note: Member variable 'Root::COMPLEX_OBJ__STATE3_OBJ__CHILDSTATE3_OBJ' uses an uninitialized argument 'COMPLEX_OBJ__STATE3_OBJ' due to the order of declarations.

virtual ~Event() {}
T get_data() const { return data; }
}; // Class Event
// free the memory associated with the event
static void consume_event(GeneratedEventBase *e) { delete e; }

!Line: 60 - style: The destructor '~Event' overrides a destructor in a base class but is not marked with a 'override' specifier. [missingOverride]

!Line: 43 - note: Virtual destructor in base class
!Line: 60 - note: Destructor in derived class

const espp::state_machine::Complex::GeneratedEventBase *e = nullptr;
bool handled = false;
// create the HFSM
espp::state_machine::Complex::Root complex_root;

!Line: 28 - style: Variable 'e' is assigned a value that is never used. [unreadVariable]

bool handled = false;
// create the HFSM
espp::state_machine::Complex::Root complex_root;
// set the log callback to print to stdout

!Line: 29 - style: Variable 'handled' is assigned a value that is never used. [unreadVariable]

const espp::state_machine::Complex::GeneratedEventBase *e = nullptr;
// create the HFSM
espp::state_machine::Complex::Root complex_root;
// set the log callback to print to stdout

!Line: 91 - style: Variable 'e' is assigned a value that is never used. [unreadVariable]

void init_gfx(const flush_fn flush_callback, const rotation_fn rotation_callback,
DisplayRotation rotation, const Task::BaseConfig &task_config) {
lv_init();
display_ = lv_display_create(width_, height_);

!Line: 351 - performance: inconclusive: Function parameter 'flush_callback' should be passed by const reference. [passedByValue]

static void IRAM_ATTR lcd_spi_pre_transfer_callback(spi_transaction_t *t) {
static auto lcd_dc_io = TDeck::get_lcd_dc_gpio();
uint32_t user_flags = (uint32_t)(t->user);
bool dc_level = user_flags & DC_LEVEL_BIT;
gpio_set_level(lcd_dc_io, dc_level);
}

!Line: 245 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_pre_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 287 - note: You might need to cast the function pointer here
!Line: 245 - note: Parameter 't' can be declared as pointer to const

static void IRAM_ATTR lcd_spi_post_transfer_callback(spi_transaction_t *t) {
uint16_t user_flags = (uint32_t)(t->user);
bool should_flush = user_flags & FLUSH_BIT;
if (should_flush) {
lv_display_t *disp = lv_display_get_default();
lv_display_flush_ready(disp);

!Line: 255 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_post_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 288 - note: You might need to cast the function pointer here
!Line: 255 - note: Parameter 't' can be declared as pointer to const

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/t-deck/example/main/t_deck_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/codec/es7210/es7210.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

.callback = [&mutex, &cv, &f, &ret_val, &notified](auto &cb_m, auto &cb_cv) -> bool {
// synchronize with the main thread - block here until the main thread
// waits on the condition variable (cv), then run the function
std::unique_lock lock(mutex);
// run the function
ret_val = f();

!Line: 54 - style: Parameter 'cb_m' can be declared as reference to const [constParameterReference]

.callback = [&mutex, &cv, &f, &ret_val, &notified](auto &cb_m, auto &cb_cv) -> bool {
// synchronize with the main thread - block here until the main thread
// waits on the condition variable (cv), then run the function
std::unique_lock lock(mutex);
// run the function
ret_val = f();

!Line: 54 - style: Parameter 'cb_cv' can be declared as reference to const [constParameterReference]

.callback = [&mutex, &cv, &f, &notified](auto &cb_m, auto &cb_cv) -> bool {
// synchronize with the main thread - block here until the main thread
// waits on the condition variable (cv), then run the function
std::unique_lock lock(mutex);
// run the function
f();

!Line: 79 - style: Parameter 'cb_m' can be declared as reference to const [constParameterReference]

.callback = [&mutex, &cv, &f, &notified](auto &cb_m, auto &cb_cv) -> bool {
// synchronize with the main thread - block here until the main thread
// waits on the condition variable (cv), then run the function
std::unique_lock lock(mutex);
// run the function
f();

!Line: 79 - style: Parameter 'cb_cv' can be declared as reference to const [constParameterReference]

adc_iface |= BIT(6);
dac_iface |= BIT(6);
if (mode == ES_MODULE_LINE) {
ESP_LOGE(TAG, "The codec es8311 doesn't support ES_MODULE_LINE mode");
return ESP_FAIL;

!Line: 547 - error: syntax error [syntaxError]

https://github.com/esp-cpp/espp/blob/68c55a43f2a2a17b80325be443618c4db0993d94/components/task/example/main/task_example.cpp#L0-L5

!Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]

rmt_encode_state_t *ret_state) -> size_t {
// divide the transmit resolution (10MHz) by 1,000,000 to get the
// number of ticks per microsecond
// we divide by two since we have both duration0 and duration1 in the
// reset code
static uint16_t reset_ticks =

!Line: 61 - style: Parameter 'ret_state' can be declared as pointer to const [constParameterPointer]

for (auto &conf : config.channels) {
auto channel = conf.channel;
auto attenuation = conf.attenuation;
auto channel_unit = conf.unit;
if (config.unit != channel_unit) {
logger_.warn("Channel configuration invalid, main unit ({}) != channel unit ({})",

!Line: 153 - style: Variable 'conf' can be declared as reference to const [constVariableReference]

bool update_task(std::mutex &task_m, std::condition_variable &task_cv, bool &task_notified) {
task_handle_ = xTaskGetCurrentTaskHandle();
static auto previous_timestamp = std::chrono::high_resolution_clock::now();
// wait until conversion is ready (will be notified by the registered
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
auto current_timestamp = std::chrono::high_resolution_clock::now();

!Line: 173 - style: Parameter 'task_m' can be declared as reference to const. However it seems that 'update_task' is a callback function, if 'task_m' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 66 - note: You might need to cast the function pointer here
!Line: 173 - note: Parameter 'task_m' can be declared as reference to const

bool update_task(std::mutex &task_m, std::condition_variable &task_cv, bool &task_notified) {
task_handle_ = xTaskGetCurrentTaskHandle();
static auto previous_timestamp = std::chrono::high_resolution_clock::now();
// wait until conversion is ready (will be notified by the registered
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
auto current_timestamp = std::chrono::high_resolution_clock::now();

!Line: 173 - style: Parameter 'task_cv' can be declared as reference to const. However it seems that 'update_task' is a callback function, if 'task_cv' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 66 - note: You might need to cast the function pointer here
!Line: 173 - note: Parameter 'task_cv' can be declared as reference to const

bool update_task(std::mutex &task_m, std::condition_variable &task_cv, bool &task_notified) {
task_handle_ = xTaskGetCurrentTaskHandle();
static auto previous_timestamp = std::chrono::high_resolution_clock::now();
// wait until conversion is ready (will be notified by the registered
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
auto current_timestamp = std::chrono::high_resolution_clock::now();

!Line: 173 - style: Parameter 'task_notified' can be declared as reference to const. However it seems that 'update_task' is a callback function, if 'task_notified' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 66 - note: You might need to cast the function pointer here
!Line: 173 - note: Parameter 'task_notified' can be declared as reference to const

if (swap_color_order_) {
madctl |= LCD_CMD_BGR_BIT;
}
if (mirror_x_) {
madctl |= LCD_CMD_MX_BIT;
}

!Line: 118 - style: Condition 'swap_color_order_' is always false [knownConditionTrueFalse]

if (mirror_x_) {
madctl |= LCD_CMD_MX_BIT;
}
if (mirror_y_) {
madctl |= LCD_CMD_MY_BIT;
}

!Line: 121 - style: Condition 'mirror_x_' is always false [knownConditionTrueFalse]

if (mirror_y_) {
madctl |= LCD_CMD_MY_BIT;
}
if (swap_xy_) {
madctl |= LCD_CMD_MV_BIT;
}

!Line: 124 - style: Condition 'mirror_y_' is always false [knownConditionTrueFalse]

if (swap_xy_) {
madctl |= LCD_CMD_MV_BIT;
}
auto init_cmds = std::to_array<display_drivers::DisplayInitCmd<Command>>({
{Command::slpout, {}, 120}, // sleep out

!Line: 127 - style: Condition 'swap_xy_' is always false [knownConditionTrueFalse]

if (swap_color_order_) {
data |= LCD_CMD_BGR_BIT;
}
if (mirror_x_) {
data |= LCD_CMD_MX_BIT;
}

!Line: 156 - style: Condition 'swap_color_order_' is always false [knownConditionTrueFalse]

if (mirror_x_) {
data |= LCD_CMD_MX_BIT;
}
if (mirror_y_) {
data |= LCD_CMD_MY_BIT;
}

!Line: 159 - style: Condition 'mirror_x_' is always false [knownConditionTrueFalse]

if (mirror_y_) {
data |= LCD_CMD_MY_BIT;
}
if (swap_xy_) {
data |= LCD_CMD_MV_BIT;
}

!Line: 162 - style: Condition 'mirror_y_' is always false [knownConditionTrueFalse]

if (swap_xy_) {
data |= LCD_CMD_MV_BIT;
}
switch (rotation) {
case DisplayRotation::LANDSCAPE:

!Line: 165 - style: Condition 'swap_xy_' is always false [knownConditionTrueFalse]

if (mirror_portrait_) {
data ^= (LCD_CMD_MX_BIT | LCD_CMD_MV_BIT);
} else {
data ^= (LCD_CMD_MY_BIT | LCD_CMD_MV_BIT);
}
break;

!Line: 174 - style: Condition 'mirror_portrait_' is always false [knownConditionTrueFalse]

if (mirror_portrait_) {
data ^= (LCD_CMD_MY_BIT | LCD_CMD_MV_BIT);
} else {
data ^= (LCD_CMD_MX_BIT | LCD_CMD_MV_BIT);
}
break;

!Line: 186 - style: Condition 'mirror_portrait_' is always false [knownConditionTrueFalse]

uint8_t madctl = 0;
if (swap_color_order_) {
madctl |= LCD_CMD_BGR_BIT;
}
if (mirror_x_) {
madctl |= LCD_CMD_MX_BIT;

!Line: 117 - style: Variable 'madctl' is assigned a value that is never used. [unreadVariable]

madctl |= LCD_CMD_BGR_BIT;
}
if (mirror_x_) {
madctl |= LCD_CMD_MX_BIT;
}
if (mirror_y_) {

!Line: 119 - style: Variable 'madctl' is assigned a value that is never used. [unreadVariable]

madctl |= LCD_CMD_MX_BIT;
}
if (mirror_y_) {
madctl |= LCD_CMD_MY_BIT;
}
if (swap_xy_) {

!Line: 122 - style: Variable 'madctl' is assigned a value that is never used. [unreadVariable]

madctl |= LCD_CMD_MY_BIT;
}
if (swap_xy_) {
madctl |= LCD_CMD_MV_BIT;
}

!Line: 125 - style: Variable 'madctl' is assigned a value that is never used. [unreadVariable]

madctl |= LCD_CMD_MV_BIT;
}
auto init_cmds = std::to_array<display_drivers::DisplayInitCmd<Command>>({
{Command::slpout, {}, 120}, // sleep out
{Command::noron}, // normal mode

!Line: 128 - style: Variable 'madctl' is assigned a value that is never used. [unreadVariable]

static void IRAM_ATTR lcd_spi_pre_transfer_callback(spi_transaction_t *t) {
uint32_t user_flags = (uint32_t)(t->user);
bool dc_level = user_flags & DC_LEVEL_BIT;
gpio_set_level((gpio_num_t)DC_PIN_NUM, dc_level);
}
#endif

!Line: 59 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_pre_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 505 - note: You might need to cast the function pointer here
!Line: 59 - note: Parameter 't' can be declared as pointer to const

static void IRAM_ATTR lcd_spi_post_transfer_callback(spi_transaction_t *t) {
uint16_t user_flags = (uint32_t)(t->user);
bool should_flush = user_flags & FLUSH_BIT;
if (should_flush) {
lv_display_t *disp = lv_display_get_default();
lv_display_flush_ready(disp);

!Line: 71 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_post_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 507 - note: You might need to cast the function pointer here
!Line: 71 - note: Parameter 't' can be declared as pointer to const

static void on_clear_pressed(lv_event_t *event) { clear_circles(); }
static void draw_circle(int x0, int y0, int radius) {
std::lock_guard<std::recursive_mutex> lock(lvgl_mutex);
// if the number of circles is greater than the max, remove the oldest circle
if (circles.size() > MAX_CIRCLES) {

!Line: 152 - style: Parameter 'event' can be declared as pointer to const. However it seems that 'on_clear_pressed' is a callback function, if 'event' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 111 - note: You might need to cast the function pointer here
!Line: 152 - note: Parameter 'event' can be declared as pointer to const

static void IRAM_ATTR lcd_spi_pre_transfer_callback(spi_transaction_t *t) {
static auto lcd_dc_io = SsRoundDisplay::get_lcd_dc_gpio();
uint32_t user_flags = (uint32_t)(t->user);
bool dc_level = user_flags & DC_LEVEL_BIT;
gpio_set_level(lcd_dc_io, dc_level);
}

!Line: 175 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_pre_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 217 - note: You might need to cast the function pointer here
!Line: 175 - note: Parameter 't' can be declared as pointer to const

static void IRAM_ATTR lcd_spi_post_transfer_callback(spi_transaction_t *t) {
uint16_t user_flags = (uint32_t)(t->user);
bool should_flush = user_flags & FLUSH_BIT;
if (should_flush) {
lv_display_t *disp = lv_display_get_default();
lv_display_flush_ready(disp);

!Line: 185 - style: Parameter 't' can be declared as pointer to const. However it seems that 'lcd_spi_post_transfer_callback' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 218 - note: You might need to cast the function pointer here
!Line: 185 - note: Parameter 't' can be declared as pointer to const

espp/pc/tests/task.cpp

Lines 16 to 21 in 68c55a4

espp::Task task({.name = "Task", .callback = [&](auto &m, auto &cv) -> bool {
auto now = std::chrono::steady_clock::now();
logger.info("[{:.3f}] Hello from the task!", elapsed());
std::this_thread::sleep_until(now + 1s);
// don't want to stop the task
return false;

!Line: 16 - style: Parameter 'm' can be declared as reference to const [constParameterReference]

espp/pc/tests/task.cpp

Lines 16 to 21 in 68c55a4

espp::Task task({.name = "Task", .callback = [&](auto &m, auto &cv) -> bool {
auto now = std::chrono::steady_clock::now();
logger.info("[{:.3f}] Hello from the task!", elapsed());
std::this_thread::sleep_until(now + 1s);
// don't want to stop the task
return false;

!Line: 16 - style: Parameter 'cv' can be declared as reference to const [constParameterReference]


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant