Library to communicate with LDC1614

Dependencies:   SHTx

Dependents:   Inductive_Sensor_3

Fork of LDC1101 by Bob Giesberts

Revision:
18:fc9bb81a631f
Parent:
17:a5cf2b4bec13
Child:
19:e205ab9142d8
--- a/LDC1101.h	Sat Dec 12 11:26:23 2015 +0000
+++ b/LDC1101.h	Wed Dec 16 10:58:31 2015 +0000
@@ -47,7 +47,7 @@
         /**
         * @brief Create a new Class to interface to an LDC1101
         **/
-        LDC1101(PinName mosi, PinName miso, PinName sck, PinName cs, float capacitor, float f_external, PinName clock_out=NC);
+        LDC1101(PinName mosi, PinName miso, PinName sck, PinName cs, float capacitor, float f_CLKIN, PinName clock_out=NC);
         
         /**
         * @brief Set power mode.
@@ -72,16 +72,21 @@
         **/
         void setDivider(DIVIDER div);
         
+        
+        /**
+        * @brief get the calculated value for f_sensor
+        **/        
+        float get_fsensor(void);
+        
+        
         /**
         * @brief get the calculated inductance value
         **/
-        float getInductance(void);
+        float get_Inductance(void);
     
     
         // EXTRA test get variables values to verify (to calculate the induction)
-        float get_raw_l(void);
-        float get_fsensor(void);
-        float get_frequency(void);
+        float get_fCLKIN(void);
         float get_responsetime(void);
         float get_cap(void);
         
@@ -96,11 +101,13 @@
         * If PWMout is used to generate a clock signal, this will update the output frequency.s
         **/
         void  setFrequency(float frequency);
+
         /**
-        * @brief Read the raw 24-bit inductance value.
+        * @brief Read LHR_Data, the raw 24-bit inductance value.
         * This is needed for the calculation of the inductance.
+        * It reads from addresses 0x38, 0x39 & 0x3A.
         **/
-        uint32_t readRawL(void){_raw_l = readRawCounts(); return _raw_l;};
+        uint32_t get_LHR_Data(void);
     
     
         /**
@@ -121,15 +128,16 @@
         void writeSPI(uint8_t *data, uint8_t address, uint8_t num_bytes = 1);
         void writeSPIregister(uint8_t reg, uint8_t value){writeSPI(&value,reg);}; // VERKEERD OM?!
         
-        uint32_t readRawCounts(void);
         uint32_t readINTB(void); // EXTRA UNTB Read register
-        LDC_RESPONSE _responsetime;
-        DIVIDER _divider;
+        LDC_RESPONSE _responsetime_;
+        DIVIDER _divider_;
+        float _responsetime;
+        float _divider;
         float _fsensor;
         float _inductance;
-        float _frequency; //frequency of external clock
+        float _fCLKIN; //frequency of external clock: 16MHz
         float cap;    
-        uint32_t _raw_l;
+        uint32_t _L_data;
         uint32_t INTB; // extra: read register INTB
         
         SPI _spiport;