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:
- 2:44b76f6f19d5
- Parent:
- 1:a88df80e7664
- Child:
- 4:62ebb87678f8
--- a/LDC1000.cpp Wed Apr 29 14:57:22 2015 +0000
+++ b/LDC1000.cpp Tue May 19 13:26:40 2015 +0000
@@ -22,6 +22,7 @@
wait_us(10);
setFrequency(f_external);
setResponseTime(LDC_RESPONSE_384);
+ setWatchdog(5000);
}
void LDC1000::setOutputPower(LDC_AMPLITUDE amplitude)
@@ -35,7 +36,13 @@
}
+void LDC1000::setWatchdog(float frequency)
+{
+ uint8_t buffer;
+ buffer = 68.94*log(frequency/2500);
+ writeSPI(&buffer,0x03);
+}
void LDC1000::setResponseTime(LDC_RESPONSE responsetime)
{
@@ -59,7 +66,7 @@
uint16_t resp[] = {192, 384, 768, 1536, 3072, 6144};
_raw_l = readRawCounts();
_fsensor = (_frequency/(_raw_l*3.0))*resp[(uint8_t)(_responsetime)];
- return 1/(cap*pow(2*PI*_fsensor,2));
+ return 1./(cap*pow(2*PI*_fsensor,2));
};
uint32_t LDC1000::readRawCounts(void)
