Skip to content

Commit 98516df

Browse files
authored
Merge pull request #27 from sparkfun/correcting_license
Clarifying the license
2 parents dff1a74 + 00bcabb commit 98516df

File tree

5 files changed

+75
-79
lines changed

5 files changed

+75
-79
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SparkFun_ICM-20948_ArduinoLibrary
22
========================================
33

4-
This is the library for the [SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)](https://www.sparkfun.com/products/15335).
4+
This is the library for the [SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)](https://www.sparkfun.com/products/15335).
55

66

77
Repository Contents
@@ -18,7 +18,7 @@ Documentation
1818
* **[Hookup Guide](https://learn.sparkfun.com/tutorials/sparkfun-9dof-imu-icm-20948-breakout-hookup-guide)** - Basic hookup guide for the SparkFun 9DoF IMU Breakout.
1919
* **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library.
2020

21-
Products that use this Library
21+
Products that use this Library
2222
---------------------------------
2323
* [SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)](https://www.sparkfun.com/products/15335)
2424

@@ -28,7 +28,7 @@ License Information
2828

2929
This product is _**open source**_!
3030

31-
The **code** is released under the GPL v3 license. See the included LICENSE.md for more information.
31+
Please see the included [License.md](./License.md) for more information.
3232

3333
Distributed as-is; no warranty is given.
3434

examples/Arduino/Example1_Basics/Example1_Basics.ino

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/****************************************************************
22
* Example1_Basics.ino
3-
* ICM 20948 Arduino Library Demo
3+
* ICM 20948 Arduino Library Demo
44
* Use the default configuration to stream 9-axis IMU data
55
* Owen Lyke @ SparkFun Electronics
66
* Original Creation Date: April 17 2019
7-
*
8-
* This code is beerware; if you see me (or any other SparkFun employee) at the
9-
* local, and you've found our code helpful, please buy us a round!
10-
*
7+
*
8+
* Please see License.md for the license information.
9+
*
1110
* Distributed as-is; no warranty is given.
1211
***************************************************************/
1312
#include "ICM_20948.h" // Click here to get the library: http://librarymanager/All#SparkFun_ICM_20948_IMU
@@ -20,8 +19,8 @@
2019
#define CS_PIN 2 // Which pin you connect CS to. Used only when "USE_SPI" is defined
2120

2221
#define WIRE_PORT Wire // Your desired Wire port. Used when "USE_SPI" is not defined
23-
#define AD0_VAL 1 // The value of the last bit of the I2C address.
24-
// On the SparkFun 9DoF IMU breakout the default is 1, and when
22+
#define AD0_VAL 1 // The value of the last bit of the I2C address.
23+
// On the SparkFun 9DoF IMU breakout the default is 1, and when
2524
// the ADR jumper is closed the value becomes 0
2625

2726
#ifdef USE_SPI
@@ -42,12 +41,12 @@ void setup() {
4241
WIRE_PORT.begin();
4342
WIRE_PORT.setClock(400000);
4443
#endif
45-
44+
4645
bool initialized = false;
4746
while( !initialized ){
4847

4948
#ifdef USE_SPI
50-
myICM.begin( CS_PIN, SPI_PORT );
49+
myICM.begin( CS_PIN, SPI_PORT );
5150
#else
5251
myICM.begin( WIRE_PORT, AD0_VAL );
5352
#endif
@@ -74,7 +73,7 @@ void loop() {
7473
Serial.println("Waiting for data");
7574
delay(500);
7675
}
77-
76+
7877
}
7978

8079

examples/Arduino/Example2_Advanced/Example2_Advanced.ino

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/****************************************************************
22
* Example2_Advanced.ino
3-
* ICM 20948 Arduino Library Demo
3+
* ICM 20948 Arduino Library Demo
44
* Shows how to use granular configuration of the ICM 20948
55
* Owen Lyke @ SparkFun Electronics
66
* Original Creation Date: April 17 2019
7-
*
8-
* This code is beerware; if you see me (or any other SparkFun employee) at the
9-
* local, and you've found our code helpful, please buy us a round!
10-
*
7+
*
8+
* Please see License.md for the license information.
9+
*
1110
* Distributed as-is; no warranty is given.
1211
***************************************************************/
1312
#include "ICM_20948.h" // Click here to get the library: http://librarymanager/All#SparkFun_ICM_20948_IMU
@@ -21,16 +20,16 @@
2120
#define CS_PIN 2 // Which pin you connect CS to. Used only when "USE_SPI" is defined
2221

2322
#define WIRE_PORT Wire // Your desired Wire port. Used when "USE_SPI" is not defined
24-
#define AD0_VAL 1 // The value of the last bit of the I2C address.
25-
// On the SparkFun 9DoF IMU breakout the default is 1, and when
23+
#define AD0_VAL 1 // The value of the last bit of the I2C address.
24+
// On the SparkFun 9DoF IMU breakout the default is 1, and when
2625
// the ADR jumper is closed the value becomes 0
2726

2827
#ifdef USE_SPI
2928
ICM_20948_SPI myICM; // If using SPI create an ICM_20948_SPI object
3029
#else
3130
ICM_20948_I2C myICM; // Otherwise create an ICM_20948_I2C object
3231
#endif
33-
32+
3433

3534
void setup() {
3635

@@ -43,12 +42,12 @@ void setup() {
4342
WIRE_PORT.begin();
4443
WIRE_PORT.setClock(400000);
4544
#endif
46-
45+
4746
bool initialized = false;
4847
while( !initialized ){
4948

5049
#ifdef USE_SPI
51-
myICM.begin( CS_PIN, SPI_PORT, SPI_FREQ ); // Here we are using the user-defined SPI_FREQ as the clock speed of the SPI bus
50+
myICM.begin( CS_PIN, SPI_PORT, SPI_FREQ ); // Here we are using the user-defined SPI_FREQ as the clock speed of the SPI bus
5251
#else
5352
myICM.begin( WIRE_PORT, AD0_VAL );
5453
#endif
@@ -73,7 +72,7 @@ void setup() {
7372
SERIAL_PORT.println(myICM.statusString());
7473
}
7574
delay(250);
76-
75+
7776
// Now wake the sensor up
7877
myICM.sleep( false );
7978
myICM.lowPower( false );
@@ -83,28 +82,28 @@ void setup() {
8382
// Set Gyro and Accelerometer to a particular sample mode
8483
// options: ICM_20948_Sample_Mode_Continuous
8584
// ICM_20948_Sample_Mode_Cycled
86-
myICM.setSampleMode( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), ICM_20948_Sample_Mode_Continuous );
85+
myICM.setSampleMode( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), ICM_20948_Sample_Mode_Continuous );
8786
if( myICM.status != ICM_20948_Stat_Ok){
8887
SERIAL_PORT.print(F("setSampleMode returned: "));
8988
SERIAL_PORT.println(myICM.statusString());
9089
}
9190

9291
// Set full scale ranges for both acc and gyr
9392
ICM_20948_fss_t myFSS; // This uses a "Full Scale Settings" structure that can contain values for all configurable sensors
94-
93+
9594
myFSS.a = gpm2; // (ICM_20948_ACCEL_CONFIG_FS_SEL_e)
9695
// gpm2
9796
// gpm4
9897
// gpm8
9998
// gpm16
100-
99+
101100
myFSS.g = dps250; // (ICM_20948_GYRO_CONFIG_1_FS_SEL_e)
102101
// dps250
103102
// dps500
104103
// dps1000
105104
// dps2000
106-
107-
myICM.setFullScale( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), myFSS );
105+
106+
myICM.setFullScale( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), myFSS );
108107
if( myICM.status != ICM_20948_Stat_Ok){
109108
SERIAL_PORT.print(F("setFullScale returned: "));
110109
SERIAL_PORT.println(myICM.statusString());
@@ -131,7 +130,7 @@ void setup() {
131130
// gyr_d11bw6_n17bw8
132131
// gyr_d5bw7_n8bw9
133132
// gyr_d361bw4_n376bw5
134-
133+
135134
myICM.setDLPFcfg( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), myDLPcfg );
136135
if( myICM.status != ICM_20948_Stat_Ok){
137136
SERIAL_PORT.print(F("setDLPcfg returned: "));
@@ -146,11 +145,11 @@ void setup() {
146145
SERIAL_PORT.print(F("Enable DLPF for Gyroscope returned: ")); SERIAL_PORT.println(myICM.statusString(gyrDLPEnableStat));
147146

148147
SERIAL_PORT.println();
149-
SERIAL_PORT.println(F("Configuration complete!"));
148+
SERIAL_PORT.println(F("Configuration complete!"));
150149
}
151150

152151
void loop() {
153-
152+
154153
if( myICM.dataReady() ){
155154
myICM.getAGMT(); // The values are only updated when you call 'getAGMT'
156155
// printRawAGMT( myICM.agmt ); // Uncomment this to see the raw values, taken directly from the agmt structure
@@ -160,7 +159,7 @@ void loop() {
160159
Serial.println("Waiting for data");
161160
delay(500);
162161
}
163-
162+
164163
}
165164

166165

examples/Arduino/Example3_Interrupts/Example3_Interrupts.ino

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/****************************************************************
22
* Example3_Interrupts.ino
3-
* ICM 20948 Arduino Library Demo
3+
* ICM 20948 Arduino Library Demo
44
* Builds on Example2_Advanced.ino to set up interrupts when data is ready
55
* Owen Lyke @ SparkFun Electronics
66
* Original Creation Date: June 5 2019
7-
*
8-
* For this example you must connect the interrupt pin "INT" on the breakout
7+
*
8+
* For this example you must connect the interrupt pin "INT" on the breakout
99
* board to the pin specified by "INT_PIN" on your microcontroller.
10-
*
11-
* This code is beerware; if you see me (or any other SparkFun employee) at the
12-
* local, and you've found our code helpful, please buy us a round!
13-
*
10+
*
11+
* Please see License.md for the license information.
12+
*
1413
* Distributed as-is; no warranty is given.
1514
***************************************************************/
1615
#include "ICM_20948.h" // Click here to get the library: http://librarymanager/All#SparkFun_ICM_20948_IMU
@@ -29,8 +28,8 @@
2928
#define CS_PIN 2 // Which pin you connect CS to. Used only when "USE_SPI" is defined
3029

3130
#define WIRE_PORT Wire // Your desired Wire port. Used when "USE_SPI" is not defined
32-
#define AD0_VAL 1 // The value of the last bit of the I2C address.
33-
// On the SparkFun 9DoF IMU breakout the default is 1, and when
31+
#define AD0_VAL 1 // The value of the last bit of the I2C address.
32+
// On the SparkFun 9DoF IMU breakout the default is 1, and when
3433
// the ADR jumper is closed the value becomes 0
3534

3635
#ifdef USE_SPI
@@ -61,12 +60,12 @@ void setup() {
6160
WIRE_PORT.begin();
6261
WIRE_PORT.setClock(400000);
6362
#endif
64-
63+
6564
bool initialized = false;
6665
while( !initialized ){
6766

6867
#ifdef USE_SPI
69-
myICM.begin( CS_PIN, SPI_PORT, SPI_FREQ ); // Here we are using the user-defined SPI_FREQ as the clock speed of the SPI bus
68+
myICM.begin( CS_PIN, SPI_PORT, SPI_FREQ ); // Here we are using the user-defined SPI_FREQ as the clock speed of the SPI bus
7069
#else
7170
myICM.begin( WIRE_PORT, AD0_VAL );
7271
#endif
@@ -91,7 +90,7 @@ void setup() {
9190
SERIAL_PORT.println(myICM.statusString());
9291
}
9392
delay(250);
94-
93+
9594
// Now wake the sensor up
9695
myICM.sleep( sensorSleep );
9796
myICM.lowPower( false );
@@ -101,7 +100,7 @@ void setup() {
101100
// Set Gyro and Accelerometer to a particular sample mode
102101
// options: ICM_20948_Sample_Mode_Continuous
103102
// ICM_20948_Sample_Mode_Cycled
104-
myICM.setSampleMode( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), ICM_20948_Sample_Mode_Cycled );
103+
myICM.setSampleMode( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), ICM_20948_Sample_Mode_Cycled );
105104
SERIAL_PORT.print(F("setSampleMode returned: "));
106105
SERIAL_PORT.println(myICM.statusString());
107106

@@ -111,23 +110,23 @@ void setup() {
111110
myICM.setSampleRate( ICM_20948_Internal_Gyr, mySmplrt );
112111
SERIAL_PORT.print(F("setSampleRate returned: "));
113112
SERIAL_PORT.println(myICM.statusString());
114-
113+
115114
// Set full scale ranges for both acc and gyr
116115
ICM_20948_fss_t myFSS; // This uses a "Full Scale Settings" structure that can contain values for all configurable sensors
117-
116+
118117
myFSS.a = gpm2; // (ICM_20948_ACCEL_CONFIG_FS_SEL_e)
119118
// gpm2
120119
// gpm4
121120
// gpm8
122121
// gpm16
123-
122+
124123
myFSS.g = dps250; // (ICM_20948_GYRO_CONFIG_1_FS_SEL_e)
125124
// dps250
126125
// dps500
127126
// dps1000
128127
// dps2000
129-
130-
myICM.setFullScale( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), myFSS );
128+
129+
myICM.setFullScale( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), myFSS );
131130
if( myICM.status != ICM_20948_Stat_Ok){
132131
SERIAL_PORT.print(F("setFullScale returned: "));
133132
SERIAL_PORT.println(myICM.statusString());
@@ -154,7 +153,7 @@ void setup() {
154153
// gyr_d11bw6_n17bw8
155154
// gyr_d5bw7_n8bw9
156155
// gyr_d361bw4_n376bw5
157-
156+
158157
myICM.setDLPFcfg( (ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), myDLPcfg );
159158
if( myICM.status != ICM_20948_Stat_Ok){
160159
SERIAL_PORT.print(F("setDLPcfg returned: "));
@@ -193,7 +192,7 @@ void setup() {
193192
myICM.cfgIntLatch(true); // Latch the interrupt until cleared
194193
SERIAL_PORT.print(F("cfgIntLatch returned: "));
195194
SERIAL_PORT.println(myICM.statusString());
196-
195+
197196
myICM.intEnableRawDataReady(true); // enable interrupts on raw data ready
198197
SERIAL_PORT.print(F("intEnableRawDataReady returned: "));
199198
SERIAL_PORT.println(myICM.statusString());
@@ -207,7 +206,7 @@ void setup() {
207206
// ICM_20948_execute_w( &myICM._device, AGB0_REG_INT_ENABLE, (uint8_t*)&zero_0, sizeof(uint8_t) );
208207

209208
SERIAL_PORT.println();
210-
SERIAL_PORT.println(F("Configuration complete!"));
209+
SERIAL_PORT.println(F("Configuration complete!"));
211210
}
212211

213212
void loop() {
@@ -217,19 +216,19 @@ void loop() {
217216
// myICM.clearInterrupts(); // This would be efficient... but not compatible with Uno
218217
}
219218

220-
myICM.clearInterrupts(); // clear interrupts for next time -
221-
// usually you'd do this only if an interrupt has occurred, however
219+
myICM.clearInterrupts(); // clear interrupts for next time -
220+
// usually you'd do this only if an interrupt has occurred, however
222221
// on the 328p I2C usage can block interrupts. This means that sometimes
223222
// an interrupt is missed. When missed, if using an edge-based interrupt
224-
// and only clearing interrupts when one was detected there will be no more
225-
// edges to respond to, so no more interrupts will be detected. Here are
223+
// and only clearing interrupts when one was detected there will be no more
224+
// edges to respond to, so no more interrupts will be detected. Here are
226225
// some possible solutions:
227226
// 1. use a level based interrupt
228227
// 2. use the pulse-based interrupt in ICM settings (set cfgIntLatch to false)
229228
// 3. use a microcontroller with nestable interrupts
230229
// 4. clear the interrupts often
231-
232-
230+
231+
233232
if( (millis()%1000) < 5){ // This is a method to turn the sensor on and off once per second without using delays
234233
if( canToggle ){
235234
sensorSleep = !sensorSleep;

0 commit comments

Comments
 (0)