TrekkingPhoenix / Mbed 2 deprecated TrekkingControllerV1-4_WinterChallenge20

Dependencies:   mbed mbed-rtos MotionSensor EthernetInterface

Committer:
Alexandre Seidy
Date:
Sat Apr 30 12:57:17 2016 -0300
Revision:
9:bd0fb9d17803
Parent:
0:88faaa1afb83
Child:
12:273752f540be
Added gyroscope sensitivity configuration

Who changed what in which revision?

UserRevisionLine numberNew contents of line
drelliak 0:88faaa1afb83 1 /* Copyright (c) 2015 NXP Semiconductors. MIT License
drelliak 0:88faaa1afb83 2 *
drelliak 0:88faaa1afb83 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
drelliak 0:88faaa1afb83 4 * and associated documentation files (the "Software"), to deal in the Software without
drelliak 0:88faaa1afb83 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
drelliak 0:88faaa1afb83 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
drelliak 0:88faaa1afb83 7 * Software is furnished to do so, subject to the following conditions:
drelliak 0:88faaa1afb83 8 *
drelliak 0:88faaa1afb83 9 * The above copyright notice and this permission notice shall be included in all copies or
drelliak 0:88faaa1afb83 10 * substantial portions of the Software.
drelliak 0:88faaa1afb83 11 *
drelliak 0:88faaa1afb83 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
drelliak 0:88faaa1afb83 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
drelliak 0:88faaa1afb83 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
drelliak 0:88faaa1afb83 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
drelliak 0:88faaa1afb83 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
drelliak 0:88faaa1afb83 17 */
drelliak 0:88faaa1afb83 18
drelliak 0:88faaa1afb83 19 #ifndef FXAS21002_H
drelliak 0:88faaa1afb83 20 #define FXAS21002_H
drelliak 0:88faaa1afb83 21 #include "mbed.h"
drelliak 0:88faaa1afb83 22
drelliak 0:88faaa1afb83 23 #define FXAS21002_I2C_ADDRESS 0x40
drelliak 0:88faaa1afb83 24
drelliak 0:88faaa1afb83 25 #define FXAS21002_STATUS 0x00
drelliak 0:88faaa1afb83 26 #define FXAS21002_WHO_AM_I 0x0C
drelliak 0:88faaa1afb83 27 #define FXAS21002_CTRL_REG0 0x0D
drelliak 0:88faaa1afb83 28 #define FXAS21002_CTRL_REG1 0x13
drelliak 0:88faaa1afb83 29 #define FXAS21002_WHO_AM_I_VALUE 0xD1
drelliak 0:88faaa1afb83 30
Alexandre Seidy 9:bd0fb9d17803 31 /* Gyroscope mechanical modes
Alexandre Seidy 9:bd0fb9d17803 32 * Mode Full-scale range [Deg/s] Sensitivity [(mDeg/s)/LSB]
Alexandre Seidy 9:bd0fb9d17803 33 * 1 +- 2000 62.5
Alexandre Seidy 9:bd0fb9d17803 34 * 2 +- 1000 31.25
Alexandre Seidy 9:bd0fb9d17803 35 * 3 +- 500 15.625
Alexandre Seidy 9:bd0fb9d17803 36 * 4 +- 250 7.8125
Alexandre Seidy 9:bd0fb9d17803 37 */
Alexandre Seidy 9:bd0fb9d17803 38 enum gyro_mode
Alexandre Seidy 9:bd0fb9d17803 39 {
Alexandre Seidy 9:bd0fb9d17803 40 MODE_1 = 0x00,
Alexandre Seidy 9:bd0fb9d17803 41 MODE_2 = 0x01,
Alexandre Seidy 9:bd0fb9d17803 42 MODE_3 = 0x02,
Alexandre Seidy 9:bd0fb9d17803 43 MODE_4 = 0x03
Alexandre Seidy 9:bd0fb9d17803 44 }
Alexandre Seidy 9:bd0fb9d17803 45
drelliak 0:88faaa1afb83 46 class FXAS21002
drelliak 0:88faaa1afb83 47 {
drelliak 0:88faaa1afb83 48 public:
drelliak 0:88faaa1afb83 49
drelliak 0:88faaa1afb83 50 FXAS21002(PinName sda, PinName scl);
drelliak 0:88faaa1afb83 51
drelliak 0:88faaa1afb83 52 void gyro_config(void);
Alexandre Seidy 9:bd0fb9d17803 53 void gyro_config(gyro_mode mode);
drelliak 0:88faaa1afb83 54
drelliak 0:88faaa1afb83 55 void acquire_gyro_data_dps(float * du);
drelliak 0:88faaa1afb83 56
drelliak 0:88faaa1afb83 57 private:
drelliak 0:88faaa1afb83 58 I2C gyroi2c;
Alexandre Seidy 9:bd0fb9d17803 59 float sensivity;
drelliak 0:88faaa1afb83 60 };
drelliak 0:88faaa1afb83 61
drelliak 0:88faaa1afb83 62 #endif