Chris Snow / MCP3424
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MCP3424.h Source File

MCP3424.h

00001 /* MCP3424 library version 1.2
00002 
00003 Writed by B@tto 
00004 Contact : batto@hotmail.fr
00005 
00006 
00007   MCP3424.h - ADC 18 bits i2c library for Wiring & Arduino
00008   Copyright (c) 2012 Yann LEFEBVRE.  All right reserved.
00009 
00010   This library is free software; you can redistribute it and/or
00011   modify it under the terms of the GNU Lesser General Public
00012   License as published by the Free Software Foundation; either
00013   version 2.1 of the License, or (at your option) any later version.
00014 
00015   This library is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018   Lesser General Public License for more details.
00019 
00020   You should have received a copy of the GNU Lesser General Public
00021   License along with this library; if not, write to the Free Software
00022   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023 */
00024 
00025 
00026 #ifndef MCP3424_H
00027 #define MCP3424_H
00028 
00029 #include "mbed.h"
00030 
00031 
00032 class MCP3424 {
00033 
00034 public:
00035 
00036 MCP3424(PinName SDA, PinName SCL, uint8_t adresse);
00037 ~MCP3424();
00038 void Configuration(char channel,char resolution,bool mode,char PGA);
00039 void NewConversion();
00040 bool IsConversionFinished();
00041 long Measure();
00042 
00043 private:
00044 I2C i2c;
00045 int _adresse;
00046 long _resultat;
00047 char _resolution;
00048 bool _mode;
00049 char _i;
00050 char _testvariable;
00051 char _cfgbyte;
00052 char _PGA;
00053 char _RequestedByte;
00054 
00055 char _Buffer[4];
00056 
00057 };
00058 
00059 #endif
00060