Skip to content

Commit ff237b5

Browse files
committed
nesso_n1: fix interrupt example
1 parent e8b6b1b commit ff237b5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

examples/Interrupts_subclassing/Interrupts_subclassing.ino

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ class MyBoschSensor: public BoschSensorClass {
1414
struct bmi2_int_pin_config int_pin_cfg;
1515
int_pin_cfg.pin_type = BMI2_INT1;
1616
int_pin_cfg.int_latch = BMI2_INT_NON_LATCH;
17+
#if defined(ARDUINO_ARDUINO_NESSO_N1)
18+
int_pin_cfg.pin_cfg[0].lvl = BMI2_INT_ACTIVE_LOW;
19+
#else
1720
int_pin_cfg.pin_cfg[0].lvl = BMI2_INT_ACTIVE_HIGH;
21+
#endif
1822
int_pin_cfg.pin_cfg[0].od = BMI2_INT_PUSH_PULL;
1923
int_pin_cfg.pin_cfg[0].output_en = BMI2_INT_OUTPUT_ENABLE;
2024
int_pin_cfg.pin_cfg[0].input_en = BMI2_INT_INPUT_DISABLE;
@@ -52,7 +56,11 @@ class MyBoschSensor: public BoschSensorClass {
5256
}
5357
};
5458

59+
#if defined(ARDUINO_ARDUINO_NESSO_N1)
60+
MyBoschSensor myIMU(Wire);
61+
#else
5562
MyBoschSensor myIMU(Wire1);
63+
#endif
5664

5765
void print_data() {
5866
// we can also read accelerometer / gyro data here!
@@ -65,7 +73,11 @@ void setup() {
6573
while (!Serial);
6674
myIMU.debug(Serial);
6775
myIMU.onInterrupt(print_data);
68-
myIMU.begin();
76+
#if defined(ARDUINO_ARDUINO_NESSO_N1)
77+
myIMU.begin(BOSCH_ACCEL_ONLY);
78+
#else
79+
myIMU.begin(BOSCH_ACCEL_AND_GYRO);
80+
#endif
6981

7082
Serial.print("Accelerometer sample rate = ");
7183
Serial.println(myIMU.accelerationSampleRate());

0 commit comments

Comments
 (0)