diff --git a/inc/compat/MicroBitButton.h b/inc/compat/MicroBitButton.h index 5b86e2f0..93e79956 100644 --- a/inc/compat/MicroBitButton.h +++ b/inc/compat/MicroBitButton.h @@ -59,6 +59,22 @@ class MicroBitButton : public NRF52Pin, public Button */ MicroBitButton(PinName name, uint16_t id, MicroBitButtonEventConfiguration eventConfiguration = MICROBIT_BUTTON_ALL_EVENTS, PinMode mode = PullNone); + /** + * Constructor. + * + * Create a software representation of a button. + * + * @param p_number the physical pin on the processor that should be used as input. + * + * @param id the ID of the new MicroBitButton object. + * + * @param eventConfiguration Configures the events that will be generated by this MicroBitButton instance. + * Defaults to MICROBIT_BUTTON_ALL_EVENTS. + * + * @param mode the configuration of internal pullups/pulldowns, as defined in the mbed PinMode class. PullNone by default. + */ + MicroBitButton(PinNumber p_number, uint16_t id, MicroBitButtonEventConfiguration eventConfiguration = MICROBIT_BUTTON_ALL_EVENTS, PinMode mode = PullNone); + /** * Constructor. * diff --git a/source/compat/MicroBitButton.cpp b/source/compat/MicroBitButton.cpp index c13f46b1..10d06366 100644 --- a/source/compat/MicroBitButton.cpp +++ b/source/compat/MicroBitButton.cpp @@ -57,6 +57,24 @@ MicroBitButton::MicroBitButton(PinName name, uint16_t id, MicroBitButtonEventCon { } +/** + * Constructor. + * + * Create a software representation of a button. + * + * @param p_number the physical pin on the processor that should be used as input. + * + * @param id the ID of the new MicroBitButton object. + * + * @param eventConfiguration Configures the events that will be generated by this MicroBitButton instance. + * Defaults to MICROBIT_BUTTON_ALL_EVENTS. + * + * @param mode the configuration of internal pullups/pulldowns, as defined in the mbed PinMode class. PullNone by default. + */ +MicroBitButton::MicroBitButton(PinNumber p_number, uint16_t id, MicroBitButtonEventConfiguration eventConfiguration, PinMode mode) : NRF52Pin(id, p_number, PIN_CAPABILITY_DIGITAL), Button(*this, id, eventConfiguration, ButtonPolarity::ACTIVE_LOW, getPullModeFronPinMode(mode)) +{ +} + /** * Constructor. *