ADC Library

Committer:
chrissnow
Date:
Thu Apr 14 09:52:09 2016 +0000
Revision:
0:a6ef27377050
init;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrissnow 0:a6ef27377050 1 /* MCP3424 library version 1.2
chrissnow 0:a6ef27377050 2
chrissnow 0:a6ef27377050 3 Writed by B@tto
chrissnow 0:a6ef27377050 4 Contact : batto@hotmail.fr
chrissnow 0:a6ef27377050 5
chrissnow 0:a6ef27377050 6
chrissnow 0:a6ef27377050 7 MCP3424.h - ADC 18 bits i2c library for Wiring & Arduino
chrissnow 0:a6ef27377050 8 Copyright (c) 2012 Yann LEFEBVRE. All right reserved.
chrissnow 0:a6ef27377050 9
chrissnow 0:a6ef27377050 10 This library is free software; you can redistribute it and/or
chrissnow 0:a6ef27377050 11 modify it under the terms of the GNU Lesser General Public
chrissnow 0:a6ef27377050 12 License as published by the Free Software Foundation; either
chrissnow 0:a6ef27377050 13 version 2.1 of the License, or (at your option) any later version.
chrissnow 0:a6ef27377050 14
chrissnow 0:a6ef27377050 15 This library is distributed in the hope that it will be useful,
chrissnow 0:a6ef27377050 16 but WITHOUT ANY WARRANTY; without even the implied warranty of
chrissnow 0:a6ef27377050 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
chrissnow 0:a6ef27377050 18 Lesser General Public License for more details.
chrissnow 0:a6ef27377050 19
chrissnow 0:a6ef27377050 20 You should have received a copy of the GNU Lesser General Public
chrissnow 0:a6ef27377050 21 License along with this library; if not, write to the Free Software
chrissnow 0:a6ef27377050 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
chrissnow 0:a6ef27377050 23 */
chrissnow 0:a6ef27377050 24
chrissnow 0:a6ef27377050 25
chrissnow 0:a6ef27377050 26 #ifndef MCP3424_H
chrissnow 0:a6ef27377050 27 #define MCP3424_H
chrissnow 0:a6ef27377050 28
chrissnow 0:a6ef27377050 29 #include "mbed.h"
chrissnow 0:a6ef27377050 30
chrissnow 0:a6ef27377050 31
chrissnow 0:a6ef27377050 32 class MCP3424 {
chrissnow 0:a6ef27377050 33
chrissnow 0:a6ef27377050 34 public:
chrissnow 0:a6ef27377050 35
chrissnow 0:a6ef27377050 36 MCP3424(PinName SDA, PinName SCL, uint8_t adresse);
chrissnow 0:a6ef27377050 37 ~MCP3424();
chrissnow 0:a6ef27377050 38 void Configuration(char channel,char resolution,bool mode,char PGA);
chrissnow 0:a6ef27377050 39 void NewConversion();
chrissnow 0:a6ef27377050 40 bool IsConversionFinished();
chrissnow 0:a6ef27377050 41 long Measure();
chrissnow 0:a6ef27377050 42
chrissnow 0:a6ef27377050 43 private:
chrissnow 0:a6ef27377050 44 I2C i2c;
chrissnow 0:a6ef27377050 45 int _adresse;
chrissnow 0:a6ef27377050 46 long _resultat;
chrissnow 0:a6ef27377050 47 char _resolution;
chrissnow 0:a6ef27377050 48 bool _mode;
chrissnow 0:a6ef27377050 49 char _i;
chrissnow 0:a6ef27377050 50 char _testvariable;
chrissnow 0:a6ef27377050 51 char _cfgbyte;
chrissnow 0:a6ef27377050 52 char _PGA;
chrissnow 0:a6ef27377050 53 char _RequestedByte;
chrissnow 0:a6ef27377050 54
chrissnow 0:a6ef27377050 55 char _Buffer[4];
chrissnow 0:a6ef27377050 56
chrissnow 0:a6ef27377050 57 };
chrissnow 0:a6ef27377050 58
chrissnow 0:a6ef27377050 59 #endif
chrissnow 0:a6ef27377050 60