optional interrupts and more - #2
Open
Vigeant wants to merge 2 commits into
Open
Conversation
Added the ability to use or not interrupts for all conversions. streamlined the logic that checks for end of conversion for all functions. replaced the custom delay function with the freertos one. We could make this optional but when running on freertos, its better to use vTaskDelay to yield the processor.
Owner
|
Hi @Vigeant Sorry for the delay in updating the driver, I've been using the new ESP-IDF i2c driver for a while now, but I forgot to push it. I just updated it, it also works with interrupts, which is the way I use it. Anyway, I'll keep an eye on your work and your suggestions to improve this driver, thanks a lot! To initialize the driver in interrupt mode use the next code |
Author
|
Hi Mauricio, your last commit has no changes from the previous.
…On Wed, Jan 22, 2025, 10:49 p.m. Mauricio Barroso Benavides < ***@***.***> wrote:
Hi @Vigeant <https://github.com/Vigeant> Sorry for the delay in updating
the driver, I've been using the new ESP-IDF i2c driver for a while now, but
I forgot to push it. I just updated it, it also works with interrupts,
which is the way I use it. Anyway, I'll keep an eye on your work and your
suggestions to improve this driver, thanks a lot!
To initialize the driver in interrupt mode use the next code
ret = ads101x_init(&me->adc, ADS101X_MODEL_5, int_pin, i2c_bus_handle, ADS101X_I2C_ADDRESS);
if (ret != ESP_OK) {
return ESP_FAIL;
}
ads101x_set_gain(&me->adc, ADS101X_GAIN_ONE);
ads101x_set_data_rate(&me->adc, ADS101X_DATA_RATE_3300SPS);
—
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIRPK7YLYZYWHNE7EX4W532MBRDRAVCNFSM6AAAAABVWLZ4MSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBYG44TCNBQGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Author
|
Also I closed the issue as you were actually using the new driver but still
had a reference to the old in your makefile
On Wed, Jan 22, 2025, 10:59 p.m. Guillaume Vigeant <
***@***.***> wrote:
… Hi Mauricio, your last commit has no changes from the previous.
On Wed, Jan 22, 2025, 10:49 p.m. Mauricio Barroso Benavides <
***@***.***> wrote:
> Hi @Vigeant <https://github.com/Vigeant> Sorry for the delay in updating
> the driver, I've been using the new ESP-IDF i2c driver for a while now, but
> I forgot to push it. I just updated it, it also works with interrupts,
> which is the way I use it. Anyway, I'll keep an eye on your work and your
> suggestions to improve this driver, thanks a lot!
>
> To initialize the driver in interrupt mode use the next code
>
> ret = ads101x_init(&me->adc, ADS101X_MODEL_5, int_pin, i2c_bus_handle, ADS101X_I2C_ADDRESS);
>
> if (ret != ESP_OK) {
> return ESP_FAIL;
> }
>
> ads101x_set_gain(&me->adc, ADS101X_GAIN_ONE);
> ads101x_set_data_rate(&me->adc, ADS101X_DATA_RATE_3300SPS);
>
> —
> Reply to this email directly, view it on GitHub
> <#2 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABIRPK7YLYZYWHNE7EX4W532MBRDRAVCNFSM6AAAAABVWLZ4MSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBYG44TCNBQGQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
Owner
|
@Vigeant Sorry, you're right, I didn't realize I still had that remnant of my own i2c bus driver. I've already corrected it, thanks for noticing. |
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.
Thanks for the driver man. You saved me a ton of time. I made some changes to make interupt optional as all I have going to my adc1015 is i2c.
Feel free to refuse or heavily tweak this PR as I did add an include for FreeRTOS which works in my project but not sure its done right.
Added the ability to use or not interrupts for all conversions. streamlined the logic that checks for end of conversion for all functions. replaced the custom delay function with the freertos one. We could make this optional but when running on freertos, its better to use vTaskDelay to yield the processor.
Also, should consider blocking on a mutex instead of busy waiting when using interupts as it would also allow yielding the processor until the mutex is released by the isr.