Attempting to publish a tree

Dependencies:   BLE_API mbed-dev-bin nRF51822

Fork of microbit-dal by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

MicroBitMultiButton Class Reference

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.
virtual int isIdleCallbackNeeded ()
 When added to the idleThreadComponents array, this function will be called to determine if and when data is ready.

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:
button1the unique ID of the first button to watch.
button2the unique ID of the second button to watch.
idthe 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:
button1the unique ID of the first button to watch.
button2the unique ID of the second button to watch.
idthe 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.

Updates are determined by the isIdleCallbackNeeded() member function.

Reimplemented in MicroBitBLEManager, MicroBitEventService, MicroBitIOPinService, MicroBitAccelerometer, MicroBitCompass, and MicroBitThermometer.

Definition at line 127 of file MicroBitComponent.h.

virtual int isIdleCallbackNeeded (  ) [virtual, inherited]

When added to the idleThreadComponents array, this function will be called to determine if and when data is ready.

Note:
override this if you want to request to be scheduled as soon as possible.

Reimplemented in MicroBitAccelerometer, MicroBitCompass, and MicroBitThermometer.

Definition at line 138 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 configuraiton.

Parameters:
configThe 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 118 of file MicroBitComponent.h.