Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Inductive_Sensor_3
Fork of LDC1101 by
Diff: LDC1000.cpp
- Revision:
- 11:0f53fbf73613
- Parent:
- 10:4fa62f8092c4
- Child:
- 12:312970050c8c
--- a/LDC1000.cpp Fri May 29 13:35:48 2015 +0000
+++ b/LDC1000.cpp Fri May 29 13:45:48 2015 +0000
@@ -26,21 +26,9 @@
setWatchdog(5000);
setResponseTime(LDC_RESPONSE_6144);
setOutputPower(LDC_AMPLITUDE_4V);
-
-//*** Write comando's like in EVM start log:
-/* writeSPIregister(0x0B,0x00); // power op standby
- writeSPIregister(0x01,0x0E); // rp_max
- writeSPIregister(0x02,0x3C); // rp_min
- writeSPIregister(0x03,0x15); // min reson freq
- writeSPIregister(0x04,0x17);*/ // LDC config
+
writeSPIregister(0x05,0x00); // clock config >> we get 0x00 if this line is disabled and the cable is reconnected
-/* writeSPIregister(0x06,0x50); // treshhold High LSB we get 0x00 if this 4 lines is disabled and the cable is reconnected
- writeSPIregister(0x07,0x14); // treshhold High MSB
- writeSPIregister(0x08,0xC0); // treshhold Low LSB
- writeSPIregister(0x09,0x12); // treshhold Low MSB
- writeSPIregister(0x0A,0x04); */ // INTB pin config
- writeSPIregister(0x0C,0x01); //
- // writeSPIregister(0x0B,0x01); // Power mode active
+ writeSPIregister(0x0C,0x01); // Register 0x0C enables a function that can improve L measurements while disabling RP measurements
mode(LDC_MODE_ACTIVE);
}
@@ -97,24 +85,8 @@
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
return combinedbytes;
-// return (uint32_t)(*(&val[2]));
}
-
- /*
-uint32_t LDC1000::readRawCounts(void)
-{
- union
- {
- uint8_t buf[4];
- uint32_t value;
- } val;
- val.value = 8;
- readSPI(val.buf,0x23,3);
- return val.value;
-}
-*/
-
void LDC1000::readSPI(uint8_t *data, uint8_t address, uint8_t num_bytes)
{
_cs_pin.write(0);
@@ -137,7 +109,9 @@
_cs_pin.write(1);
}
-// EXTRA test get and print variables values to verify (to calculate the induction)
+
+// EXTRA test: Get&print values of all variables to verify (to calculate the induction)
+// The data will be printed on the screen using RealTerm: baud 9600.
// Begin ***********************************************************
float LDC1000::get_raw_l() {_raw_l = readRawCounts();
return _raw_l;};
