-
Notifications
You must be signed in to change notification settings - Fork 0
✨ (API): add pure C API #17
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
Conversation
6467c95 to
f51c4f3
Compare
da47402 to
201a4e2
Compare
ebf7bd4 to
e5c373d
Compare
75d4add to
2f8497f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a pure C API for Arduino-based I²C device interactions while refactoring several device implementations (e.g. PCA9685 and MAX170XX) to use the new API. Key changes include:
- Addition of src/i2cdevbus_hal_arduino.hpp to provide the pure C API.
- Refactoring of device drivers in pca9685 and max170xx to use the new API calls.
- Updates to examples to include the new header and improve error handling.
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/i2cdevbus_hal_arduino.hpp | New pure C API implementation for Arduino hardware abstraction. |
| src/i2cdev/pca9685.hpp & pca9685.h | Refactored PCA9685 driver to use the new API and updated macros. |
| src/i2cdev/max170xx.hpp & max170xx.h | Updated MAX170XX driver implementations to rely on the C API. |
| src/i2cdev/common.hpp | New header adding a Result template for improved error handling. |
| hal/I2CDevBus_ArduinoWire.hpp & I2CDevLib.h | Removed obsolete ArduinoWire based implementation. |
| examples/* | Examples updated to include the new header and add proper casting and error checks. |
Files not reviewed (1)
- platformio.ini: Language not supported
|
@CodiumAI-Agent /review |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
@CodiumAI-Agent /describe |
Title(Describe updated until commit f937efe)✨ (API): add pure C API PR TypeEnhancement Description
Changes walkthrough 📝
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces a pure C API for the I2C device communication library while refactoring the existing C++ drivers and examples to use the new API.
- Added a new header (i2cdevbus_hal_arduino.hpp) that implements pure C API functionality for Arduino.
- Updated sensor driver headers (pca9685, max170xx, common.hpp) to use inline pure C functions and modify class implementations accordingly.
- Removed deprecated headers (I2CDevLib.h and I2CDevBus_ArduinoWire.hpp) and updated examples to reflect the new API.
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/i2cdevbus_hal_arduino.hpp | New header providing C API functions for Arduino. |
| src/i2cdev/pca9685.hpp | Updated PCA9685 driver to call pure C API functions. |
| src/i2cdev/pca9685.h | Refactored inline C implementations using the new pure C API methods. |
| src/i2cdev/max170xx.hpp | Updated MAX170XX driver classes to use the new API with inline C function calls. |
| src/i2cdev/max170xx.h | Introduced new inline functions that implement the pure C API for MAX170XX devices. |
| src/i2cdev/common.hpp | New header providing a simple Result template for improved error handling. |
| src/hal/I2CDevBus_ArduinoWire.hpp | Removed legacy C++ I2C bus implementation for Arduino. |
| src/I2CDevLib.h | Removed deprecated legacy header. |
| examples/* | Updated examples to use the new header and API calls. |
Files not reviewed (1)
- platformio.ini: Language not supported
Comments suppressed due to low confidence (1)
examples/MAX170XX/Simple/Simple.ino:4
- The example references 'MAX17048', but no matching class is defined in the drivers. Consider using one of the defined classes (e.g., MAX17043, MAX17044, MAX170x8, or MAX170x9) or add an alias for MAX17048 if intended.
i2cdev::MAX17048 max17048;
No description provided.