diff --git a/Adafruit_ADXL345_U.cpp b/Adafruit_ADXL345_U.cpp index 067f283..28a4c67 100644 --- a/Adafruit_ADXL345_U.cpp +++ b/Adafruit_ADXL345_U.cpp @@ -36,7 +36,7 @@ @brief Abstract away platform differences in Arduino wire library */ /**************************************************************************/ -static uint8_t i2cread(void) { +inline uint8_t Adafruit_ADXL345_Unified::i2cread(void) { #if ARDUINO >= 100 return Wire.read(); #else @@ -49,7 +49,7 @@ static uint8_t i2cread(void) { @brief Abstract away platform differences in Arduino wire library */ /**************************************************************************/ -static void i2cwrite(uint8_t x) { +inline void Adafruit_ADXL345_Unified::i2cwrite(uint8_t x) { #if ARDUINO >= 100 Wire.write((uint8_t)x); #else @@ -57,16 +57,41 @@ 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<