Skip to content

Commit ef3ccb5

Browse files
committed
Update example to use enums
1 parent 0faeb63 commit ef3ccb5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

libraries/CurieImu/examples/RawImuDataSerial/RawImuDataSerial.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void setup() {
108108
Serial.println(CurieIMU.getGyroOffset(Z_AXIS));
109109

110110
Serial.println("Enabling Gyroscope/Acceleration offset compensation");
111-
CurieIMU.enableGyroOffset(false);
111+
CurieIMU.enableGyroOffset(true);
112112
CurieIMU.enableAccelerometerOffset(true);
113113

114114
Serial.println(CurieIMU.accelerometerOffsetEnabled());
@@ -152,4 +152,4 @@ void loop() {
152152
// blink LED to indicate activity
153153
blinkState = !blinkState;
154154
digitalWrite(ledPin, blinkState);
155-
}
155+
}

libraries/CurieImu/examples/ShockDetect/ShockDetect.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ void setup() {
3535

3636
/* Enable Shock Detection */
3737
CurieIMU.setDetectionThreshold(CURIE_IMU_SHOCK, 192); // 1.5g
38-
CurieIMU.setDetectionDuration(CURIE_IMU_SHOCK,11); // 30ms
39-
CurieIMU.enableInterrupt(CURIE_IMU_SHOCK,true);
38+
CurieIMU.setDetectionDuration(CURIE_IMU_SHOCK, CURIE_IMU_TAP_SHOCK_DURATION_50MS); // 50ms
39+
CurieIMU.enableInterrupt(CURIE_IMU_SHOCK, true);
4040

4141
/* Enable Interrupts Notifications */
4242
CurieIMU.setIntEnabled(true);
@@ -68,4 +68,4 @@ static void eventCallback(void)
6868
if (CurieIMU.shockDetected(Z_AXIS,NEGATIVE))
6969
Serial.println("Positive shock detected on Z-axis");
7070
}
71-
}
71+
}

libraries/CurieImu/examples/StepCount/StepCount.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void setup() {
5252
// attach the eventCallback function as the
5353
// step event handler:
5454
CurieIMU.attachInterrupt(eventCallback);
55-
CurieIMU.enableInterrupt(CURIE_IMU_STEP,true); // turn on step detection
55+
CurieIMU.enableInterrupt(CURIE_IMU_STEP, true); // turn on step detection
5656
CurieIMU.setIntEnabled(true); // enable interrupts
5757

5858
Serial.println("IMU initialisation complete, waiting for events...");

libraries/CurieImu/examples/TapDetect/TapDetect.ino

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ void setup() {
3232
CurieIMU.attachInterrupt(eventCallback);
3333

3434
// Increase Accelerometer range to allow detection of stronger taps (< 4g)
35-
CurieIMU.setAccelerometerRange(4);
35+
CurieIMU.setAccelerometerRange(CURIE_IMU_ACCELEROMETER_RANGE_4G);
3636

3737
// Reduce threshold to allow detection of weaker taps (>= 750mg)
38-
CurieIMU.setDetectionThreshold(CURIE_IMU_TAP,6); // (6 x 125mg)
38+
CurieIMU.setDetectionThreshold(CURIE_IMU_TAP, 6); // (6 x 125mg)
3939

4040
// Set the time window for 2 taps to be registered as a double-tap (<= 250 milliseconds)
41-
CurieIMU.setDetectionDuration(CURIE_IMU_DOUBLE_TAP,250);
41+
CurieIMU.setDetectionDuration(CURIE_IMU_DOUBLE_TAP, CURIE_IMU_DOUBLE_TAP_DURATION_250MS);
4242

4343
// Enable Double-Tap detection
44-
CurieIMU.enableInterrupt(CURIE_IMU_DOUBLE_TAP,true);
44+
CurieIMU.enableInterrupt(CURIE_IMU_DOUBLE_TAP, true);
4545

4646
// Enable Interrupts Notifications
4747
CurieIMU.setIntEnabled(true);

0 commit comments

Comments
 (0)