Library to work with the LDC1000 from Texas Instruments
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):
- Setting the RpMAX and RpMIN values
- Setting the interrupt pin functionality
Diff: LDC1000.cpp
- Revision:
- 4:62ebb87678f8
- Parent:
- 2:44b76f6f19d5
- Child:
- 5:98d4fd07734a
--- a/LDC1000.cpp Tue May 19 13:31:03 2015 +0000 +++ b/LDC1000.cpp Tue May 19 14:10:01 2015 +0000 @@ -11,7 +11,7 @@ #include "LDC1000.h" -LDC1000::LDC1000(PinName mosi, PinName miso, PinName sck, PinName cs, float capacitor, float f_external, PinName clock_out) : _spiport(mosi,miso,sck,NC), _cs_pin(cs), _clock(clock_out) +LDC1000::LDC1000(PinName mosi, PinName miso, PinName sck, PinName cs, float capacitor, float f_external, PinName clock_out) : _spiport(mosi,miso,sck,NC), _cs_pin(cs), _clock(clock_out,1) { cap = capacitor; _spiport.format(8,3); @@ -57,8 +57,8 @@ void LDC1000::setFrequency(float frequency) { _frequency = frequency; - _clock.write(0.5); _clock.period(1.0/frequency); + _clock.pulsewidth(0.5/frequency); } float LDC1000::getInductance()