fft+analohADXL100x

Dependencies:   COG4050_ADT7420

Fork of COG4050_blink by valeria toffoli

Committer:
vtoffoli
Date:
Mon Nov 05 08:39:17 2018 +0000
Revision:
2:dbe2cc9e3b23
fft+analogADXL;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vtoffoli 2:dbe2cc9e3b23 1 // --------------------------------------------------------------------------------------------------------
vtoffoli 2:dbe2cc9e3b23 2 //
vtoffoli 2:dbe2cc9e3b23 3 // September 2018
vtoffoli 2:dbe2cc9e3b23 4 // Author: Valeria Toffoli, Rohan Gurav
vtoffoli 2:dbe2cc9e3b23 5 //
vtoffoli 2:dbe2cc9e3b23 6 // --------------------------------------------------------------------------------------------------------
vtoffoli 2:dbe2cc9e3b23 7 //
vtoffoli 2:dbe2cc9e3b23 8 // ADXL100x.h
vtoffoli 2:dbe2cc9e3b23 9 //
vtoffoli 2:dbe2cc9e3b23 10 // --------------------------------------------------------------------------------------------------------
vtoffoli 2:dbe2cc9e3b23 11 //
vtoffoli 2:dbe2cc9e3b23 12 // This library provides all the functions necessary to interface the ADXL355 with EV-COG-AD3029 or
vtoffoli 2:dbe2cc9e3b23 13 // EV-COG-AD4050 Board. Functions for reads, writes,and scaling are included.
vtoffoli 2:dbe2cc9e3b23 14 // This library may be used for the entire ADXL100x family of devices
vtoffoli 2:dbe2cc9e3b23 15 // with some modification.
vtoffoli 2:dbe2cc9e3b23 16 //
vtoffoli 2:dbe2cc9e3b23 17 // Permission is hereby granted, free of charge, to any person obtaining
vtoffoli 2:dbe2cc9e3b23 18 // a copy of this software and associated documentation files (the
vtoffoli 2:dbe2cc9e3b23 19 // "Software"), to deal in the Software without restriction, including
vtoffoli 2:dbe2cc9e3b23 20 // without limitation the rights to use, copy, modify, merge, publish,
vtoffoli 2:dbe2cc9e3b23 21 // distribute, sublicense, and/or sell copies of the Software, and to
vtoffoli 2:dbe2cc9e3b23 22 // permit persons to whom the Software is furnished to do so, subject to
vtoffoli 2:dbe2cc9e3b23 23 // the following conditions:
vtoffoli 2:dbe2cc9e3b23 24 //
vtoffoli 2:dbe2cc9e3b23 25 // The above copyright notice and this permission notice shall be
vtoffoli 2:dbe2cc9e3b23 26 // included in all copies or substantial portions of the Software.
vtoffoli 2:dbe2cc9e3b23 27 //
vtoffoli 2:dbe2cc9e3b23 28 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
vtoffoli 2:dbe2cc9e3b23 29 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
vtoffoli 2:dbe2cc9e3b23 30 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
vtoffoli 2:dbe2cc9e3b23 31 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
vtoffoli 2:dbe2cc9e3b23 32 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
vtoffoli 2:dbe2cc9e3b23 33 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
vtoffoli 2:dbe2cc9e3b23 34 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vtoffoli 2:dbe2cc9e3b23 35 //
vtoffoli 2:dbe2cc9e3b23 36 // --------------------------------------------------------------------------------------------------------
vtoffoli 2:dbe2cc9e3b23 37
vtoffoli 2:dbe2cc9e3b23 38
vtoffoli 2:dbe2cc9e3b23 39 #ifndef ADXL100x_H_
vtoffoli 2:dbe2cc9e3b23 40 #define ADXL100x_H_
vtoffoli 2:dbe2cc9e3b23 41
vtoffoli 2:dbe2cc9e3b23 42 class ADXL100x
vtoffoli 2:dbe2cc9e3b23 43 {
vtoffoli 2:dbe2cc9e3b23 44 public:
vtoffoli 2:dbe2cc9e3b23 45 float sens; // sensitivity [g/V]
vtoffoli 2:dbe2cc9e3b23 46 float fact; // conversion factor [V/g]
vtoffoli 2:dbe2cc9e3b23 47 float offset; // offset [V]
vtoffoli 2:dbe2cc9e3b23 48 int dyn; // dynamic range [g]
vtoffoli 2:dbe2cc9e3b23 49 // -------------------------- //
vtoffoli 2:dbe2cc9e3b23 50 // FUNCTIONS //
vtoffoli 2:dbe2cc9e3b23 51 // -------------------------- //
vtoffoli 2:dbe2cc9e3b23 52 // constructor
vtoffoli 2:dbe2cc9e3b23 53 ADXL100x(PinName ST_pin, PinName STB_pin, PinName OR_pin, PinName Vout_pin, int device, double power);
vtoffoli 2:dbe2cc9e3b23 54 void standby();
vtoffoli 2:dbe2cc9e3b23 55 void wakeup();
vtoffoli 2:dbe2cc9e3b23 56 float standard_dev(int bit);
vtoffoli 2:dbe2cc9e3b23 57 void calibrate1g(float value_p1g, float value_n1g);
vtoffoli 2:dbe2cc9e3b23 58 bool selftest(int bit, double power);
vtoffoli 2:dbe2cc9e3b23 59 uint16_t scanx();
vtoffoli 2:dbe2cc9e3b23 60 float accelScale(uint16_t data, int bit);
vtoffoli 2:dbe2cc9e3b23 61
vtoffoli 2:dbe2cc9e3b23 62 private:
vtoffoli 2:dbe2cc9e3b23 63 DigitalOut st; DigitalOut stb;
vtoffoli 2:dbe2cc9e3b23 64 DigitalIn over;
vtoffoli 2:dbe2cc9e3b23 65 AnalogIn vout;
vtoffoli 2:dbe2cc9e3b23 66
vtoffoli 2:dbe2cc9e3b23 67
vtoffoli 2:dbe2cc9e3b23 68 };
vtoffoli 2:dbe2cc9e3b23 69
vtoffoli 2:dbe2cc9e3b23 70 #endif