Add function to get the currently selected ADC channel #451

Merged
jonathangjertsen merged 1 commit from adc-channel-get into develop 2021-05-27 07:25:41 -05:00
jonathangjertsen commented 2021-05-27 04:01:12 -05:00 (Migrated from github.com)

This is most useful in combination with round-robin sampling to avoid having to track it manually.

This is most useful in combination with round-robin sampling to avoid having to track it manually.
lurch (Migrated from github.com) reviewed 2021-05-27 04:14:56 -05:00
@ -88,6 +88,15 @@ static inline void adc_select_input(uint input) {
hw_write_masked(&adc_hw->cs, input << ADC_CS_AINSEL_LSB, ADC_CS_AINSEL_BITS);
lurch (Migrated from github.com) commented 2021-05-27 04:05:58 -05:00

"ADC get input" is probably a bit ambiguous? It could either mean "get the input channel" or "get the input value" ? 😉

"ADC get input" is probably a bit ambiguous? It could either mean "get the input channel" or "get the input value" ? :wink:
lurch (Migrated from github.com) commented 2021-05-27 04:06:44 -05:00

Could you make this a \return statement please? See e.g. line 132

Could you make this a `\return` statement please? See e.g. line 132
lurch (Migrated from github.com) commented 2021-05-27 04:14:45 -05:00

@kilograham obviously has the final decision, but I wonder if a function name of adc_get_selected_input would be slightly clearer? (In hindsight I guess it's a shame that adc_select_input wasn't named adc_select_input_channel? Because that would allow this function to be named adc_get_input_channel.)

@kilograham obviously has the final decision, but I wonder if a function name of `adc_get_selected_input` would be slightly clearer? (In hindsight I guess it's a shame that `adc_select_input` wasn't named `adc_select_input_channel`? Because that would allow this function to be named `adc_get_input_channel`.)
jonathangjertsen commented 2021-05-27 04:20:41 -05:00 (Migrated from github.com)

Good suggestions @lurch , I've updated accordingly

Good suggestions @lurch , I've updated accordingly
lurch (Migrated from github.com) reviewed 2021-05-27 04:38:49 -05:00
@ -88,6 +88,15 @@ static inline void adc_select_input(uint input) {
hw_write_masked(&adc_hw->cs, input << ADC_CS_AINSEL_LSB, ADC_CS_AINSEL_BITS);
lurch (Migrated from github.com) commented 2021-05-27 04:38:49 -05:00

Don't need the "Returns". So just * \return The currently selected ...

Don't need the "Returns". So just ` * \return The currently selected ...`
lurch (Migrated from github.com) approved these changes 2021-05-27 05:05:08 -05:00
lurch (Migrated from github.com) left a comment

LGTM 👍

LGTM :+1:
kilograham (Migrated from github.com) reviewed 2021-05-27 07:24:39 -05:00
@ -88,6 +88,15 @@ static inline void adc_select_input(uint input) {
hw_write_masked(&adc_hw->cs, input << ADC_CS_AINSEL_LSB, ADC_CS_AINSEL_BITS);
kilograham (Migrated from github.com) commented 2021-05-27 07:24:38 -05:00

yes, thank adc_get_selected_input is the better name... i did go thru and tried to make all names logical and consistent but I may have missed a couple.

yes, thank adc_get_selected_input is the better name... i did go thru and tried to make all names logical and consistent but I may have missed a couple.
kilograham (Migrated from github.com) approved these changes 2021-05-27 07:25:31 -05:00
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!451
No description provided.