Lines Matching refs:channel_id
258 for (uint8_t channel_id = 0; channel_id < conf->channel_count; channel_id++) { in adc_esp32_fill_digi_pattern() local
261 *unit_attenuation = data->attenuation[channel_id]; in adc_esp32_fill_digi_pattern()
262 } else if (*unit_attenuation != data->attenuation[channel_id]) { in adc_esp32_fill_digi_pattern()
264 (unsigned int)channel_id, (unsigned int)conf->unit); in adc_esp32_fill_digi_pattern()
268 adc_digi_pattern_config->atten = data->attenuation[channel_id]; in adc_esp32_fill_digi_pattern()
269 adc_digi_pattern_config->channel = channel_id; in adc_esp32_fill_digi_pattern()
392 uint8_t channel_id = find_lsb_set(seq->channels) - 1; in adc_esp32_read() local
400 if (seq->channels > BIT(channel_id)) { in adc_esp32_read()
431 data->resolution[channel_id] = seq->resolution; in adc_esp32_read()
439 adc_set_data_width(conf->unit, data->resolution[channel_id]); in adc_esp32_read()
445 reading = adc1_get_raw(channel_id); in adc_esp32_read()
448 if (adc2_get_raw(channel_id, ADC_WIDTH_BIT_DEFAULT, &reading)) { in adc_esp32_read()
449 LOG_ERR("Conversion timeout on '%s' channel %d", dev->name, channel_id); in adc_esp32_read()
456 data->chars[channel_id].bit_width = data->resolution[channel_id]; in adc_esp32_read()
458 cal = cal_mv = esp_adc_cal_raw_to_voltage(reading, &data->chars[channel_id]); in adc_esp32_read()
461 if (data->attenuation[channel_id] == ADC_ATTEN_DB_12) { in adc_esp32_read()
469 atten_to_gain(data->attenuation[channel_id], &cal); in adc_esp32_read()
471 cal = (cal << data->resolution[channel_id]) / data->meas_ref_internal; in adc_esp32_read()
572 if (cfg->channel_id >= conf->channel_count) { in adc_esp32_channel_setup()
573 LOG_ERR("Unsupported channel id '%d'", cfg->channel_id); in adc_esp32_channel_setup()
592 if (gain_to_atten(cfg->gain, &data->attenuation[cfg->channel_id])) { in adc_esp32_channel_setup()
599 adc1_config_channel_atten(cfg->channel_id, data->attenuation[cfg->channel_id]); in adc_esp32_channel_setup()
602 adc2_config_channel_atten(cfg->channel_id, data->attenuation[cfg->channel_id]); in adc_esp32_channel_setup()
607 data->attenuation[cfg->channel_id], in adc_esp32_channel_setup()
608 data->resolution[cfg->channel_id], in adc_esp32_channel_setup()
610 &data->chars[cfg->channel_id]); in adc_esp32_channel_setup()
625 int io_num = adc_channel_io_map[conf->unit][cfg->channel_id]; in adc_esp32_channel_setup()
628 LOG_ERR("Channel %u not supported!", cfg->channel_id); in adc_esp32_channel_setup()