Dear all ,
I want to test adc with R21 board, something already done by many people.
The repository I use is [1].
After having tried almost all adc examples I get the following output.
/home/RIOT/examples/gnrc_networking/sensor.c: In function ‘r21_sensor_init’:
/home/RIOT/examples/gnrc_networking/sensor.c:6:5: error: implicit declaration of function ‘adc_init’ [-Werror=implicit-function-declaration]
if (adc_init(ADC_NUM, RES) == 0) {
^
In file included from /home/RIOT/examples/gnrc_networking/sensor.c:1:0:
/home/RIOT/examples/gnrc_networking/sensor.h:14:25: error: ‘ADC_RES_12BIT’ undeclared (first use in this function)
#define RES ADC_RES_12BIT
^
/home/RIOT/examples/gnrc_networking/sensor.c:6:27: note: in expansion of macro ‘RES’
if (adc_init(ADC_NUM, RES) == 0) {
^
/home/RIOT/examples/gnrc_networking/sensor.h:14:25: note: each undeclared identifier is reported only once for each function it appears in
#define RES ADC_RES_12BIT
^
/home/RIOT/examples/gnrc_networking/sensor.c:6:27: note: in expansion of macro ‘RES’
if (adc_init(ADC_NUM, RES) == 0) {
^
/home/RIOT/examples/gnrc_networking/sensor.c: In function ‘r21_getValue’:
/home/RIOT/examples/gnrc_networking/sensor.c:18:5: error: implicit declaration of function ‘adc_sample’ [-Werror=implicit-function-declaration]
*value = adc_sample(ADC_NUM, ADC_CH);
^
cc1: all warnings being treated as errors
make[1]: *** [/home/RIOT/examples/gnrc_networking/bin/samr21-xpro/gnrc_networking/sensor.o] Error 1
make: *** [all] Error 2
I attach my last configuration (Its from watr.li project ).
Thank you in advance!
Your Faithfully,
Ilias
[1] https://github.com/kaspar030/RIOT/tree/ethos_br_hack
Dear Ilias,
without looking into this in any detail: are you sure you have included
"periph/adc.h"?
Cheers,
Oleg
Dear Oleg,
Thank you for your reply.
I am sorry I didn’t mention that or didn’t include my “include” statements,
but I took it for granted that you will know that I used “include periph/adc.h”
as well as “include periph/gpio.h”.Furthermore, I used the “FEATURES_REQUIRED = periph_adc periph_gpio”
statement in my Makefile.
Thats the weird, I have the files in the right directories but doesn’t work.(I even copied them from the watrli branch(The cpu foder)).
Mit besten Grüßen,
Ilias
Hi Ilias!
I am sorry I didn't mention that or didn't include my "include" statements,
but I took it for granted that you will know that I used "include
periph/adc.h"
That's okay, but still strange. The error message pretty much indicates a
compiler warning about missing function and datatype declarations. However,
all the declarations are definitely present in
https://github.com/RIOT-OS/RIOT/blob/master/drivers/include/periph/adc.h.
as well as "include periph/gpio.h".Furthermore, I used the
"FEATURES_REQUIRED = periph_adc periph_gpio"
statement in my Makefile.
This shouldn't effect this message anyway.
Thats the weird, I have the files in the right directories but doesn't
work.(I even copied them from the watrli branch(The cpu foder)).
Maybe you can share a pointer to the concrete application code you're working
on. Also, it might help to compile with `QUIET=0` and check if the -I
parameter looks somehow screwed.
Cheers,
Oleg
Hi again!
Forgot to say: when worse comes comes to worse, you can still try to compile
with WERROR=0 and let the compiler _not_ treat the warnings as errors.
However, I would rather recommend to find the reason for the warnings.
Cheers,
Oleg
Hi Ilias,
which driver (implementation) did you use? In current master there actually is no ADC driver for the samd21 and IIRC the state of the driver in watrli is based on a slightly different interface. Maybe [1] is of interest for you?
Best
Peter
[1]
Hello Ilias,
Indeed, as Peter mentioned, ADC for SAMR21 is in pending API updates.
Otherwise, using one of older branches providing older ADC API is simple to use,
see for instance
https://github.com/adjih/riot-apps/tree/master/adc-sensor
cheers,
– Cedric
Dear all,
I’m sorry for the late reply, a db problem came up.
Yes , I know that there is no adc in [1] , I copied(ported) the files from [2]
. I hope I will find some time tonight to try Oleg’s proposal.
Thank you in advance!
[1] https://github.com/kaspar030/RIOT/tree/ethos_br_hack
[2] https://github.com/watr-li/RIOT/tree/watrli