Skip to content

Commit e8b6b1b

Browse files
committed
nesso_n1: enable INT pin
1 parent 90d4343 commit e8b6b1b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/BMI270.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ void BoschSensorClass::onInterrupt(mbed::Callback<void(void)> cb)
3939
irq.rise(mbed::callback(this, &BoschSensorClass::interrupt_handler));
4040
}
4141
#endif
42+
#ifdef ARDUINO_ARCH_ESP32
43+
void BoschSensorClass::onInterrupt(void (*cb)(void))
44+
{
45+
if (BMI270_INT1 == -1) {
46+
return;
47+
}
48+
pinMode(BMI270_INT1, INPUT_PULLUP);
49+
attachInterrupt(BMI270_INT1, cb, FALLING);
50+
}
51+
#endif
4252
int BoschSensorClass::begin(CfgBoshSensor_t cfg) {
4353

4454
_wire->begin();

src/BoschSensorClass.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ class BoschSensorClass {
150150
}
151151
PinName BMI270_INT1 = NC;
152152
#endif
153+
#ifdef ARDUINO_ARCH_ESP32
154+
void onInterrupt(void (*)(void));
155+
void setInterruptPin(int irq_pin) {
156+
BMI270_INT1 = irq_pin;
157+
}
158+
#if defined(ARDUINO_ARDUINO_NESSO_N1)
159+
int BMI270_INT1 = 3;
160+
#else
161+
int BMI270_INT1 = -1;
162+
#endif
163+
#endif
153164
// Accelerometer
154165
virtual int readAcceleration(float& x, float& y, float& z); // Results are in G (earth gravity).
155166
virtual int accelerationAvailable(); // Number of samples in the FIFO.

0 commit comments

Comments
 (0)