Thundersoft
/
FRDM_FXS_MULTI_B_for_TT_Mxx
Create a project for TT_Mxx.
Embed:
(wiki syntax)
Show/hide line numbers
FXAS21000.h
00001 /* Copyright (c) 2010-2011 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #ifndef FXAS21000_H 00020 #define FXAS21000_H 00021 00022 #include "mbed.h" 00023 00024 00025 /** 00026 * MMA8652 Slave Address 00027 */ 00028 00029 #define FXAS21000_SLAVE_ADDR (0x20 << 1) //(0x20) 00030 00031 // MMA8652 internal register addresses 00032 #define FXAS21000_STATUS 0x00 00033 #define FXAS21000_WHOAMI 0x0C 00034 #define FXAS21000_XYZ_DATA_CFG 0x0E 00035 #define FXAS21000_CTRL_REG0 0x0D 00036 #define FXAS21000_CTRL_REG1 0x13 00037 #define FXAS21000_WHOAMI_VAL 0xD1 00038 00039 /** 00040 * FXAS21000 gyroscope on I2C 00041 */ 00042 class FXAS21000 00043 { 00044 public: 00045 /** 00046 * FXAS21000 constructor 00047 * 00048 * @param sda SDA pin 00049 * @param sdl SCL pin 00050 */ 00051 FXAS21000(PinName sda, PinName scl); 00052 00053 /** 00054 * Get the Gyro values as floating point degrees / second 00055 * 00056 * @param floating point array where the results will be placed 00057 */ 00058 void ReadXYZ(float * a); 00059 00060 /** 00061 * Get the Gyro values as signed 16 bit value 00062 * 00063 * @param int16_t point array where the results will be placed 00064 */ 00065 void ReadXYZraw(int16_t * t); 00066 00067 /** 00068 * Get the value of the WHO_AM_I register 00069 * 00070 * @returns DEVICE_ID value == 0xD1 00071 */ 00072 char getWhoAmI(void); 00073 00074 private: 00075 I2C _i2c; 00076 00077 /** 00078 * Set the device in active mode 00079 */ 00080 void begin( void); 00081 00082 void RegRead( char reg, char * d, int len); 00083 }; 00084 00085 #endif 00086
Generated on Wed Jul 13 2022 20:20:49 by 1.7.2