dzheng256 / adxl345spi-py

Reading data from the ADXL345 accelerometer over SPI on a raspberry pi w/ python
GNU General Public License v3.0
4 stars 1 forks source link

why cold_start? #2

Open AlekseyFedorovich opened 4 years ago

AlekseyFedorovich commented 4 years ago

Hi, I'm pretty new with SPI protocol. I'd like to know why you put that 'cold_start' execution in the init so basically everytime you instantiate the class. Thank you!

dzheng256 commented 4 years ago

been a while since i worked on this, but iirc the idea behind a cold start is to "warm up" the device by reading some initial data that you don't store, so that once you start storing the reads the measurements are more consistent. If you don't do the cold start you'll probably get less consistent measurements in the beginning. As for why it's in __init__, the idea was that you instantiate it once and read many times

AlekseyFedorovich commented 4 years ago

Also another question please: why you compare the register address with 0x40 while writing and with 0x40 and 0x80 while reading? is this a SPI convention? I couldn't find this on the ADXL345 datasheet Thank you