1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #10936 from miri64/sam0_common/fix/check-adc-numof

sam0_common: check ADC_NUMOF on adc_init()
This commit is contained in:
Martine Lenders 2019-02-04 16:41:41 +01:00 committed by GitHub
commit 7220b66708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,6 +156,10 @@ static int _adc_configure(adc_res_t res)
int adc_init(adc_t line)
{
if (line >= ADC_NUMOF) {
DEBUG("adc: line arg not applicable\n");
return -1;
}
_prep();
gpio_init(adc_channels[line].pin, GPIO_IN);
gpio_init_mux(adc_channels[line].pin, GPIO_MUX_B);