Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MicroBitDALImageRewrite by
inc/MicroBitButton.h
- Committer:
- finneyj
- Date:
- 2015-04-12
- Revision:
- 0:47d8ba08580f
- Child:
- 1:3e0360107f98
File content as of revision 0:47d8ba08580f:
/**
* Class definition for MicroBit Button.
*
* Represents a single button on the device.
*/
#ifndef MICROBIT_BUTTON_H
#define MICROBIT_BUTTON_H
class MicroBitButton
{
/**
* Unique, enumerated ID for this component.
* Used to track asynchronous events in the event bus.
*/
int id;
int state;
public:
/**
* Constructor.
* Create a pin representation with the given ID.
* @param id the ID of the new LED object.
*/
MicroBitButton(int id, PinName pin);
/**
* Tests if this Button is currently pressed.
* @return 1 if this button is pressed, 0 otherwise.
*/
int isPressed();
/**
* Enables asynchronous callback events from this button.
* When enabled, all state change updates will be propogated
* along the MicroBitMessageBus using the device's ID.
*/
void enableCallback();
/**
* Disables asynchronous callback events from this button.
* When disabled no state change updates will be propogated
* along the MicroBitMessageBus from this button.
*/
void disableCallback();
};
#endif
