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:
- 9:6e2d808b113d
- Parent:
- 8:b5fb9681869c
- Child:
- 10:4fa62f8092c4
--- a/LDC1000.cpp Fri May 29 09:28:46 2015 +0000 +++ b/LDC1000.cpp Fri May 29 11:25:13 2015 +0000 @@ -90,25 +90,17 @@ }; -/* oude code terugzetten*/ - +/* reads all 5 registers also after cable reconnect but het returns just one byte*/ uint32_t LDC1000::readRawCounts(void) { - //union - //{ - // uint8_t buf[4]; - // uint32_t value; - //} val; - //val.value = 0; uint8_t val[5]; readSPI(val,0x21,5); - return (uint32_t)(*(&val[2])); + 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) {