fft+analohADXL100x

Dependencies:   COG4050_ADT7420

Fork of COG4050_blink by valeria toffoli

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ADXL100x.h Source File

ADXL100x.h

00001 // --------------------------------------------------------------------------------------------------------
00002 //
00003 //  September 2018
00004 //  Author: Valeria Toffoli, Rohan Gurav 
00005 //
00006 // --------------------------------------------------------------------------------------------------------
00007 //
00008 //  ADXL100x.h
00009 //
00010 // --------------------------------------------------------------------------------------------------------
00011 // 
00012 //  This library provides all the functions necessary to interface the ADXL355 with EV-COG-AD3029 or  
00013 //  EV-COG-AD4050 Board. Functions for reads, writes,and scaling are included. 
00014 //  This library may be used for the entire ADXL100x family of devices 
00015 //  with some modification.
00016 //
00017 //  Permission is hereby granted, free of charge, to any person obtaining
00018 //  a copy of this software and associated documentation files (the
00019 //  "Software"), to deal in the Software without restriction, including
00020 //  without limitation the rights to use, copy, modify, merge, publish,
00021 //  distribute, sublicense, and/or sell copies of the Software, and to
00022 //  permit persons to whom the Software is furnished to do so, subject to
00023 //  the following conditions:
00024 //
00025 //  The above copyright notice and this permission notice shall be
00026 //  included in all copies or substantial portions of the Software.
00027 //
00028 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030 //  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032 //  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033 //  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034 //  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035 //
00036 // --------------------------------------------------------------------------------------------------------
00037 
00038 
00039 #ifndef ADXL100x_H_
00040 #define ADXL100x_H_
00041 
00042 class ADXL100x
00043 {
00044 public: 
00045     float sens;         // sensitivity [g/V]    
00046     float fact;         // conversion factor [V/g] 
00047     float offset;       // offset [V] 
00048     int dyn;            // dynamic range [g]
00049     // -------------------------- //
00050     // FUNCTIONS                  //  
00051     // -------------------------- //
00052     // constructor 
00053     ADXL100x(PinName ST_pin, PinName STB_pin, PinName OR_pin, PinName Vout_pin, int device, double power);
00054     void standby();
00055     void wakeup();
00056     float standard_dev(int bit);
00057     void calibrate1g(float value_p1g, float value_n1g);
00058     bool selftest(int bit, double power);
00059     uint16_t scanx();
00060     float accelScale(uint16_t data, int bit);
00061     
00062 private:
00063     DigitalOut st; DigitalOut stb;
00064     DigitalIn over;
00065     AnalogIn vout;
00066     
00067     
00068 };
00069  
00070 #endif