ADS1231 General Purpose library to deal with ADS1231 AD Converter

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ADS1231_GP.h Source File

ADS1231_GP.h

Go to the documentation of this file.
00001 /**
00002  *  @file ADS1231_GP.h
00003  *  ADS1231 General Purpose library to deal with ADS1231 AD Converter
00004  *
00005  *  @author Fernando Cosentino
00006  *  Nimbus Centre
00007  *  Cork Institute of Technology
00008  *  fernando.cosentino@cit.ie
00009 */
00010 
00011 #ifndef __ADS1231_GP
00012 #define __ADS1231_GP
00013 
00014 #include "mbed.h"
00015 
00016 /**
00017  *  ADS1231_GP Class
00018  * 
00019  *  @author Fernando Cosentino
00020  */
00021 class ADS1231_GP {
00022 public:
00023     /**
00024      *  Creates an instance. This version does not support speed changes
00025      *  (speed must be hard-wired or controlled externally).
00026      *
00027      *  @param doutPin Pin connected to data out (!DRDY/DOUT) from ADS1231
00028      *  @param clkPin Pin connected to serial clock (SCLK) to ADS1231
00029      *  @param pdwnPin Pin connected to power down (!PDWN) to ADS1231
00030      */
00031     ADS1231_GP(PinName doutPin, PinName clkPin, PinName pdwnPin);
00032     
00033     /**
00034      *  Sets power ON or OFF to ADS1231.
00035      *
00036      *  @param p Boolean indicating power down. 1=OFF, 0=ON
00037      */
00038     void setPower(unsigned int p);
00039     
00040     /**
00041      *  Checks if data is available to be read.
00042      * 
00043      *  @returns 1 if ADS1231 is ON and data is available, 0 otherwise.
00044      */
00045     unsigned int dataAvailable(void);
00046     
00047     /**
00048      *  Reads a value from ADS1231 output. You must first ensure there is data
00049      *  available using dataAvailable().
00050      *
00051      *  @returns Raw data read as unsigned int
00052      */
00053     unsigned int readValue(void);
00054 private:
00055         DigitalIn dout;
00056         DigitalOut clk;
00057         DigitalOut pdwn;
00058 
00059 };
00060 
00061 
00062 
00063 
00064 
00065 
00066 #endif