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

Embed: (wiki syntax)

« Back to documentation index

MicroBitEvent Class Reference

MicroBitEvent Class Reference

Class definition for a MicroBitEvent. More...

#include <MicroBitEvent.h>

Public Member Functions

 MicroBitEvent (uint16_t source, uint16_t value, MicroBitEventLaunchMode mode=MICROBIT_EVENT_DEFAULT_LAUNCH_MODE)
 Constructor.
 MicroBitEvent ()
 Default constructor - initialises all values, and sets timestamp to the current time.
void fire ()
 Fires this MicroBitEvent onto the Default EventModel, or a custom one!

Detailed Description

Class definition for a MicroBitEvent.

It represents a common event that is generated by the various components on the micro:bit.

Definition at line 49 of file MicroBitEvent.h.


Constructor & Destructor Documentation

MicroBitEvent ( uint16_t  source,
uint16_t  value,
MicroBitEventLaunchMode  mode = MICROBIT_EVENT_DEFAULT_LAUNCH_MODE 
)

Constructor.

Parameters:
srcThe id of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.
valueA component specific code indicating the cause of the event.
modeOptional definition of how the event should be processed after construction (if at all): CREATE_ONLY: MicroBitEvent is initialised, and no further processing takes place. CREATE_AND_FIRE: MicroBitEvent is initialised, and its event handlers are immediately fired (not suitable for use in interrupts!).
 // Create and launch an event using the default configuration
 MicrobitEvent evt(id,MICROBIT_BUTTON_EVT_CLICK);

 // Create an event only, do not fire onto an EventModel.
 MicrobitEvent evt(id,MICROBIT_BUTTON_EVT_CLICK,CREATE_AND_FIRE);

Definition at line 57 of file MicroBitEvent.cpp.

Default constructor - initialises all values, and sets timestamp to the current time.

Definition at line 70 of file MicroBitEvent.cpp.


Member Function Documentation

void fire (  )

Fires this MicroBitEvent onto the Default EventModel, or a custom one!

Definition at line 80 of file MicroBitEvent.cpp.