I'm attempting to continuously stream the proximity data over the serial port and I have a couple of questions:
Is there a way to stream proximity data without tampering with the firmware? If not I was either going to poll proximity as fast as I'm allowed or stream inductance and calculate proximity from there.
What is the max polling rate of the proximity sensor, I remember reading that baudrate is irrelevant with USBCDC, any sort of clarification would be nice.
Lastly, can you help me make sense of the data returned by polling proximity? Writing "1" to the EVM returns:
" 30768 25393 12599 2573 " as 16bit signed integers, I've been trying to implement my proximity grapher as a way to test it's functionality but I feel like I'm not massaging the data just right. I'm aware that proximity has an MSB and an LSB but from what I can infer the C code only reads the LSB...I'm a little confused.
Here is the C code that reads the proximity
static void menuReadProx() {
uint8_t i;
uint16_t data;
uint8_t printString[16];
if (!spi_readBytes(NULL, LDC1000_CMD_PROXLSB, &printString[0], 2)) {
i = sprintf ((char *)printString,"err timeout\r\n");
}
else {
#ifdef HOST_DEVICE_LDC1000
data = printString[0] | (printString[1] << 8);
#endif
i = sprintf ((char *)printString,"0x%x\r\n",data);
}
sendString((char *)printString,i);
}
where PROXLSB is defined as register 0x21
Here is the readbytes function:
uint8_t spi_readBytes(SPI_1P1_CS_Pin * cs, uint8_t addr, uint8_t * buffer, uint8_t len) {
if (done != TRUE) return FALSE;
txlen = 0;
rxlen = len;
rxbuf = buffer;
txaddr = addr | SPI_RWBIT;
if (!spi_exec(cs)) return FALSE;
return TRUE;
}