Library for LTC2460 ADC converter

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ltc2460.h Source File

ltc2460.h

00001 /*
00002   @file LTC2460.h
00003   
00004   @brief LTC2460 - Ultra-Tiny, 16-Bit ΔΣ ADCs with 10ppm/°C Max Precision Reference
00005          Breakout SPI Library      
00006 
00007   @Author lukasz uszko(luszko@op.pl)
00008 
00009   Tested on FRDM-KL46Z and FRDM-KL25Z
00010   
00011   Copyright (c) 2015 lukasz uszko
00012   Released under the MIT License (see http://mbed.org/license/mit)
00013 
00014   Documentation regarding the  LTC2460 might be found here: 
00015   http://www.linear.com/product/LTC2460
00016 */
00017 
00018 
00019 
00020 #ifndef LTC2460_H
00021 #define LTC2460_H
00022 
00023 #include "mbed.h"
00024 
00025 
00026 class LTC2460{
00027       
00028       
00029  /**********private members and methods********************************/       
00030  private: 
00031  
00032         DigitalOut          mCSpin;
00033         SPI                 mSpi;
00034         double mResDividerVal;
00035 
00036 
00037    /**********public methods********************************/
00038     public:
00039 
00040     /** Constructor- Creates an LTC2460 instance
00041      * @param cs pin 
00042      * @param mosi pin 
00043      * @param miso pin
00044      * @param sck  pin
00045      */
00046     LTC2460(PinName csPin , PinName mosiPin, PinName misoPin, PinName sckPin,double resDividerVal=0 ); 
00047 
00048 
00049     /** Initialization: set member values and configuration registers, ought to be invoked in the body of constructor 
00050      * @returns
00051      *    true on success,
00052      *    false on error
00053      */
00054     bool initLTC2460(void);
00055 
00056 
00057     /*reading , writing registers
00058     
00059     */
00060     uint16_t spiRead(void);
00061 
00062     void spiWrite(uint16_t value);
00063 
00064     /** Read volatge real value from ADC , with .
00065      * @param resistor divider value: GND---- R1 ----- ADC-----R2--- Vmeasured    --> resDividerVal = R1/R2
00066      * @returns
00067      *   value of voltage measured voltage 
00068      */    
00069     float readVoltage();
00070    
00071 
00072     
00073 };
00074 
00075 #endif