Mapping GPIO pins to ADC channel
Posted: Mon Mar 11, 2019 12:47 am
Hi guys,
I've searched and examined headers for quite some time but am yet to come up with an answer. Is there a function or macro that will map a gpio_num_t to adc1_channel_t? There is an adc1_pad_get_io_num function which converts adc1_channel_t to gpio_num_t (i.e. ADC channel to GPIO pin), but since the ADC channel isn't really used for anything except internally; it seems a bit pointless and an oversight not to have the inverse. At the moment I have to manually look up the channel for each pin, there appears to be no way programatically. Also, it surely would make sense for the adc1 functions to take a GPIO pin number rather than a specific ADC channel, or at least be overloaded to do both?
Thanks
-Eli
I've searched and examined headers for quite some time but am yet to come up with an answer. Is there a function or macro that will map a gpio_num_t to adc1_channel_t? There is an adc1_pad_get_io_num function which converts adc1_channel_t to gpio_num_t (i.e. ADC channel to GPIO pin), but since the ADC channel isn't really used for anything except internally; it seems a bit pointless and an oversight not to have the inverse. At the moment I have to manually look up the channel for each pin, there appears to be no way programatically. Also, it surely would make sense for the adc1 functions to take a GPIO pin number rather than a specific ADC channel, or at least be overloaded to do both?
Thanks
-Eli