File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
examples/Interrupts_subclassing Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff 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
5562MyBoschSensor myIMU (Wire1);
63+ #endif
5664
5765void 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 ());
You can’t perform that action at this time.
0 commit comments