diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-04-22 17:47:16 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-23 20:50:34 +0000 |
commit | 3b36337be1e165db491bc591ae95be3577886465 (patch) | |
tree | 35f2ab82d35c889aa165769c92735ad8e0820de3 /driver/accelgyro_lsm6ds0.h | |
parent | 67698db7da22449314dc5c0b3f468674afe77092 (diff) | |
download | chrome-ec-3b36337be1e165db491bc591ae95be3577886465.tar.gz |
accel: add accel driver for lsm6ds0
This adds the basics for the accelerometer potion only of the ST
lsm6ds0 accel/gyro. Still need to add the acceleration interrupt
functionality, and all of the gyro portion of the chip.
BUG=none
BRANCH=none
TEST=Tested on a samus prototype hacked up to have the lsm6ds0 connected
to the EC i2c bus. Added motion sense task to the samus tasklist, added
accelerometer information to the samus board file, and tested console
functions interacting with accelerometer. The data seems reasonable,
and can successfully change data rate and range.
Change-Id: I7949d9c20642a40ede82dc291b2c80f01b0a7d8b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196426
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'driver/accelgyro_lsm6ds0.h')
-rw-r--r-- | driver/accelgyro_lsm6ds0.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/driver/accelgyro_lsm6ds0.h b/driver/accelgyro_lsm6ds0.h new file mode 100644 index 0000000000..6c34570b15 --- /dev/null +++ b/driver/accelgyro_lsm6ds0.h @@ -0,0 +1,45 @@ +/* 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. + */ + +/* LSM6DS0 accelerometer and gyro module for Chrome EC */ + +#ifndef __CROS_EC_ACCEL_LSM6DS0_H +#define __CROS_EC_ACCEL_LSM6DS0_H + +/* + * 7-bit address is 110101Xb. Where 'X' is determined + * by the voltage on the ADDR pin. + */ +#define LSM6DS0_ADDR0 0xd4 +#define LSM6DS0_ADDR1 0xd6 + +/* Chip specific registers. */ +#define LSM6DS0_CTRL_REG6_XL 0x20 +#define LSM6DS0_CTRL_REG8 0x22 +#define LSM6DS0_OUT_X_L_XL 0x28 +#define LSM6DS0_OUT_X_H_XL 0x29 +#define LSM6DS0_OUT_Y_L_XL 0x2a +#define LSM6DS0_OUT_Y_H_XL 0x2b +#define LSM6DS0_OUT_Z_L_XL 0x2c +#define LSM6DS0_OUT_Z_H_XL 0x2d + + +#define LSM6DS0_GSEL_2G (0 << 3) +#define LSM6DS0_GSEL_4G (2 << 3) +#define LSM6DS0_GSEL_8G (3 << 3) +#define LSM6DS0_GSEL_ALL (3 << 3) + +#define LSM6DS0_ODR_10HZ (1 << 5) +#define LSM6DS0_ODR_50HZ (2 << 5) +#define LSM6DS0_ODR_119HZ (3 << 5) +#define LSM6DS0_ODR_238HZ (4 << 5) +#define LSM6DS0_ODR_476HZ (5 << 5) +#define LSM6DS0_ODR_982HZ (6 << 5) +#define LSM6DS0_ODR_ALL (7 << 5) + +/* Sensor resolution in number of bits. This sensor has fixed resolution. */ +#define LSM6DS0_RESOLUTION 16 + +#endif /* __CROS_EC_ACCEL_LSM6DS0_H */ |