changed sky sensors to new api

This commit is contained in:
joxe 2010-01-14 13:53:06 +00:00
parent 84d969ce85
commit 4a3953204f
6 changed files with 236 additions and 120 deletions

View file

@ -26,14 +26,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: acc-sensor.c,v 1.3 2009/05/08 16:03:50 joxe Exp $
* $Id: acc-sensor.c,v 1.4 2010/01/14 13:53:06 joxe Exp $
*
* -----------------------------------------------------------------
*
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
* Created : 2005-11-01
* Updated : $Date: 2009/05/08 16:03:50 $
* $Revision: 1.3 $
* Updated : $Date: 2010/01/14 13:53:06 $
* $Revision: 1.4 $
*/
#include "dev/acc-sensor.h"
@ -43,19 +43,8 @@
#include <stdio.h>
const struct sensors_sensor acc_sensor;
static uint8_t active;
/*---------------------------------------------------------------------------*/
static void
init(void)
{
}
/*---------------------------------------------------------------------------*/
static int
irq(void)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static void
activate(void)
@ -87,6 +76,7 @@ activate(void)
ADC12CTL0 |= ENC | ADC12SC;
/* Irq_adc12_activate(&acc_sensor, 6, (INCH_11 + SREF_1)); */
active = 1;
}
/*---------------------------------------------------------------------------*/
static void
@ -94,12 +84,7 @@ deactivate(void)
{
/* irq_adc12_deactivate(&acc_sensor, 6);
acc_value = 0;*/
}
/*---------------------------------------------------------------------------*/
static int
active(void)
{
return 0; /* irq_adc12_active(6);*/
active = 0;
}
/*---------------------------------------------------------------------------*/
static unsigned int
@ -121,15 +106,27 @@ value(int type)
static int
configure(int type, void *c)
{
switch(type) {
case SENSORS_ACTIVE:
if (c) {
activate();
} else {
deactivate();
}
}
return 0;
}
/*---------------------------------------------------------------------------*/
static void *
status(int type)
{
switch (type) {
case SENSORS_ACTIVE:
case SENSORS_READY:
return (void *) active;
}
return NULL;
}
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(acc_sensor, ACC_SENSOR,
init, irq, activate, deactivate, active,
value, configure, status);