SparkFun_ADXL345_Arduino_Library
SparkFun_ADXL345_Arduino_Library copied to clipboard
Addition of FIFO Control and Status
This library does not have methods to enable FIFO and select one of its modes. The setFIFOMode will select one of the four available modes - Bypass, FIFO, Stream and Trigger. The getFIFOMode will return the byte set in the FIFO_CTL register. The getFIFOStatus will return the number of data values stored in FIFO.
It doesn't look like sparkfun have looked at this project in a while. :(
Hi Glenn - Sorry, someone should have contacted you a lot sooner. This looks like a good addition. I have a few changes I need to see.
The use of magic decimal numbers is not ideal. It would be a lot easier for me to read and check if you used bit wise operators such as (and this is pseudo code, I haven't read the datasheet in many years):
writeTo(ADXL345_FIFO_CTL, (1<<FIFO_MODE_STREAM));
Or something of the like.
And passing in a String to any function is (almost always) a bad idea. Using the String constructor will add a lot of overhead any time someone links in the library. I would prefer the user call a function called
myAccelerometer.enableStreamMode();
that in turn called your setFIFOmode with a define. Such as:
ADXL345::enableStreamMode()
{
setFIFOMode(FIFO_MODE_STREAM);
}
Again, sorry we're so late to the party and thank you for your contribution. If you're interested in continuing this PR, please change it with the above recommendations.