FXOS8700 library

Dependents:   FRDM-STBC-AGMP01_SensorStream Hexi_Accelero_Magneto_Example A_Dragonfly_Freescale_Accel_Mag_Gyro_Sensor_AGM01 A_Dragonfly_BlueMix_QuickStart_NXP_Sensor ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FXOS8700.h Source File

FXOS8700.h

00001 /*
00002  * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
00003  * Copyright 2016-2017 NXP
00004  *
00005  * Redistribution and use in source and binary forms, with or without modification,
00006  * are permitted provided that the following conditions are met:
00007  *
00008  * o Redistributions of source code must retain the above copyright notice, this list
00009  *   of conditions and the following disclaimer.
00010  *
00011  * o Redistributions in binary form must reproduce the above copyright notice, this
00012  *   list of conditions and the following disclaimer in the documentation and/or
00013  *   other materials provided with the distribution.
00014  *
00015  * o Neither the name of the copyright holder nor the names of its
00016  *   contributors may be used to endorse or promote products derived from this
00017  *   software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00020  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00023  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00026  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029  */
00030 
00031 #ifndef FXOS8700_H
00032 #define FXOS8700_H
00033 #include "mbed.h"
00034 
00035 #define FXOS8700_I2C_ADDRESS (0x1E<<1) //pins SA0,SA1=0
00036 
00037 #define FXOS8700_STATUS 0x00
00038 #define FXOS8700_MDR_STATUS 0x32
00039 #define FXOS8700_WHO_AM_I 0x0D
00040 #define FXOS8700_CTRL_REG1 0x2A
00041 #define FXOS8700_M_CTRL_REG1 0x5B
00042 #define FXOS8700_WHO_AM_I_VALUE 0xC7
00043 
00044 class FXOS8700
00045 {
00046     public:
00047     
00048     FXOS8700(PinName sda, PinName scl);
00049       
00050     void accel_config(void);
00051     
00052     void mag_config(void);
00053         
00054     void acquire_accel_data_g(float * da);
00055     
00056     void acquire_mag_data_uT(float * dm);
00057     
00058     private:
00059     I2C accelmagi2c;
00060     
00061 };
00062 
00063 #endif