Is there a way to specify which AIN should be used through the devicetree API? For example, here is a code snippet:
static struct adc_channel_cfg adc_meas_config =
{
.gain = ADC_GAIN_1_6,
.reference = ADC_REF_INTERNAL,
.acquisition_time = ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40),
.channel_id = 0,
.input_positive = NRF_SAADC_INPUT_AIN6
};
How would I use the devicetree API to replace the NRF_SAADC_INPUT_AIN6 in that assignment with something from the devicetree? I know how to do this with GPIO assignments like this:
In the DTS file:
control_pins {
compatible = "gpio-leds";
en_5v: en_5v {
gpios = <&gpio0 13 GPIO_INT_ACTIVE_HIGH>;
label = "5V Enable";
};
};
In the C file:
DT_GPIO_PIN_BY_IDX(DT_NODELABEL(en_5v), gpios, 0)