Compare commits
15 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c096f70814 | ||
|
|
25f91266c5 | ||
|
|
f0fa5f864b | ||
|
|
1cfba157ae | ||
|
|
cafd3f49ea | ||
|
|
2ff48ad47a | ||
|
|
3b15d2c6a9 | ||
|
|
3f911eaf4f | ||
|
|
f274bb4b28 | ||
|
|
8c7e09dae4 | ||
|
|
0dd5b7a720 | ||
|
|
0226c55f96 | ||
|
|
15bb233a30 | ||
|
|
4bb6d859fe | ||
|
|
a9a923e0e0 |
10 changed files with 124 additions and 90 deletions
6
.github/workflows/githubci.yml
vendored
6
.github/workflows/githubci.yml
vendored
|
|
@ -7,11 +7,11 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v1
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
path: ci
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
/**************************************************************************/
|
||||
/*!
|
||||
@file Adafruit_MSA301.cpp
|
||||
@author Limor Fried (Adafruit Industries)
|
||||
|
||||
This is a library for the Adafruit MSA301 Accel breakout board
|
||||
----> https://www.adafruit.com
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
@section license License
|
||||
BSD license, all text here must be included in any redistribution.
|
||||
* @file Adafruit_MSA301.cpp
|
||||
*
|
||||
* @mainpage Adafruit MSA301 Accelerometer Breakout
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
*
|
||||
* This is a library for the Adafruit MSA301 Accel breakout board
|
||||
* ----> https://www.adafruit.com
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* @section author Author
|
||||
*
|
||||
* Limor Fried (Adafruit Industries)
|
||||
*
|
||||
* @section license License
|
||||
*
|
||||
* BSD license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include <Adafruit_MSA301.h>
|
||||
#include <Wire.h>
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
|
@ -31,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
|
||||
|
|
|
|||
|
|
@ -1,17 +1,6 @@
|
|||
/**************************************************************************/
|
||||
/*!
|
||||
@file Adafruit_MSA301.h
|
||||
@author Limor Fried (Adafruit Industries)
|
||||
|
||||
This is a library for the Adafruit MSA301 Accel breakout board
|
||||
----> https://www.adafruit.com/
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
* @file Adafruit_MSA301.h
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef ADAFRUIT_MSA301_H
|
||||
#define ADAFRUIT_MSA301_H
|
||||
|
|
@ -25,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
|
||||
|
|
@ -184,4 +174,11 @@ 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
|
||||
|
|
|
|||
BIN
MSA311-V1.1-ENG.pdf
Normal file
BIN
MSA311-V1.1-ENG.pdf
Normal file
Binary file not shown.
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
<a href="https://www.adafruit.com/products"><img src="assets/board.jpg?raw=true" width="500px"></a>
|
||||
|
||||
This is the Adafruit MSA301 Accelerometer library
|
||||
This is the Adafruit MSA301/311 Accelerometer library
|
||||
|
||||
Tested and works great with the Adafruit MSA301 Breakout Board
|
||||
Tested and works great with the Adafruit MSA301 and MSA311 Breakout Board
|
||||
* https://www.adafruit.com/product/4344
|
||||
* https://www.adafruit.com/product/5309
|
||||
|
||||
This chip uses I2C to communicate, 2 pins are required to interface
|
||||
This breakout uses I2C to communicate, 2 pins are required to interface.
|
||||
|
||||
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,27 @@
|
|||
// Basic demo for accelerometer readings from Adafruit MSA301
|
||||
// Basic demo for accelerometer readings from Adafruit MSA301/311
|
||||
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_MSA301.h>
|
||||
#include <Adafruit_Sensor.h>
|
||||
|
||||
Adafruit_MSA301 msa;
|
||||
//
|
||||
// Comment/Uncomment as needed for specific MSA being used:
|
||||
//
|
||||
// Adafruit_MSA301 msa;
|
||||
Adafruit_MSA311 msa;
|
||||
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
while (!Serial) delay(10); // will pause Zero, Leonardo, etc until serial console opens
|
||||
|
||||
Serial.println("Adafruit MSA301 test!");
|
||||
Serial.println("Adafruit MSA301/311 test!");
|
||||
|
||||
// Try to initialize!
|
||||
if (! msa.begin()) {
|
||||
Serial.println("Failed to find MSA301 chip");
|
||||
Serial.println("Failed to find MSA301/311 chip");
|
||||
while (1) { delay(10); }
|
||||
}
|
||||
Serial.println("MSA301 Found!");
|
||||
Serial.println("MSA301/311 Found!");
|
||||
|
||||
//msa.setDataRate(MSA301_DATARATE_31_25_HZ);
|
||||
Serial.print("Data rate set to: ");
|
||||
|
|
|
|||
|
|
@ -1,24 +1,29 @@
|
|||
// OLED demo for accelerometer readings from Adafruit MSA301
|
||||
// OLED demo for accelerometer readings from Adafruit MSA301/311
|
||||
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#include <Adafruit_MSA301.h>
|
||||
#include <Adafruit_Sensor.h>
|
||||
|
||||
Adafruit_MSA301 msa;
|
||||
//
|
||||
// Comment/Uncomment as needed for specific MSA being used:
|
||||
//
|
||||
// Adafruit_MSA301 msa;
|
||||
Adafruit_MSA311 msa;
|
||||
|
||||
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32, &Wire);
|
||||
|
||||
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
Serial.println("Adafruit MSA301 demo!");
|
||||
Serial.println("Adafruit MSA301/311 demo!");
|
||||
|
||||
// Try to initialize!
|
||||
if (! msa.begin()) {
|
||||
Serial.println("Failed to find MSA301 chip");
|
||||
Serial.println("Failed to find MSA301/311 chip");
|
||||
while (1) { delay(10); }
|
||||
}
|
||||
Serial.println("MSA301 Found!");
|
||||
Serial.println("MSA301/311 Found!");
|
||||
|
||||
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
|
||||
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
|
||||
|
|
@ -39,7 +44,7 @@ void loop() {
|
|||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0,0);
|
||||
display.println("- Adafruit MSA301 -");
|
||||
display.println("- Adafruit MSA3x1 -");
|
||||
|
||||
/* Display the results (acceleration is measured in m/s^2) */
|
||||
Serial.print("\t\tX: "); Serial.print(event.acceleration.x);
|
||||
|
|
|
|||
|
|
@ -1,23 +1,27 @@
|
|||
// Basic demo for plotting accelerometer readings from Adafruit MSA301
|
||||
// Basic demo for plotting accelerometer readings from Adafruit MSA301/311
|
||||
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_MSA301.h>
|
||||
#include <Adafruit_Sensor.h>
|
||||
|
||||
Adafruit_MSA301 msa;
|
||||
//
|
||||
// Comment/Uncomment as needed for specific MSA being used:
|
||||
//
|
||||
// Adafruit_MSA301 msa;
|
||||
Adafruit_MSA311 msa;
|
||||
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
while (!Serial) delay(10); // will pause Zero, Leonardo, etc until serial console opens
|
||||
|
||||
Serial.println("Adafruit MSA301 test!");
|
||||
Serial.println("Adafruit MSA301/311 test!");
|
||||
|
||||
// Try to initialize!
|
||||
if (! msa.begin()) {
|
||||
Serial.println("Failed to find MSA301 chip");
|
||||
Serial.println("Failed to find MSA301/311 chip");
|
||||
while (1) { delay(10); }
|
||||
}
|
||||
Serial.println("MSA301 Found!");
|
||||
Serial.println("MSA301/311 Found!");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
// Basic demo for tap/doubletap readings from Adafruit MSA301
|
||||
// Basic demo for tap/doubletap readings from Adafruit MSA301/311
|
||||
|
||||
#include <Adafruit_MSA301.h>
|
||||
|
||||
Adafruit_MSA301 msa;
|
||||
//
|
||||
// Comment/Uncomment as needed for specific MSA being used:
|
||||
//
|
||||
// Adafruit_MSA301 msa;
|
||||
Adafruit_MSA311 msa;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
|
@ -10,10 +14,10 @@ void setup() {
|
|||
|
||||
// Try to initialize!
|
||||
if (! msa.begin()) {
|
||||
Serial.println("Failed to find MSA301 chip");
|
||||
Serial.println("Failed to find MSA301/311 chip");
|
||||
while (1) { delay(10); }
|
||||
}
|
||||
Serial.println("Found MSA301!");
|
||||
Serial.println("Found MSA301/311!");
|
||||
|
||||
msa.setPowerMode(MSA301_NORMALMODE);
|
||||
msa.setDataRate(MSA301_DATARATE_1000_HZ);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name=Adafruit MSA301
|
||||
version=1.0.8
|
||||
version=1.1.4
|
||||
author=Adafruit <info@adafruit.com>
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Library for the Adafruit MSA301 Accelerometer.
|
||||
|
|
|
|||
Loading…
Reference in a new issue