Temporary deletion of files due to problems with the CVS repository

This commit is contained in:
adamdunkels 2006-06-18 08:07:14 +00:00
parent ba681f47d6
commit 5dd3e30a4f
6 changed files with 0 additions and 627 deletions

View File

@ -1,99 +0,0 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: battery-sensor.c,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
*
* -----------------------------------------------------------------
*
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
* Created : 2005-11-01
* Updated : $Date: 2006/06/18 07:49:33 $
* $Revision: 1.1 $
*/
#include "dev/battery-sensor.h"
#include <io.h>
#include "dev/irq.h"
const struct sensors_sensor battery_sensor;
static unsigned int battery_value;
/*---------------------------------------------------------------------------*/
static void
init(void)
{
battery_value = 0;
}
/*---------------------------------------------------------------------------*/
static int
irq(void)
{
battery_value = ADC12MEM6;
return 0;
}
/*---------------------------------------------------------------------------*/
static void
activate(void)
{
irq_adc12_activate(&battery_sensor, 6, (INCH_4 + SREF_0));
}
/*---------------------------------------------------------------------------*/
static void
deactivate(void)
{
irq_adc12_deactivate(&battery_sensor, 6);
battery_value = 0;
}
/*---------------------------------------------------------------------------*/
static int
active(void)
{
return irq_adc12_active(6);
}
/*---------------------------------------------------------------------------*/
static unsigned int
value(int type)
{
return battery_value;
}
/*---------------------------------------------------------------------------*/
static int
configure(int type, void *c)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static void *
status(int type)
{
return NULL;
}
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(battery_sensor, BATTERY_SENSOR,
init, irq, activate, deactivate, active,
value, configure, status);

View File

@ -1,48 +0,0 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: battery-sensor.h,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
*
* -----------------------------------------------------------------
*
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
* Created : 2005-11-01
* Updated : $Date: 2006/06/18 07:49:33 $
* $Revision: 1.1 $
*/
#ifndef __BATTERY_SENSOR_H__
#define __BATTERY_SENSOR_H__
#include "lib/sensors.h"
extern const struct sensors_sensor battery_sensor;
#define BATTERY_SENSOR "Battery"
#endif /* __BATTERY_SENSOR_H__ */

View File

@ -1,164 +0,0 @@
/*
* Copyright (c) 2005, Swedish Institute of Computer Science
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: beep.c,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
*/
#include <io.h>
#include "contiki-esb.h"
/*
* Flag to indicate if any of these functions should generate a sound
* or not The function is used beep_off() to to change this flag so
* none of the functions will generate sounds.
*/
static unsigned char beep_flag = BEEP_ON;
/*
* BEEPER_BIT is the bit in the io-register that is connected to the actual
* beeper, setting the bit high vill generate a high pitch tone.
*/
#define BEEPER_BIT 0x08
/*-----------------------------------------------------------------------------------*/
void
beep_alarm(int alarmmode, int len)
{
len = len / 200;
while(len > 0) {
/*
* Check here if we should beep or not since if we do it outside the
* while loop the call to this function would take muck less time, i.e.
* beep_flag would have side effects that might not be predictable.
*/
if(beep_flag & BEEP_ON) {
if((alarmmode == BEEP_ALARM1) && ((len & 7) > 4)) {
P2OUT |= BEEPER_BIT;
} else if((alarmmode == BEEP_ALARM2) && ((len & 15) > 12)) {
P2OUT |= BEEPER_BIT;
} else {
P2OUT &= ~BEEPER_BIT;
}
}
clock_delay(200);
len--;
}
P2OUT &= ~BEEPER_BIT;
}
/*-----------------------------------------------------------------------------------*/
void
beep_beep(int i)
{
if(beep_flag & BEEP_ON) {
/* Beep. */
P2OUT |= BEEPER_BIT;
clock_delay(i);
P2OUT &= ~BEEPER_BIT;
}
}
/*-----------------------------------------------------------------------------------*/
void
beep(void)
{
beep_beep(20);
}
/*-----------------------------------------------------------------------------------*/
void
beep_down(int d)
{
int i;
for(i = 8; i < d; i += i / 8) {
beep_beep(10);
clock_delay(i);
}
}
/*-----------------------------------------------------------------------------------*/
void
beep_on(void)
{
beep_flag |= BEEP_ON;
}
/*-----------------------------------------------------------------------------------*/
void
beep_off(void)
{
beep_flag &= ~BEEP_ON;
}
/*-----------------------------------------------------------------------------------*/
void
beep_spinup(void)
{
unsigned int i;
for(i = 10000; i > 80; i -= i / 20) {
beep_beep(2);
clock_delay(i);
}
for(i = 4980; i > 2000; i -= 20) {
leds_on(LEDS_ALL);
clock_delay(5000 - i);
leds_off(LEDS_ALL);
clock_delay(i);
}
}
/*-----------------------------------------------------------------------------------*/
void
beep_quick(int n)
{
int i;
for(i = 0; i < n; ++i) {
beep_beep(2000);
clock_delay(20000);
}
}
/*-----------------------------------------------------------------------------------*/
void beep_long(clock_time_t len) {
/*
* Check if the beeper is turned on or off, i.e. if a call should generate
* a noise or not.
*/
if(beep_flag & BEEP_ON) {
/* Turn on the beeper. */
P2OUT |= BEEPER_BIT;
}
clock_wait(len);
if(beep_flag & BEEP_ON) {
/* Turn the beeper off. */
P2OUT &= ~BEEPER_BIT;
}
}
/*-----------------------------------------------------------------------------------*/

View File

@ -1,166 +0,0 @@
/*
* Copyright (c) 2005, Swedish Institute of Computer Science
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: beep.h,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
*/
/**
* \addtogroup esb
* @{
*/
/**
* \defgroup beeper Beeper interface
* @{
*/
/**
* \file
* Interface to the beeper.
* \author Adam Dunkels <adam@sics.se>
*
*/
#ifndef __BEEP_H__
#define __BEEP_H__
#define BEEP_ON 1
#define BEEP_OFF 0
#define BEEP_ALARM1 1
#define BEEP_ALARM2 2
#include "sys/clock.h"
/**
* Beep for a specified time.
*
* This function causes the beeper to beep for the specified time. The
* time is measured in the same units as for the clock_delay()
* function.
*
* \note This function will hang the CPU during the beep.
*
* \note This function will stop any beep that was on previously when this
* function ends.
*
* \note If the beeper is turned off with beep_off() this call will still
* take the same time, though it will be silent.
*
* \param len The length of the beep.
*
*/
void beep_beep(int len);
/**
* Beep an alarm for a specified time.
*
* This function causes the beeper to beep for the specified time. The
* time is measured in the same units as for the clock_delay()
* function.
*
* \note This function will hang the CPU during the beep.
*
* \note This function will stop any beep that was on previously when this
* function ends.
*
* \note If the beeper is turned off with beep_off() this call will still
* take the same time, though it will be silent.
*
* \param alarmmode The alarm mode (BEEP_ALARM1,BEEP_ALARM2)
* \param len The length of the beep.
*
*/
void beep_alarm(int alarmmode, int len);
/**
* Produces a quick click-like beep.
*
* This function produces a short beep that sounds like a click.
*
*/
void beep(void);
/**
* A beep with a pitch-bend down.
*
* This function produces a pitch-bend sound with deecreasing
* frequency.
*
* \param len The length of the pitch-bend.
*
*/
void beep_down(int len);
/**
* Turn the beeper on.
*
* This function turns on the beeper. The beeper is turned off with
* the beep_off() function.
*/
void beep_on(void);
/**
* Turn the beeper off.
*
* This function turns the beeper off after it has been turned on with
* beep_on().
*/
void beep_off(void);
/**
* Produce a sound similar to a hard-drive spinup.
*
* This function produces a sound that is intended to be similar to
* the sound a hard-drive makes when it starts.
*
*/
void beep_spinup(void);
/**
* Beep for a long time (seconds)
*
* This function produces a beep with the specified length and will
* not return until the beep is complete. The length of the beep is
* specified using CLOCK_SECOND: a two second beep is CLOCK_SECOND *
* 2, and a quarter second beep is CLOCK_SECOND / 4.
*
* \note If the beeper is turned off with beep_off() this call will still
* take the same time, though it will be silent.
*
* \param len The length of the beep, measured in units of CLOCK_SECOND
*/
void beep_long(clock_time_t len);
void beep_quick(int num);
/** @} */
/** @} */
#endif /* __BEEP_H__ */

View File

@ -1,108 +0,0 @@
/*
* Copyright (c) 2005, Swedish Institute of Computer Science
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: button-sensor.c,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
*/
#include "contiki-esb.h"
const struct sensors_sensor button_sensor;
static struct timer debouncetimer;
HWCONF_PIN(BUTTON, 2, 7);
HWCONF_IRQ(BUTTON, 2, 7);
/*---------------------------------------------------------------------------*/
static void
init(void)
{
timer_set(&debouncetimer, 0);
BUTTON_IRQ_EDGE_SELECTD();
BUTTON_SELECT();
BUTTON_MAKE_INPUT();
}
/*---------------------------------------------------------------------------*/
static int
irq(void)
{
if(BUTTON_CHECK_IRQ()) {
if(timer_expired(&debouncetimer)) {
timer_set(&debouncetimer, CLOCK_SECOND / 4);
sensors_changed(&button_sensor);
return 1;
}
}
return 0;
}
/*---------------------------------------------------------------------------*/
static void
activate(void)
{
sensors_add_irq(&button_sensor, BUTTON_IRQ_PORT());
BUTTON_ENABLE_IRQ();
}
/*---------------------------------------------------------------------------*/
static void
deactivate(void)
{
BUTTON_DISABLE_IRQ();
sensors_remove_irq(&button_sensor, BUTTON_IRQ_PORT());
}
/*---------------------------------------------------------------------------*/
static int
active(void)
{
return BUTTON_IRQ_ENABLED();
}
/*---------------------------------------------------------------------------*/
static unsigned int
value(int type)
{
return BUTTON_READ() || !timer_expired(&debouncetimer);
}
/*---------------------------------------------------------------------------*/
static int
configure(int type, void *c)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static void *
status(int type)
{
return NULL;
}
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(button_sensor, BUTTON_SENSOR,
init, irq, activate, deactivate, active,
value, configure, status);

View File

@ -1,42 +0,0 @@
/*
* Copyright (c) 2005, Swedish Institute of Computer Science
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: button-sensor.h,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
*/
#ifndef __BUTTON_SENSOR_H__
#define __BUTTON_SENSOR_H__
#include "lib/sensors.h"
extern const struct sensors_sensor button_sensor;
#define BUTTON_SENSOR "Button"
#endif /* __BUTTON_SENSOR_H__ */