kopia lustrzana https://github.com/micropython/micropython
esp32/esp32c6: Add ADC support.
Signed-off-by: IhorNehrutsa <IhorNehrutsa@gmail.com>pull/11869/head
rodzic
f96a04a880
commit
a06d929729
|
@ -148,11 +148,13 @@ static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_p
|
||||||
}
|
}
|
||||||
|
|
||||||
static void madc_atten_helper(const machine_adc_obj_t *self, mp_int_t atten) {
|
static void madc_atten_helper(const machine_adc_obj_t *self, mp_int_t atten) {
|
||||||
esp_err_t err;
|
esp_err_t err = ESP_OK;
|
||||||
if (self->block->unit_id == ADC_UNIT_1) {
|
if (self->block->unit_id == ADC_UNIT_1) {
|
||||||
err = adc1_config_channel_atten(self->channel_id, atten);
|
err = adc1_config_channel_atten(self->channel_id, atten);
|
||||||
} else {
|
} else {
|
||||||
|
#if (SOC_ADC_PERIPH_NUM >= 2)
|
||||||
err = adc2_config_channel_atten(self->channel_id, atten);
|
err = adc2_config_channel_atten(self->channel_id, atten);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
mp_raise_ValueError(MP_ERROR_TEXT("invalid atten"));
|
mp_raise_ValueError(MP_ERROR_TEXT("invalid atten"));
|
||||||
|
|
Ładowanie…
Reference in New Issue