add MSA311 support
This commit is contained in:
parent
15bb233a30
commit
0226c55f96
2 changed files with 28 additions and 7 deletions
|
|
@ -22,14 +22,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include <Adafruit_MSA301.h>
|
||||
#include <Wire.h>
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
|
@ -38,6 +31,25 @@
|
|||
/**************************************************************************/
|
||||
Adafruit_MSA301::Adafruit_MSA301() {}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Instantiates a new MSA311 class
|
||||
*/
|
||||
/**************************************************************************/
|
||||
Adafruit_MSA311::Adafruit_MSA311() {}
|
||||
|
||||
/*!
|
||||
* @brief Sets up the hardware and initializes I2C
|
||||
* @param i2c_address
|
||||
* The I2C address to be used.
|
||||
* @param wire
|
||||
* The Wire object to be used for I2C connections.
|
||||
* @return True if initialization was successful, otherwise false.
|
||||
*/
|
||||
bool Adafruit_MSA311::begin(uint8_t i2c_address, TwoWire *wire) {
|
||||
return Adafruit_MSA301::begin(i2c_address, wire);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Sets up the hardware and initializes I2C
|
||||
* @param i2c_address
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
I2C ADDRESS/BITS
|
||||
-----------------------------------------------------------------------*/
|
||||
#define MSA301_I2CADDR_DEFAULT (0x26) ///< Fixed I2C address
|
||||
#define MSA311_I2CADDR_DEFAULT (0x62) ///< Fixed I2C address
|
||||
/*=========================================================================*/
|
||||
|
||||
#define MSA301_REG_PARTID 0x01 ///< Register that contains the part ID
|
||||
|
|
@ -173,4 +174,12 @@ private:
|
|||
int32_t _sensorID;
|
||||
};
|
||||
|
||||
|
||||
/** Class for hardware interfacing with an MSA311 accelerometer */
|
||||
class Adafruit_MSA311 : public Adafruit_MSA301 {
|
||||
public:
|
||||
Adafruit_MSA311(void);
|
||||
bool begin(uint8_t i2c_addr = MSA311_I2CADDR_DEFAULT, TwoWire *wire = &Wire);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue