fixed battery sensor for sky platform
This commit is contained in:
parent
8748230ead
commit
5b1c229754
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: contiki-sky-main.c,v 1.36 2008/09/18 17:58:21 joxe Exp $
|
* @(#)$Id: contiki-sky-main.c,v 1.37 2008/09/18 21:29:06 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
#include "dev/ds2411.h"
|
#include "dev/ds2411.h"
|
||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
#include "dev/light.h"
|
#include "dev/light.h"
|
||||||
|
#include "dev/battery-sensor.h"
|
||||||
#include "dev/serial.h"
|
#include "dev/serial.h"
|
||||||
#include "dev/sht11.h"
|
#include "dev/sht11.h"
|
||||||
#include "dev/cc2420.h"
|
#include "dev/cc2420.h"
|
||||||
|
@ -234,6 +235,7 @@ main(int argc, char **argv)
|
||||||
* Initialize light and humitity/temp sensors.
|
* Initialize light and humitity/temp sensors.
|
||||||
*/
|
*/
|
||||||
sensors_light_init();
|
sensors_light_init();
|
||||||
|
battery_sensor.activate();
|
||||||
sht11_init();
|
sht11_init();
|
||||||
|
|
||||||
ctimer_init();
|
ctimer_init();
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: battery-sensor.c,v 1.1 2007/11/13 20:29:07 adamdunkels Exp $
|
* $Id: battery-sensor.c,v 1.2 2008/09/18 21:29:06 joxe Exp $
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------
|
* -----------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
||||||
* Created : 2005-11-01
|
* Created : 2005-11-01
|
||||||
* Updated : $Date: 2007/11/13 20:29:07 $
|
* Updated : $Date: 2008/09/18 21:29:06 $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dev/battery-sensor.h"
|
#include "dev/battery-sensor.h"
|
||||||
|
@ -60,21 +60,26 @@ irq(void)
|
||||||
static void
|
static void
|
||||||
activate(void)
|
activate(void)
|
||||||
{
|
{
|
||||||
SVSCTL = 0xf0;
|
/* This assumes that some other sensor system already did setup the ADC */
|
||||||
|
/* (in the case of the sky platform it is sensors_light_init that does it) */
|
||||||
|
|
||||||
P6SEL |= 0x80;
|
P6SEL |= 0x80;
|
||||||
P6DIR = 0xff;
|
P6DIR = 0xff;
|
||||||
P6OUT = 0x00;
|
P6OUT = 0x00;
|
||||||
|
|
||||||
/* Set up the ADC. */
|
|
||||||
// ADC12CTL2 = SHT0_6 + SHT1_6 + MSC; // Setup ADC12, ref., sampling time
|
|
||||||
ADC12MCTL2 = (INCH_11 + SREF_0);
|
|
||||||
|
|
||||||
/* ADC12CTL2 |= ADC12ON + REFON; */
|
/* stop converting immediately */
|
||||||
|
ADC12CTL0 &= ~ENC;
|
||||||
|
ADC12CTL1 &= ~CONSEQ_3;
|
||||||
|
|
||||||
/* ADC12CTL2 |= ENC; // enable conversion */
|
/* Configure ADC12_2 to sample channel 11 (voltage) and use */
|
||||||
/* ADC12CTL2 |= ADC12SC; // sample & convert */
|
/* the Vref+ as reference (SREF_1) since it is a stable reference */
|
||||||
|
ADC12MCTL2 = (INCH_11 + SREF_1);
|
||||||
|
|
||||||
// Irq_adc12_activate(&battery_sensor, 6, (INCH_11 + SREF_0));
|
ADC12CTL1 |= CONSEQ_3;
|
||||||
|
ADC12CTL0 |= ENC | ADC12SC;
|
||||||
|
|
||||||
|
/* Irq_adc12_activate(&battery_sensor, 6, (INCH_11 + SREF_1)); */
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue