From 6e39b4d191e5598add355fcc08cebe9d8cc1ba09 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:25:20 +0100 Subject: [PATCH 01/19] drivers/periph: adc_sample() now returns int32_t Reasoning: This allow support for ADCs with resolution of more than 16 bits on 8 bit and 16 bit platforms. --- drivers/include/periph/adc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/include/periph/adc.h b/drivers/include/periph/adc.h index d4e6458b3e..16105c355d 100644 --- a/drivers/include/periph/adc.h +++ b/drivers/include/periph/adc.h @@ -56,6 +56,7 @@ #define PERIPH_ADC_H #include +#include #include "periph_cpu.h" #include "periph_conf.h" @@ -125,7 +126,7 @@ int adc_init(adc_t line); * @return the sampled value on success * @return -1 if resolution is not applicable */ -int adc_sample(adc_t line, adc_res_t res); +int32_t adc_sample(adc_t line, adc_res_t res); #ifdef __cplusplus } From 3c7d95de02ae0e6674732a50943ed7741a27e853 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:30:08 +0100 Subject: [PATCH 02/19] cpu/atmega_common/periph: adc_sample() now returns int32_t --- cpu/atmega_common/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/atmega_common/periph/adc.c b/cpu/atmega_common/periph/adc.c index e0be23ada6..13c6b54ca6 100644 --- a/cpu/atmega_common/periph/adc.c +++ b/cpu/atmega_common/periph/adc.c @@ -99,7 +99,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample = 0; From c4a84f01c02113bd89a2c67caa6113907b55986c Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:30:20 +0100 Subject: [PATCH 03/19] cpu/cc2538/periph: adc_sample() now returns int32_t --- cpu/cc2538/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/cc2538/periph/adc.c b/cpu/cc2538/periph/adc.c index 3b8a705389..07ab6fc3ad 100644 --- a/cpu/cc2538/periph/adc.c +++ b/cpu/cc2538/periph/adc.c @@ -51,7 +51,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { /* check if adc line valid */ if (line >= ADC_NUMOF) { From 80787d523ec6f8d7f011022559cc020ddbbfa179 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:30:31 +0100 Subject: [PATCH 04/19] cpu/efm32/periph: adc_sample() now returns int32_t --- cpu/efm32/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/efm32/periph/adc.c b/cpu/efm32/periph/adc.c index 01b2e52429..345d267292 100644 --- a/cpu/efm32/periph/adc.c +++ b/cpu/efm32/periph/adc.c @@ -59,7 +59,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { /* resolutions larger than 12 bits are not supported */ if (res >= ADC_MODE_UNDEF(0)) { From 746e4d2fba547db2b5fa0e72be0791aad8516744 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:30:38 +0100 Subject: [PATCH 05/19] cpu/esp32/periph: adc_sample() now returns int32_t --- cpu/esp32/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/esp32/periph/adc.c b/cpu/esp32/periph/adc.c index 8dd816de5d..b38476df63 100644 --- a/cpu/esp32/periph/adc.c +++ b/cpu/esp32/periph/adc.c @@ -149,7 +149,7 @@ int adc_init(adc_t line) } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { CHECK_PARAM_RET (line < ADC_NUMOF, -1) CHECK_PARAM_RET (res <= ADC_RES_12BIT, -1) From 55dc429d1117d3f0a1d3e9fbafcd1c61aa75f1e3 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:30:48 +0100 Subject: [PATCH 06/19] cpu/esp8266/periph: adc_sample() now returns int32_t --- cpu/esp8266/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/esp8266/periph/adc.c b/cpu/esp8266/periph/adc.c index 6615cfed18..a5f4b498c4 100644 --- a/cpu/esp8266/periph/adc.c +++ b/cpu/esp8266/periph/adc.c @@ -42,7 +42,7 @@ int adc_init(adc_t line) } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { CHECK_PARAM_RET (line < ADC_NUMOF, -1) CHECK_PARAM_RET (res == ADC_RES_10BIT, -1) From 7387cd43d9c23b9fa8363744568a156fe227bec8 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:31:03 +0100 Subject: [PATCH 07/19] cpu/kinetis/periph: adc_sample() now returns int32_t --- cpu/kinetis/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/kinetis/periph/adc.c b/cpu/kinetis/periph/adc.c index 2648637578..3b9b78cbd0 100644 --- a/cpu/kinetis/periph/adc.c +++ b/cpu/kinetis/periph/adc.c @@ -207,7 +207,7 @@ int adc_init(adc_t line) return res; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample; From c332501eb85726c75579e0a406f9f54d71b73a16 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:31:20 +0100 Subject: [PATCH 08/19] cpu/lm4f120/periph: adc_sample() now returns int32_t --- cpu/lm4f120/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/lm4f120/periph/adc.c b/cpu/lm4f120/periph/adc.c index 756698d4e2..ca4077978a 100644 --- a/cpu/lm4f120/periph/adc.c +++ b/cpu/lm4f120/periph/adc.c @@ -100,7 +100,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int value[2]; From a468af79a467ecc776cf49c163080e1f91991623 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:31:30 +0100 Subject: [PATCH 09/19] cpu/nrf51/periph: adc_sample() now returns int32_t --- cpu/nrf51/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/nrf51/periph/adc.c b/cpu/nrf51/periph/adc.c index 4a95a169ba..996b3f943f 100644 --- a/cpu/nrf51/periph/adc.c +++ b/cpu/nrf51/periph/adc.c @@ -55,7 +55,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int val; From 186d2ccfa45eecef57117c5976b28cec8ba05ccb Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:31:38 +0100 Subject: [PATCH 10/19] cpu/nrf52/periph: adc_sample() now returns int32_t --- cpu/nrf52/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/nrf52/periph/adc.c b/cpu/nrf52/periph/adc.c index 7ecd219784..4559c351f6 100644 --- a/cpu/nrf52/periph/adc.c +++ b/cpu/nrf52/periph/adc.c @@ -103,7 +103,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { assert(line < ADC_NUMOF); From 47cb59e6e5dacc3d9266ebfc67fdca0ffb2dec5d Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:31:54 +0100 Subject: [PATCH 11/19] cpu/sam0_common/periph: adc_sample() now returns int32_t --- cpu/sam0_common/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/sam0_common/periph/adc.c b/cpu/sam0_common/periph/adc.c index 7760a2b935..c1d11bf2a2 100644 --- a/cpu/sam0_common/periph/adc.c +++ b/cpu/sam0_common/periph/adc.c @@ -164,7 +164,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { if (line >= ADC_NUMOF) { DEBUG("adc: line arg not applicable\n"); From 2247263a7891f5f78e30d55de2b3c68ef90afb9f Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:32:06 +0100 Subject: [PATCH 12/19] cpu/sam3/periph: adc_sample() now returns int32_t --- cpu/sam3/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/sam3/periph/adc.c b/cpu/sam3/periph/adc.c index 1c2651e670..7cd58b652e 100644 --- a/cpu/sam3/periph/adc.c +++ b/cpu/sam3/periph/adc.c @@ -68,7 +68,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { assert(line < ADC_NUMOF); From 09b45066ce75858bb7920eb6b561e6f0693b1b5d Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:32:17 +0100 Subject: [PATCH 13/19] cpu/stm32f0/periph: adc_sample() now returns int32_t --- cpu/stm32f0/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32f0/periph/adc.c b/cpu/stm32f0/periph/adc.c index fe97e5e46b..8ae960dfc8 100644 --- a/cpu/stm32f0/periph/adc.c +++ b/cpu/stm32f0/periph/adc.c @@ -75,7 +75,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample; From 05d1ce6b584526d58728734121cbb9fac0870672 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:32:26 +0100 Subject: [PATCH 14/19] cpu/stm32f1/periph: adc_sample() now returns int32_t --- cpu/stm32f1/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32f1/periph/adc.c b/cpu/stm32f1/periph/adc.c index 83c215b448..2c68df9430 100644 --- a/cpu/stm32f1/periph/adc.c +++ b/cpu/stm32f1/periph/adc.c @@ -125,7 +125,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample; From 7dbd9e3e56b67ab86ef9bb75ccc9f3e3400d2d5b Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:32:32 +0100 Subject: [PATCH 15/19] cpu/stm32f2/periph: adc_sample() now returns int32_t --- cpu/stm32f2/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32f2/periph/adc.c b/cpu/stm32f2/periph/adc.c index 041979d681..ccaa90c438 100644 --- a/cpu/stm32f2/periph/adc.c +++ b/cpu/stm32f2/periph/adc.c @@ -111,7 +111,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample; From eaf2eeaf84f2609dfda2b659d0837763db70fcc8 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:32:51 +0100 Subject: [PATCH 16/19] cpu/stm32f4/periph: adc_sample() now returns int32_t --- cpu/stm32f4/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32f4/periph/adc.c b/cpu/stm32f4/periph/adc.c index 4d07a93364..80cb2ead6d 100644 --- a/cpu/stm32f4/periph/adc.c +++ b/cpu/stm32f4/periph/adc.c @@ -94,7 +94,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample; From cff0d4033eadc95f88445c5ef187eeb416f527fb Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:33:01 +0100 Subject: [PATCH 17/19] cpu/stm32l0/periph: adc_sample() now returns int32_t --- cpu/stm32l0/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32l0/periph/adc.c b/cpu/stm32l0/periph/adc.c index cbb9a3cd3b..0693dcea2d 100644 --- a/cpu/stm32l0/periph/adc.c +++ b/cpu/stm32l0/periph/adc.c @@ -123,7 +123,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample; From b3c8339c2c26cb8ceca3b2ad35ce060080b1644c Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:33:08 +0100 Subject: [PATCH 18/19] cpu/stm32l4/periph: adc_sample() now returns int32_t --- cpu/stm32l4/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32l4/periph/adc.c b/cpu/stm32l4/periph/adc.c index 7b9340ca9d..3a567fd484 100644 --- a/cpu/stm32l4/periph/adc.c +++ b/cpu/stm32l4/periph/adc.c @@ -179,7 +179,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample; From fabbae8b0592a872dfd776f98ab17453c9adbf0d Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 8 Jan 2020 15:33:19 +0100 Subject: [PATCH 19/19] cpu/stm32l1/periph: adc_sample() now returns int32_t --- cpu/stm32l1/periph/adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32l1/periph/adc.c b/cpu/stm32l1/periph/adc.c index 497f020012..8cebee2fc9 100644 --- a/cpu/stm32l1/periph/adc.c +++ b/cpu/stm32l1/periph/adc.c @@ -152,7 +152,7 @@ int adc_init(adc_t line) return 0; } -int adc_sample(adc_t line, adc_res_t res) +int32_t adc_sample(adc_t line, adc_res_t res) { int sample;