microbit-dal/inc/MicroBitIO.h

52 lines
1.3 KiB
C
Raw Normal View History

#ifndef MICROBIT_IO_H
#define MICROBIT_IO_H
#include "mbed.h"
microbit: Added configurable concurrency modes for MicroBitMessageBus handlers. MessageBus handlers can now have one of four concurrency modes for the eventuality of an event being raised whilst a previous event is still being processed. An additional (optional) parameter is provided to the listen() functions to allow this to be selected on a per event handler basis. The permissable options are: MESSAGE_BUS_LISTENER_REENTRANT: The event handler is fired with the new event, regardless of whether or not a previous event is still be processed by that handler. MESSAGE_BUS_LISTENER_QUEUE_IF_BUSY: The new event is queued until such a time as the previous event has completed execution. The new event is then processed. This option does not preclude the processing of the new event by other event handlers. MESSAGE_BUS_LISTENER_DROP_IF_BUSY: The new event is dropped, and will never be processed the the event handler. This option does not preclude the processing of the new event by other event handlers. MESSAGE_BUS_LISTENER_NONBLOCKING: The event handler is self-declaring that it never blocks. This flag is used purely for optimisation, as it permits direct execution of the event hadnelr without inducing any overhead from the scheduler. In addition, the following minor revisions were made in this release: * Cleanup of the #include dependencies contained in the microbit-dal .h files * Bugfix to the scheduler block on event matching code. * Introduced a MICROBIT_ID_ALERT MessageBus channel, for general purpose eventing using nonces.
2015-09-11 15:39:38 +00:00
#include "MicroBitComponent.h"
#include "MicroBitPin.h"
/**
* Class definition for MicroBit IO.
*
* This is an object that contains the pins on the edge connector as properties.
*/
class MicroBitIO
{
public:
MicroBitPin P0;
MicroBitPin P1;
MicroBitPin P2;
MicroBitPin P3;
MicroBitPin P4;
MicroBitPin P5;
MicroBitPin P6;
MicroBitPin P7;
MicroBitPin P8;
MicroBitPin P9;
MicroBitPin P10;
MicroBitPin P11;
MicroBitPin P12;
MicroBitPin P13;
MicroBitPin P14;
MicroBitPin P15;
MicroBitPin P16;
MicroBitPin P19;
MicroBitPin P20;
/**
* Constructor.
* Create a representation of all given I/O pins on the edge connector
*/
microbit: Added configurable concurrency modes for MicroBitMessageBus handlers. MessageBus handlers can now have one of four concurrency modes for the eventuality of an event being raised whilst a previous event is still being processed. An additional (optional) parameter is provided to the listen() functions to allow this to be selected on a per event handler basis. The permissable options are: MESSAGE_BUS_LISTENER_REENTRANT: The event handler is fired with the new event, regardless of whether or not a previous event is still be processed by that handler. MESSAGE_BUS_LISTENER_QUEUE_IF_BUSY: The new event is queued until such a time as the previous event has completed execution. The new event is then processed. This option does not preclude the processing of the new event by other event handlers. MESSAGE_BUS_LISTENER_DROP_IF_BUSY: The new event is dropped, and will never be processed the the event handler. This option does not preclude the processing of the new event by other event handlers. MESSAGE_BUS_LISTENER_NONBLOCKING: The event handler is self-declaring that it never blocks. This flag is used purely for optimisation, as it permits direct execution of the event hadnelr without inducing any overhead from the scheduler. In addition, the following minor revisions were made in this release: * Cleanup of the #include dependencies contained in the microbit-dal .h files * Bugfix to the scheduler block on event matching code. * Introduced a MICROBIT_ID_ALERT MessageBus channel, for general purpose eventing using nonces.
2015-09-11 15:39:38 +00:00
MicroBitIO(int ID_P0, int ID_P1, int ID_P2,
int ID_P3, int ID_P4, int ID_P5,
int ID_P6, int ID_P7, int ID_P8,
int ID_P9, int ID_P10,int ID_P11,
int ID_P12,int ID_P13,int ID_P14,
int ID_P15,int ID_P16,int ID_P19,
int ID_P20);
};
#endif