Subversion Repositories freemyipod

Rev

Rev 427 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 427 Rev 763
Line 21... Line 21...
21
//
21
//
22
 
22
 
23
 
23
 
24
#include "global.h"
24
#include "global.h"
25
#include "i2c.h"
25
#include "i2c.h"
-
 
26
#include "accel.h"
26
 
27
 
27
int8_t accel_get_axis(uint8_t axis)
28
void accel_read_force_vector(struct accel_vector* values)
28
{
29
{
-
 
30
    int8_t buf[5];
-
 
31
 
29
    return i2c_recvbyte(0, 0x3a, 0x29 + 2 * axis);
32
    i2c_recv(0, 0x3a, 0x29 | 0x80, buf, 5);
-
 
33
 
-
 
34
    values->x = ((int32_t)buf[0]) * 1207960;
-
 
35
    values->y = ((int32_t)buf[2]) * 1207960;
-
 
36
    values->z = ((int32_t)buf[4]) * 1207960;
30
}
37
}