Library to work with the LDC1000 from Texas Instruments

Dependencies:   FastPWM

Dependents:   LDC1000_test

LDC1000

This library was written to interface to Texas Instruments' LDC1000 in order to perform inductance measurement. This libary needs a SPI peripheral on your mbed device to talk to the LDC1000.

Clock

The LDC1000 needs a high speed clock for its internal frequency counter. In order to provide this clock, the FastPWM library is used. This may change the behaviour of other PWM channels, please be aware of that, and read the FastPWM documentation to understand the implications.

Unsupported

Not supported (yet):

  1. Setting the RpMAX and RpMIN values
  2. Setting the interrupt pin functionality

Files at this revision

API Documentation at this revision

Comitter:
hamid567
Date:
Mon Jun 01 08:21:11 2015 +0000
Parent:
11:0f53fbf73613
Child:
13:e077728f89ac
Child:
14:14a6f50840df
Commit message:
Working example

Changed in this revision

LDC1000.cpp Show annotated file Show diff for this revision Revisions of this file
LDC1000.h Show annotated file Show diff for this revision Revisions of this file
--- a/LDC1000.cpp	Fri May 29 13:45:48 2015 +0000
+++ b/LDC1000.cpp	Mon Jun 01 08:21:11 2015 +0000
@@ -41,7 +41,6 @@
     buffer &= 0xE7; //clear amplitude bits
     buffer |= (amplitude<<3) & 0x18;
     writeSPI(&buffer,0x04);
-
 }
 
 void LDC1000::setWatchdog(float frequency)
@@ -78,12 +77,11 @@
 };
 
 
-/* reads all 5 registers also after cable reconnect but het returns just one byte*/
 uint32_t LDC1000::readRawCounts(void)
 {
     uint8_t val[5];
     readSPI(val,0x21,5);
-    unsigned int combinedbytes = (val[4]<<16)| (val[3]<<8) | val[2];  // combine the 3 bytes from registers 23, 24 and 25 
+    uint32_t combinedbytes = (val[4]<<16)| (val[3]<<8) | val[2];  // combine the content of the 3 bytes from registers 23, 24 and 25 
     return combinedbytes;
 }
 
@@ -124,5 +122,4 @@
     float LDC1000::get_frequency()      {return _frequency;};    
     float LDC1000::get_responsetime()   {return _responsetime;};    
     float LDC1000::get_cap()            {return cap;};
-// END ***********************************************************
-
+// END ***********************************************************
\ No newline at end of file
--- a/LDC1000.h	Fri May 29 13:45:48 2015 +0000
+++ b/LDC1000.h	Mon Jun 01 08:21:11 2015 +0000
@@ -32,9 +32,6 @@
 
 typedef enum { LDC_MODE_STANDBY = 0, LDC_MODE_ACTIVE = 1} LDC_MODE;
 
-typedef enum { WAKE_UP = 1, COMPARATOR = 2 , ACTIVE = 4} LDC_INTB;
-
-
 /**
 * Class for the LDC1000.
 * @author Victor Sluiter
@@ -53,7 +50,6 @@
     * @param mode choose from LDC_MODE_ACTIVE or LDC_MODE STANDBY
     **/
     void mode(LDC_MODE mode){writeSPI((uint8_t *)(&mode), 0x0B);};
-    void setINTB(LDC_INTB setINTB){writeSPI((uint8_t *)(&setINTB), 0x0A);};
     /**
     * @brief get the calculated inductance value
     **/