Skip to content

Commit 57d3411

Browse files
committed
imu, TIM9
1 parent c7fe613 commit 57d3411

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

examples/imu/imu.ino

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
#include "Wire.h"
12
#include "motion_fx.h"
23
#include "LSM6DSOSensor.h"
34

5+
TwoWire wire(PB7, PB8);
6+
47
#define ALGO_FREQ 100U /* Algorithm frequency 100Hz */
58
#define ALGO_PERIOD (1000U / ALGO_FREQ) /* Algorithm period [ms] */
69
#define MOTION_FX_ENGINE_DELTATIME 0.01f
@@ -37,7 +40,7 @@ int32_t gyroscope[3];
3740
int32_t magnetometer[3];
3841
int32_t MagOffset[3];
3942

40-
LSM6DSOSensor AccGyr(&Wire, LSM6DSO_I2C_ADD_L);
43+
LSM6DSOSensor AccGyr(&wire, LSM6DSO_I2C_ADD_L);
4144

4245
HardwareTimer *MyTim;
4346

@@ -54,8 +57,8 @@ void setup() {
5457
while (!Serial) yield();
5558

5659
/* Initialize I2C bus */
57-
Wire.begin();
58-
Wire.setClock(400000);
60+
wire.begin();
61+
wire.setClock(400000);
5962

6063
/* Start communication with IMU */
6164
AccGyr.begin();
@@ -94,7 +97,7 @@ void setup() {
9497
/* Get library version */
9598
LibVersionLen = (int)MotionFX_GetLibVersion(LibVersion);
9699

97-
MyTim = new HardwareTimer(TIM3);
100+
MyTim = new HardwareTimer(TIM9); //TIM3
98101
MyTim->setOverflow(ALGO_FREQ, HERTZ_FORMAT);
99102
MyTim->attachInterrupt(fusion_update);
100103
MyTim->resume();

0 commit comments

Comments
 (0)