mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 00:51:29 +00:00
Added accelerometer driver for kxcj9 accelerometers. Currently the accelerometers aren't being used by anything, but there are console commands, accelwrite and accelread, to perform transactions. BUG=none BRANCH=rambi TEST=Used EC console commands to test that accelerometers respond and data looks reasonable. Original-Change-Id: I6ddcf04ec278adeacb148c19b10c3c296b467954 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184693 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 5e1d2052b034b2400b98b2126243e01397a2ce56) Conflicts: board/clapper/board.c board/clapper/board.h board/glimmer/board.c board/glimmer/board.h Change-Id: If8744ddc3273fc08e29830adfd068dc302dd120a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187432 Reviewed-by: Randall Spangler <rspangler@chromium.org>
37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
/* 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);
|