diff --git a/inc/core/MicroBitComponent.h b/inc/core/MicroBitComponent.h index fd30f88..f26b938 100644 --- a/inc/core/MicroBitComponent.h +++ b/inc/core/MicroBitComponent.h @@ -70,6 +70,7 @@ DEALINGS IN THE SOFTWARE. #define MICROBIT_ID_IO_INT1 33 //INT1 #define MICROBIT_ID_IO_INT2 34 //INT2 +#define MICROBIT_ID_IO_INT3 35 //INT3 #define MICROBIT_ID_MESSAGE_BUS_LISTENER 1021 // Message bus indication that a handler for a given ID has been registered. #define MICROBIT_ID_NOTIFY_ONE 1022 // Notfication channel, for general purpose synchronisation diff --git a/inc/drivers/MicroBitIO.h b/inc/drivers/MicroBitIO.h index c94e927..34ecef1 100644 --- a/inc/drivers/MicroBitIO.h +++ b/inc/drivers/MicroBitIO.h @@ -62,6 +62,7 @@ class MicroBitIO MicroBitPin P20; MicroBitPin int1; MicroBitPin int2; + MicroBitPin int3; /** * Constructor. @@ -77,7 +78,7 @@ class MicroBitIO int ID_P9, int ID_P10,int ID_P11, int ID_P12,int ID_P13,int ID_P14, int ID_P15,int ID_P16,int ID_P19, - int ID_P20, int ID_INT1, int ID_INT2); + int ID_P20, int ID_INT1, int ID_INT2, int ID_INT3); }; #endif diff --git a/source/drivers/FXOS8700.cpp b/source/drivers/FXOS8700.cpp index a5b4d5f..da32638 100644 --- a/source/drivers/FXOS8700.cpp +++ b/source/drivers/FXOS8700.cpp @@ -104,9 +104,9 @@ int FXOS8700::configure() if (result != 0) return MICROBIT_I2C_ERROR; - // Configure PushPull Active LOW interrupt mode. + // Configure Open Drain Active LOW interrupt mode. // n.b. This may need to be reconfigured if the interrupt line is shared. - value = 0x00; + value = 0x01; result = i2c.writeRegister(address, FXOS8700_CTRL_REG3, value); if (result != 0) return MICROBIT_I2C_ERROR; @@ -157,6 +157,9 @@ FXOS8700::FXOS8700(MicroBitI2C &_i2c, MicroBitPin &_int1, CoordinateSpace &coord // Store our identifiers. this->address = address; + // Enable pullup on the interrupt line + int1.setPull(PullUp); + // Configure and enable the accelerometer. configure(); } diff --git a/source/drivers/MicroBitIO.cpp b/source/drivers/MicroBitIO.cpp index f6a701b..e3be7cd 100644 --- a/source/drivers/MicroBitIO.cpp +++ b/source/drivers/MicroBitIO.cpp @@ -46,7 +46,7 @@ MicroBitIO::MicroBitIO(int ID_P0, int ID_P1, int ID_P2, int ID_P9, int ID_P10,int ID_P11, int ID_P12,int ID_P13,int ID_P14, int ID_P15,int ID_P16,int ID_P19, - int ID_P20, int ID_INT1, int ID_INT2) : + int ID_P20, int ID_INT1, int ID_INT2, int ID_INT3) : P0 (ID_P0, MICROBIT_PIN_P0, PIN_CAPABILITY_ALL), //P0 is the left most pad (ANALOG/DIGITAL/TOUCH) P1 (ID_P1, MICROBIT_PIN_P1, PIN_CAPABILITY_ALL), //P1 is the middle pad (ANALOG/DIGITAL/TOUCH) P2 (ID_P2, MICROBIT_PIN_P2, PIN_CAPABILITY_ALL), //P2 is the right most pad (ANALOG/DIGITAL/TOUCH) @@ -67,6 +67,7 @@ MicroBitIO::MicroBitIO(int ID_P0, int ID_P1, int ID_P2, P19(ID_P19,MICROBIT_PIN_P19,PIN_CAPABILITY_STANDARD), //SCL P20(ID_P20,MICROBIT_PIN_P20,PIN_CAPABILITY_STANDARD), //SDA int1(ID_INT1,P0_28,PIN_CAPABILITY_STANDARD), //INT1 - int2(ID_INT2,P0_29,PIN_CAPABILITY_STANDARD) //INT2 + int2(ID_INT2,P0_29,PIN_CAPABILITY_STANDARD), //INT2 + int3(ID_INT3,P0_27,PIN_CAPABILITY_STANDARD) //INT3 { }