8000 rp2/machine_adc: Only initialise the ADC periph if not already running. by dpgeorge · Pull Request #6834 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

rp2/machine_adc: Only initialise the ADC periph if not already running. #6834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ports/rp2/machine_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ STATIC mp_obj_t machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, s
}
}

adc_init();
// Initialise the ADC peripheral if it's not already running.
if (!(adc_hw->cs & ADC_CS_EN_BITS)) {
adc_init();
}

if (ADC_IS_VALID_GPIO(channel)) {
// Configure the GPIO pin in ADC mode.
Expand Down
0