Add ADC Channel parameter to the ADC API
Pull Request Overview
This pull request adds:
- a function that returns the number of ADC channels.
- updates the API functions to allow specifying the ADC channel by parameterising the existing functions
- improve the example by adding a while loop was added in the
adc.rsfile to test all available channels at once
Testing Strategy
This pull request was tested on a microbit.
TODO or Help Wanted
Feedback
Do we need this for an older version of the kernel? Or is OK if this only works on latest master of the kernel?
If the latter, it would be better to add a new get_counts command to the adc capsule and then use that command number. We made a mistake using command 0 for the count here, and if we fix it now that reduces the overhead for whenever tock 3.0 happens.
Do we need this for an older version of the kernel? Or is OK if this only works on latest master of the kernel?
If the latter, it would be better to add a new get_counts command to the adc capsule and then use that command number. We made a mistake using command 0 for the count here, and if we fix it now that reduces the overhead for whenever tock 3.0 happens.
This should work with the current version of the kernel. The kernel driver does not have a special command for returning the number of channels, command 0 still does this.
@nikkoxp please modify the tests.