mbed.org local branch of microbit-dal. The real version lives in git at https://github.com/lancaster-university/microbit-dal
Dependencies: BLE_API nRF51822 mbed-dev-bin
Dependents: microbit Microbit IoTChallenge1 microbit ... more
MicroBitMultiButton Class Reference
Class definition for MicroBitMultiButton. More...
#include <MicroBitMultiButton.h>
Inherits MicroBitComponent.
Public Member Functions | |
MicroBitMultiButton (uint16_t button1, uint16_t button2, uint16_t id) | |
Constructor. | |
int | isPressed () |
Tests if this MicroBitMultiButton instance is virtually pressed. | |
void | setEventConfiguration (MicroBitButtonEventConfiguration config) |
Changes the event configuration of this button to the given MicroBitButtonEventConfiguration. | |
virtual void | systemTick () |
The system timer will call this member function once the component has been added to the array of system components using system_timer_add_component. | |
virtual void | idleTick () |
The idle thread will call this member function once the component has been added to the array of idle components using fiber_add_idle_component. |
Detailed Description
Class definition for MicroBitMultiButton.
Represents a virtual button, capable of reacting to simultaneous presses of two other buttons.
Definition at line 48 of file MicroBitMultiButton.h.
Constructor & Destructor Documentation
MicroBitMultiButton | ( | uint16_t | button1, |
uint16_t | button2, | ||
uint16_t | id | ||
) |
Constructor.
Class definition for MicroBitMultiButton.
Create a representation of a virtual button, that generates events based upon the combination of two given buttons.
- Parameters:
-
button1 the unique ID of the first button to watch. button2 the unique ID of the second button to watch. id the unique EventModel id of this MicroBitMultiButton instance.
multiButton(MICROBIT_ID_BUTTON_A, MICROBIT_ID_BUTTON_B, MICROBIT_ID_BUTTON_AB);
Represents a virtual button, capable of reacting to simultaneous presses of two other buttons. Constructor.
Create a representation of a virtual button, that generates events based upon the combination of two given buttons.
- Parameters:
-
button1 the unique ID of the first button to watch. button2 the unique ID of the second button to watch. id the unique EventModel id of this MicroBitMultiButton instance.
multiButton(MICROBIT_ID_BUTTON_A, MICROBIT_ID_BUTTON_B, MICROBIT_ID_BUTTON_AB);
Definition at line 51 of file MicroBitMultiButton.cpp.
Member Function Documentation
virtual void idleTick | ( | ) | [virtual, inherited] |
The idle thread will call this member function once the component has been added to the array of idle components using fiber_add_idle_component.
Reimplemented in MicroBitBLEManager, MicroBitEventService, MicroBitIOPinService, MicroBitAccelerometer, MicroBitCompass, and MicroBitThermometer.
Definition at line 133 of file MicroBitComponent.h.
int isPressed | ( | ) |
Tests if this MicroBitMultiButton instance is virtually pressed.
- Returns:
- 1 if both physical buttons are pressed simultaneously.
if(buttonAB.isPressed()) display.scroll("Pressed!");
Definition at line 295 of file MicroBitMultiButton.cpp.
void setEventConfiguration | ( | MicroBitButtonEventConfiguration | config ) |
Changes the event configuration of this button to the given MicroBitButtonEventConfiguration.
All subsequent events generated by this button will then be informed by this configuration.
- Parameters:
-
config The new configuration for this button. Legal values are MICROBIT_BUTTON_ALL_EVENTS or MICROBIT_BUTTON_SIMPLE_EVENTS.
// Configure a button to generate all possible events. buttonAB.setEventConfiguration(MICROBIT_BUTTON_ALL_EVENTS); // Configure a button to suppress MICROBIT_BUTTON_EVT_CLICK and MICROBIT_BUTTON_EVT_LONG_CLICK events. buttonAB.setEventConfiguration(MICROBIT_BUTTON_SIMPLE_EVENTS);
Definition at line 223 of file MicroBitMultiButton.cpp.
virtual void systemTick | ( | ) | [virtual, inherited] |
The system timer will call this member function once the component has been added to the array of system components using system_timer_add_component.
This callback will be in interrupt context.
Reimplemented in MicroBitSystemTimerCallback, MicroBitButton, and MicroBitDisplay.
Definition at line 125 of file MicroBitComponent.h.
Generated on Tue Jul 12 2022 15:22:57 by 1.7.2