adc_read() not checking for error conditions #1575

Closed
opened 2023-12-05 21:37:01 -06:00 by ruehlchris · 2 comments
ruehlchris commented 2023-12-05 21:37:01 -06:00 (Migrated from github.com)

Hi,

while testing the ADC single read I become aware that the current implementation not check for error conditions, only
look for the ADC_CS_READY_BITS.

I suggest to change the return value from a uint32_t to int32_t and return a negative value if
ADC_CS_ERR_BITS or ADC_CS_ERR_STICKY_BITS had been raised.

Here is what I used in my implementation.

int32_t_adc_read.patch.gz

You may consider to change the implementation.

Chris

Hi, while testing the ADC single read I become aware that the current implementation not check for error conditions, only look for the ADC_CS_READY_BITS. I suggest to change the return value from a uint32_t to int32_t and return a negative value if ADC_CS_ERR_BITS or ADC_CS_ERR_STICKY_BITS had been raised. Here is what I used in my implementation. [int32_t_adc_read.patch.gz](https://github.com/raspberrypi/pico-sdk/files/13575534/int32_t_adc_read.patch.gz) You may consider to change the implementation. Chris
lurch commented 2023-12-08 06:51:53 -06:00 (Migrated from github.com)

@ruehlchris If you're suggesting a code-change, it's generally better to do that by submitting a Pull Request to the develop branch, than to attach a .patch.gz file to an Issue.

@ruehlchris If you're suggesting a code-change, it's generally better to do that by submitting a Pull Request to the `develop` branch, than to attach a `.patch.gz` file to an Issue.
ruehlchris commented 2023-12-10 21:06:51 -06:00 (Migrated from github.com)

Thanks,

I will have pull request ready soon.

Thanks, I will have pull request ready soon.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1575
No description provided.