Contiki 2.5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
platform
inga
dev
acc-sensor.c
1
/* Acceleration sensor interface
2
* Author : Georg von Zengen
3
* Created : 2011/10/17
4
*/
5
#include "contiki.h"
6
#include "lib/sensors.h"
7
#include "
interfaces/acc-adxl345.h
"
8
#include "dev/acc-sensor.h"
9
const
struct
sensors_sensor acc_sensor;
10
uint8_t acc_state=0;
11
/*---------------------------------------------------------------------------*/
12
static
int
13
value(
int
type)
14
{
15
switch
(type) {
16
case
X_ACC:
17
return
adxl345_get_x_acceleration
();
18
19
case
Y_ACC:
20
return
adxl345_get_y_acceleration
();
21
22
case
Z_ACC:
23
return
adxl345_get_z_acceleration
();
24
}
25
return
0;
26
}
27
/*---------------------------------------------------------------------------*/
28
static
int
29
status(
int
type)
30
{
31
return
acc_state;
32
}
33
/*---------------------------------------------------------------------------*/
34
static
int
35
configure(
int
type,
int
c)
36
{
37
acc_state=1;
38
return
adxl345_init
();
39
}
40
/*---------------------------------------------------------------------------*/
41
SENSORS_SENSOR(acc_sensor,
"ACCELERATION"
, value, configure, status);
Generated on Fri Aug 30 2013 12:34:11 for Contiki 2.5 by
1.8.3.1