Bob Giesberts / LDC1614

Dependencies:   SHTx

Dependents:   Inductive_Sensor_3

Fork of LDC1101 by Bob Giesberts

Revision:
1:a88df80e7664
Parent:
0:90873b4e8330
Child:
2:44b76f6f19d5
diff -r 90873b4e8330 -r a88df80e7664 LDC1000.cpp
--- a/LDC1000.cpp	Sun Apr 05 18:19:12 2015 +0000
+++ b/LDC1000.cpp	Wed Apr 29 14:57:22 2015 +0000
@@ -17,9 +17,11 @@
     _spiport.format(8,3);
     _spiport.frequency(1E6);
     _cs_pin.write(1);
+    wait_us(100);
+    mode(LDC_MODE_ACTIVE);
+    wait_us(10);
     setFrequency(f_external);
     setResponseTime(LDC_RESPONSE_384);
-    mode(LDC_MODE_ACTIVE);
 }
 
 void LDC1000::setOutputPower(LDC_AMPLITUDE amplitude)
@@ -33,6 +35,8 @@
 
 }
 
+
+
 void LDC1000::setResponseTime(LDC_RESPONSE responsetime)
 {
     uint8_t buffer;
@@ -46,6 +50,7 @@
 void LDC1000::setFrequency(float frequency)
 {
     _frequency = frequency;
+    _clock.write(0.5);
     _clock.period(1.0/frequency);
 }
 
@@ -75,7 +80,7 @@
     _spiport.write(address | 0x80); //read flag 
     for(int i=0; i < num_bytes ; i++)
     {
-        _spiport.write(data[i]);
+        data[i] = _spiport.write(0xFF);
     }
     _cs_pin.write(1);
 }
@@ -86,7 +91,7 @@
     _spiport.write(address); 
     for(int i=0; i < num_bytes ; i++)
     {
-        *data = _spiport.write(0xFF);
+        _spiport.write(data[i]);
     }
     _cs_pin.write(1);
 }
\ No newline at end of file