Contiki-NG
arch
platform
cc26x0-cc13x0
sensortag
mpu-9250-sensor.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of the copyright holder nor the names of its
14
* contributors may be used to endorse or promote products derived
15
* from this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
* OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
/*---------------------------------------------------------------------------*/
31
/**
32
* \addtogroup sensortag-cc26xx-peripherals
33
* @{
34
*
35
* \defgroup sensortag-cc26xx-mpu SensorTag 2.0 Motion Processing Unit
36
*
37
* Driver for the Invensense MPU9250 Motion Processing Unit.
38
*
39
* Due to the time required between triggering a reading and the reading
40
* becoming available, this driver is meant to be used in an asynchronous
41
* fashion. The caller must first activate the sensor by calling
42
* mpu_9250_sensor.configure(SENSORS_ACTIVE, xyz);
43
* The value for the xyz arguments depends on the required readings. If the
44
* caller intends to read both the accelerometer as well as the gyro then
45
* xyz should be MPU_9250_SENSOR_TYPE_ALL. If the caller only needs to take a
46
* reading from one of the two elements, xyz should be one of
47
* MPU_9250_SENSOR_TYPE_ACC or MPU_9250_SENSOR_TYPE_GYRO
48
*
49
* Calling .configure() will power up the sensor and initialise it. When the
50
* sensor is ready to provide readings, the driver will generate a
51
* sensors_changed event.
52
*
53
* Calls to .status() will return the driver's state which could indicate that
54
* the sensor is off, booting or on.
55
*
56
* Once a reading has been taken, the caller has two options:
57
* - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to take
58
* subsequent readings the sensor must be started up all over
59
* - Leave the sensor on. In this scenario, the caller can simply keep calling
60
* value() for subsequent readings, but having the sensor on will consume
61
* more energy, especially if both accelerometer and the gyro are on.
62
* @{
63
*
64
* \file
65
* Header file for the Sensortag Invensense MPU9250 motion processing unit
66
*/
67
/*---------------------------------------------------------------------------*/
68
#ifndef MPU_9250_SENSOR_H_
69
#define MPU_9250_SENSOR_H_
70
/*---------------------------------------------------------------------------*/
71
#include "lib/sensors.h"
72
/*---------------------------------------------------------------------------*/
73
/* ACC / Gyro Axes */
74
#define MPU_9250_SENSOR_TYPE_GYRO_Z 0x01
75
#define MPU_9250_SENSOR_TYPE_GYRO_Y 0x02
76
#define MPU_9250_SENSOR_TYPE_GYRO_X 0x04
77
#define MPU_9250_SENSOR_TYPE_GYRO_ALL 0x07
78
79
#define MPU_9250_SENSOR_TYPE_ACC_Z 0x08
80
#define MPU_9250_SENSOR_TYPE_ACC_Y 0x10
81
#define MPU_9250_SENSOR_TYPE_ACC_X 0x20
82
#define MPU_9250_SENSOR_TYPE_ACC_ALL 0x38
83
84
#define MPU_9250_SENSOR_TYPE_MASK 0x3F
85
#define MPU_9250_SENSOR_TYPE_ACC 0x38
86
#define MPU_9250_SENSOR_TYPE_GYRO 0x07
87
88
#define MPU_9250_SENSOR_TYPE_NONE 0
89
#define MPU_9250_SENSOR_TYPE_ALL (MPU_9250_SENSOR_TYPE_ACC | \
90
MPU_9250_SENSOR_TYPE_GYRO)
91
/*---------------------------------------------------------------------------*/
92
/* Accelerometer range */
93
#define MPU_9250_SENSOR_ACC_RANGE_2G 0
94
#define MPU_9250_SENSOR_ACC_RANGE_4G 1
95
#define MPU_9250_SENSOR_ACC_RANGE_8G 2
96
#define MPU_9250_SENSOR_ACC_RANGE_16G 3
97
/*---------------------------------------------------------------------------*/
98
/* Accelerometer range configuration */
99
#ifdef MPU_9250_SENSOR_CONF_ACC_RANGE
100
#define MPU_9250_SENSOR_ACC_RANGE MPU_9250_SENSOR_CONF_ACC_RANGE
101
#else
102
#define MPU_9250_SENSOR_ACC_RANGE MPU_9250_SENSOR_ACC_RANGE_2G
103
#endif
104
/*---------------------------------------------------------------------------*/
105
extern
const
struct
sensors_sensor mpu_9250_sensor;
106
/*---------------------------------------------------------------------------*/
107
#endif
/* MPU_9250_SENSOR_H_ */
108
/*---------------------------------------------------------------------------*/
109
/**
110
* @}
111
* @}
112
*/
Generated on Tue Jul 13 2021 15:12:12 for Contiki-NG by
1.8.13