diff --git a/Adafruit_ADXL345.cpp b/Adafruit_ADXL345.cpp index ad0b98c..c25ddd1 100644 --- a/Adafruit_ADXL345.cpp +++ b/Adafruit_ADXL345.cpp @@ -55,16 +55,44 @@ static void i2cwrite(uint8_t x) { #endif } + + + +/**************************************************************************/ +/*! + @brief Abstract away SPI receiver & transmitter +*/ +/**************************************************************************/ +static uint8_t spixfer(uint8_t clock, uint8_t miso, uint8_t mosi, uint8_t data) { + uint8_t reply = 0; + for (int i=7; i>=0; i--) { + reply <<= 1; + digitalWrite(clock, LOW); + digitalWrite(mosi, data & (1<