Skip to content

Commit 1424b06

Browse files
authored
Merge pull request #12 from sparkfun/samd51_support
Samd51 support
2 parents 0bfb48c + 3ac18da commit 1424b06

File tree

23 files changed

+536
-69
lines changed

23 files changed

+536
-69
lines changed

examples/Example_01_RotationVector/Example_01_RotationVector.ino

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@
2525
https://github.com/adafruit/Adafruit_BusIO
2626
2727
Hardware Connections:
28-
Plug the sensor into IoT RedBoard via QWIIC cable.
28+
IoT RedBoard --> BNO08x
29+
QWIIC --> QWIIC
30+
A4 --> INT
31+
A5 --> RST
32+
33+
BNO08x "mode" jumpers set for I2C (default):
34+
PSO: OPEN
35+
PS1: OPEN
36+
2937
Serial.print it out at 115200 baud to serial monitor.
3038
3139
Feel like supporting our work? Buy a board from SparkFun!
@@ -37,14 +45,34 @@
3745
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
3846
BNO08x myIMU;
3947

48+
// For the most reliable interaction with the SHTP bus, we need
49+
// to use hardware reset control, and to monitor the H_INT pin.
50+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
51+
// Note, these can be other GPIO if you like.
52+
// Define as -1 to disable these features.
53+
#define BNO08X_INT A4
54+
//#define BNO08X_INT -1
55+
#define BNO08X_RST A5
56+
//#define BNO08X_RST -1
57+
58+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
59+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
60+
4061
void setup() {
4162
Serial.begin(115200);
63+
64+
while(!Serial) delay(10); // Wait for Serial to become available.
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
4269
Serial.println();
4370
Serial.println("BNO08x Read Example");
4471

4572
Wire.begin();
4673

47-
if (myIMU.begin() == false) {
74+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
75+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4876
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4977
while (1)
5078
;

examples/Example_02_Accelerometer/Example_02_Accelerometer.ino

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -36,14 +44,34 @@
3644
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
3745
BNO08x myIMU;
3846

47+
// For the most reliable interaction with the SHTP bus, we need
48+
// to use hardware reset control, and to monitor the H_INT pin.
49+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
50+
// Note, these can be other GPIO if you like.
51+
// Define as -1 to disable these features.
52+
#define BNO08X_INT A4
53+
//#define BNO08X_INT -1
54+
#define BNO08X_RST A5
55+
//#define BNO08X_RST -1
56+
57+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
58+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
59+
3960
void setup() {
4061
Serial.begin(115200);
62+
63+
while(!Serial) delay(10); // Wait for Serial to become available.
64+
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
66+
// Comment out this while loop, or it will prevent the remaining code from running.
67+
4168
Serial.println();
4269
Serial.println("BNO08x Read Example");
4370

4471
Wire.begin();
4572

46-
if (myIMU.begin() == false) {
73+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
74+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4775
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4876
while (1)
4977
;

examples/Example_03_Gyro/Example_03_Gyro.ino

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -37,14 +45,34 @@
3745

3846
BNO08x myIMU;
3947

48+
// For the most reliable interaction with the SHTP bus, we need
49+
// to use hardware reset control, and to monitor the H_INT pin.
50+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
51+
// Note, these can be other GPIO if you like.
52+
// Define as -1 to disable these features.
53+
#define BNO08X_INT A4
54+
//#define BNO08X_INT -1
55+
#define BNO08X_RST A5
56+
//#define BNO08X_RST -1
57+
58+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
59+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
60+
4061
void setup() {
4162
Serial.begin(115200);
63+
64+
while(!Serial) delay(10); // Wait for Serial to become available.
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
4269
Serial.println();
4370
Serial.println("BNO08x Read Example");
4471

4572
Wire.begin();
4673

47-
if (myIMU.begin() == false) {
74+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
75+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4876
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4977
while (1)
5078
;

examples/Example_04_Magnetometer/Example_04_Magnetometer.ino

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -37,14 +45,34 @@
3745

3846
BNO08x myIMU;
3947

48+
// For the most reliable interaction with the SHTP bus, we need
49+
// to use hardware reset control, and to monitor the H_INT pin.
50+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
51+
// Note, these can be other GPIO if you like.
52+
// Define as -1 to disable these features.
53+
#define BNO08X_INT A4
54+
//#define BNO08X_INT -1
55+
#define BNO08X_RST A5
56+
//#define BNO08X_RST -1
57+
58+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
59+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
60+
4061
void setup() {
4162
Serial.begin(115200);
63+
64+
while(!Serial) delay(10); // Wait for Serial to become available.
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
4269
Serial.println();
4370
Serial.println("BNO08x Read Example");
4471

4572
Wire.begin();
4673

47-
if (myIMU.begin() == false) {
74+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
75+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4876
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4977
while (1)
5078
;

examples/Example_05_StepCounter/Example_05_StepCounter.ino

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -34,17 +42,36 @@
3442
#include <Wire.h>
3543

3644
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
37-
3845
BNO08x myIMU;
3946

47+
// For the most reliable interaction with the SHTP bus, we need
48+
// to use hardware reset control, and to monitor the H_INT pin.
49+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
50+
// Note, these can be other GPIO if you like.
51+
// Define as -1 to disable these features.
52+
#define BNO08X_INT A4
53+
//#define BNO08X_INT -1
54+
#define BNO08X_RST A5
55+
//#define BNO08X_RST -1
56+
57+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
58+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
59+
4060
void setup() {
4161
Serial.begin(115200);
62+
63+
while(!Serial) delay(10); // Wait for Serial to become available.
64+
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
66+
// Comment out this while loop, or it will prevent the remaining code from running.
67+
4268
Serial.println();
4369
Serial.println("BNO08x Read Example");
4470

4571
Wire.begin();
4672

47-
if (myIMU.begin() == false) {
73+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
74+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4875
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4976
while (1)
5077
;

examples/Example_06_StabilityClassifier/Example_06_StabilityClassifier.ino

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@
2525
https://github.com/adafruit/Adafruit_BusIO
2626
2727
Hardware Connections:
28-
Plug the sensor into IoT RedBoard via QWIIC cable.
28+
IoT RedBoard --> BNO08x
29+
QWIIC --> QWIIC
30+
A4 --> INT
31+
A5 --> RST
32+
33+
BNO08x "mode" jumpers set for I2C (default):
34+
PSO: OPEN
35+
PS1: OPEN
36+
2937
Serial.print it out at 115200 baud to serial monitor.
3038
3139
Feel like supporting our work? Buy a board from SparkFun!
@@ -37,14 +45,34 @@
3745
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
3846
BNO08x myIMU;
3947

48+
// For the most reliable interaction with the SHTP bus, we need
49+
// to use hardware reset control, and to monitor the H_INT pin.
50+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
51+
// Note, these can be other GPIO if you like.
52+
// Define as -1 to disable these features.
53+
#define BNO08X_INT A4
54+
//#define BNO08X_INT -1
55+
#define BNO08X_RST A5
56+
//#define BNO08X_RST -1
57+
58+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
59+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
60+
4061
void setup() {
4162
Serial.begin(115200);
63+
64+
while(!Serial) delay(10); // Wait for Serial to become available.
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
4269
Serial.println();
4370
Serial.println("BNO08x Read Example");
4471

4572
Wire.begin();
4673

47-
if (myIMU.begin() == false) {
74+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
75+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4876
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4977
while (1)
5078
;

examples/Example_07_ActivityClassifier/Example_07_ActivityClassifier.ino

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@
3434
https://github.com/adafruit/Adafruit_BusIO
3535
3636
Hardware Connections:
37-
Plug the sensor into IoT RedBoard via QWIIC cable.
37+
IoT RedBoard --> BNO08x
38+
QWIIC --> QWIIC
39+
A4 --> INT
40+
A5 --> RST
41+
42+
BNO08x "mode" jumpers set for I2C (default):
43+
PSO: OPEN
44+
PS1: OPEN
45+
3846
Serial.print it out at 115200 baud to serial monitor.
3947
4048
Feel like supporting our work? Buy a board from SparkFun!
@@ -47,14 +55,34 @@
4755

4856
BNO08x myIMU;
4957

58+
// For the most reliable interaction with the SHTP bus, we need
59+
// to use hardware reset control, and to monitor the H_INT pin.
60+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
61+
// Note, these can be other GPIO if you like.
62+
// Define as -1 to disable these features.
63+
#define BNO08X_INT A4
64+
//#define BNO08X_INT -1
65+
#define BNO08X_RST A5
66+
//#define BNO08X_RST -1
67+
68+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
69+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
70+
5071
void setup() {
5172
Serial.begin(115200);
73+
74+
while(!Serial) delay(10); // Wait for Serial to become available.
75+
// Necessary for boards with native USB (like the SAMD51 Thing+).
76+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
77+
// Comment out this while loop, or it will prevent the remaining code from running.
78+
5279
Serial.println();
5380
Serial.println("BNO08x Read Example");
5481

5582
Wire.begin();
5683

57-
if (myIMU.begin() == false) {
84+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
85+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
5886
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
5987
while (1)
6088
;

0 commit comments

Comments
 (0)