From 12ac8e1fb58146876a69c042cc7cf13e270ab146 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Wed, 11 Feb 2015 18:06:20 +0100 Subject: [PATCH] Initialise ADC in main, not in sensor drivers --- platform/cc2538dk/contiki-main.c | 3 +++ platform/cc2538dk/dev/als-sensor.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/cc2538dk/contiki-main.c b/platform/cc2538dk/contiki-main.c index 4487a07f2..71de03a10 100644 --- a/platform/cc2538dk/contiki-main.c +++ b/platform/cc2538dk/contiki-main.c @@ -43,6 +43,7 @@ */ /*---------------------------------------------------------------------------*/ #include "contiki.h" +#include "dev/adc.h" #include "dev/leds.h" #include "dev/sys-ctrl.h" #include "dev/scb.h" @@ -208,6 +209,8 @@ main(void) process_start(&tcpip_process, NULL); #endif /* NETSTACK_CONF_WITH_IPV6 */ + adc_init(); + process_start(&sensors_process, NULL); energest_init(); diff --git a/platform/cc2538dk/dev/als-sensor.c b/platform/cc2538dk/dev/als-sensor.c index 3630ac80e..2ecc857ea 100644 --- a/platform/cc2538dk/dev/als-sensor.c +++ b/platform/cc2538dk/dev/als-sensor.c @@ -79,7 +79,6 @@ configure(int type, int value) GPIO_SET_INPUT(GPIO_A_BASE, ADC_ALS_OUT_PIN_MASK); ioc_set_over(GPIO_A_NUM, ADC_ALS_OUT_PIN, IOC_OVERRIDE_ANA); - adc_init(); break; } return 0;