Skip to content

Exposing get_adc_channel function #1669

Closed
@askuric

Description

@askuric

Is your feature request/improvement related to a problem? Please describe.
It would be beneficial for developers to be able to get the ADC channel of their pin.
You have already developed the code for that in your analog.cpp but the functions are private (not in the analog.h)

Describe the solution you'd like

If it is possible to add the line

uint32_t get_adc_channel(PinName pin, uint32_t *bank)

to the analog.h

Describe alternatives you've considered

Maybe an api implementation could be extended to support such requests, but as you have already implemented this functionality it is a shame not to provide it to the users :D

Additional context

My context is SimpleFOClibrary implementation where we need to do injected channel pwm triggered ADC implementation in a generic manner and we will need to determine the ADC_CHANNEL_x channel and ADCx instance from the pin name.

If you'd like I can do a quick PR for this.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions