Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .eil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ groups:
- common
code_owners:
- UncleRus
- quinkq
- trombik
depends:
- driver
- freertos
Expand All @@ -25,4 +27,6 @@ targets:
license: MIT
copyrights:
- name: UncleRus
year: 2018
year: 2018
- name: quinkq
year: 2025
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ESP-IDF CMake component for i2cdev library
set(req driver freertos esp_idf_lib_helpers)
if(${IDF_VERSION_MAJOR} STREQUAL 5 AND ${IDF_VERSION_MINOR} LESS 3)
# Use driver component as esp_driver_gpio is not available before 5.3
set(req driver freertos log esp_timer)
else()
set(req esp_driver_gpio esp_driver_i2c freertos esp_idf_lib_helpers)
endif()

# ESP-IDF version detection for automatic driver selection
# Check for manual override via Kconfig
Expand All @@ -14,7 +19,7 @@ elseif(IDF_VERSION_MAJOR LESS 5)
set(USE_LEGACY_DRIVER TRUE)
message(STATUS "i2cdev: ESP-IDF v${IDF_VERSION_MAJOR}.x detected, using legacy driver")
elseif(IDF_VERSION_MAJOR EQUAL 5 AND IDF_VERSION_MINOR LESS 3)
set(USE_LEGACY_DRIVER TRUE)
set(USE_LEGACY_DRIVER TRUE)
message(STATUS "i2cdev: ESP-IDF v${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR} detected, using legacy driver")
else()
set(USE_LEGACY_DRIVER FALSE)
Expand Down
10 changes: 8 additions & 2 deletions i2cdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@
#ifndef __I2CDEV_H__
#define __I2CDEV_H__

#include <driver/gpio.h>
#include <driver/i2c.h>
#include <esp_err.h>
#include <esp_idf_lib_helpers.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <esp_idf_version.h>

#include <driver/gpio.h>
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
#include <driver/i2c_master.h>
#else
#include <driver/i2c.h>
#endif

// Define missing types for older ESP-IDF versions
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
Expand Down