blob: 48d61ac3ab244c9c8375d2597f86d0df3c1e5c42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* This array must be defined in board.c. */
extern const int accel_addr[];
/* This enum must be defined in board.h. */
enum accel_id;
/* Number of counts from accelerometer that represents 1G acceleration. */
#define ACCEL_G 1024
/**
* Read all three accelerations of an accelerometer. Note that all three
* accelerations come back in counts, where ACCEL_G can be used to convert
* counts to engineering units.
*
* @param id Target accelerometer
* @param x_acc Pointer to store X-axis acceleration (in counts).
* @param y_acc Pointer to store Y-axis acceleration (in counts).
* @param z_acc Pointer to store Z-axis acceleration (in counts).
*
* @return EC_SUCCESS if successful, non-zero if error.
*/
int accel_read(enum accel_id id, int *x_acc, int *y_acc, int *z_acc);
/**
* Initiailze accelerometers.
*
* @param id Target accelerometer
*
* @return EC_SUCCESS if successful, non-zero if error.
*/
int accel_init(enum accel_id id);
|