-
Notifications
You must be signed in to change notification settings - Fork 23
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
Draft: Writing your own I2C component for the ESP-Registry #135
base: main
Are you sure you want to change the base?
Conversation
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.
Please consider the following changes.
@kumekay Might give some hints for the compote
|
||
> Sharing knowledge is one of the most rewarding things you can do. | ||
|
||
Before continuing, the component we will write will be available on [GitHub](https://github.com), so this article will be focused on GitHub as our versioning platform and you will need an account in order to publish your own component. |
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.
Please point this link to some template, or example code, that can promote our contribution. Pointing just to Github.com does not bring much value.
|
||
{{< github repo="esp-rs/esp-rust-board" >}} | ||
|
||
### The new ESP-IDF I2C driver |
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.
Why somebody writing a new component should care about migration guide?
We should point the user how to write it in new style. IMO this part is good for separate article how to upgrade from old driver.
|
||
```yaml | ||
version: 1.0.0 | ||
targets: |
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.
While it's worth mentioning how can one list a specific target, for universal componet like this it might make sense to skip all the lines, which will be future proof and component could work with future chips introduced in ESP-IDF. I guess in this type of sensor, there is nothing specific which would require just specific family.
idf : ">=5.3" | ||
``` | ||
|
||
- **version**: This contains the component version following the version format `major.minor.patch` (0.0.0). |
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.
Please provide here a link to the version documentation, because people are often confused why is the version 1.2.3~8
.
- **targets**: This is the list of the supported targets. | ||
- **description**: Brief description about the component. | ||
- **url**: URL to the component page or company page. | ||
- **repository**: URL to the GitHub component repository ending with `.git`. |
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.
There are two options, using https://
or git@
. We should recommend the first option for public archives, since it does not requires authentication on GitHub.
|
||
On this task, the sensor will be woken up, the readout will be read and processed, and then the sensor will return to sleep mode. | ||
|
||
#### Bonus |
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.
I would recommend to rename the chapter from bonus to Creating Kconfig (optional).
Many people do not know about the Kconfig and how to use it. This might be good source for a new article.
matrix: | ||
idf_ver: ["release-v5.3", "latest"] | ||
runs-on: ubuntu-22.04 | ||
container: espressif/idf:${{ matrix.idf_ver }} |
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.
Please, consider using espressif/[email protected]
. Using containers may cause additional issues.
https://github.com/georgik/esp32-sdl3-example/blob/main/.github/workflows/build.yml#L48
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Upload components to component service |
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.
Consider adding CI tests before pushing the component to registry:
https://github.com/georgik/esp32-sdl3-example/blob/main/.github/workflows/test.yml
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.
I prefer to write something later.
</figure> | ||
|
||
```bash | ||
idf.py create-project-from-example "pedrominatel/shtc3^1.1.0:shtc3_read" |
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.
Please, consider other commands to build and flash the project. The README after the creation does not contain instructions. It was necessary to perform:
idf.py set-target esp32c3
idf.py build flash monitor
Plus CTRL+]
to quit the monitor (this is confusing many people who would expect simple CTRL+C)
BTW: The app is rebooting:
I (288) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (296) main_task: Started on CPU0
I (296) main_task: Calling app_main()
I (296) gpio: GPIO[17]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40380102
0x40380102: _panic_handler at components/riscv/vectors.S:134
|
||
Publishing a component is not just about sharing code—it’s about sharing knowledge. When you contribute a component to the registry, you’re helping developers solve challenges and build better solutions. Depending on the impact and adoption of your component, you may gain recognition and appreciation from the developer community. | ||
|
||
This article is not just a guide on how to create an I2C component; it’s an encouragement for you to start sharing your work and expertise with others. Every contribution helps build a stronger, more collaborative community. |
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.
Add chapter with links:
- component registry
compote
(since it' might be better to upload from local computer furst before moving to GitHub)- link to repo with your sensors
781d1c6
to
be32f81
Compare
Description
This article is about how to create a new component with the I2C driver and use the GitHub Actions to publish the component to the Registry.
Related
SHTC3 Component
Testing
Checklist
Before submitting a Pull Request, please ensure the following: