Support builds that completely exclude I2CDev support#211
Open
Support builds that completely exclude I2CDev support#211
Conversation
c73ab26 to
3881908
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR restructures the Circuits.I2C project to make the NIF-based I2C backend optional, allowing builds without the native Linux dependencies. The changes move NIF-related code to a separate i2c_dev directory and introduce configuration options to control whether the NIF is built.
- Moved all NIF-related C code and Elixir modules to a new
i2c_devsubdirectory - Added application configuration to conditionally include or exclude the I2CDev backend
- Enhanced the NilBackend to provide a complete implementation when I2CDev is disabled
Reviewed Changes
Copilot reviewed 7 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| mix.exs | Restructured project configuration to conditionally include NIF compilation based on build_i2c_dev?() function |
| lib/i2c/nil_backend.ex | Added Bus protocol implementation with error-returning stubs for all I2C operations |
| i2c_dev/c_src/i2c_nif.c | Fixed missing closing brace and added errno setting for test backend |
| REUSE.toml | Updated file path references to reflect new i2c_dev directory structure |
| README.md | Added documentation for new application configuration options |
| Makefile | Updated all C source paths and removed "disabled" mode, now only supports "normal" and "test" |
| .formatter.exs | Added i2c_dev directory to formatter input paths |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
93aff92 to
b575c18
Compare
64c9c6f to
597d64f
Compare
This removes both the Elixir module and the NIF. There's no longer any unintended NIF builds or loads or anything extra. To enable this, either set the `:default_backend` application environment key or force it by setting `:include_i2c_dev`. Most users probably want: ```elixir config :circuits_i2c, default_backend: MyI2CBackend ```
597d64f to
8354420
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This removes both the Elixir module and the NIF. There's no longer any
unintended NIF builds or loads or anything extra.
To enable this, either set the
:default_backendapplicationenvironment key or force it by setting
:include_i2c_dev. Most usersprobably want:
This fixes the issue reported at https://elixirforum.com/t/circuits-sim-in-a-release/72076/3.