Microbug / MicroBitDAL_SB2_TEST

Fork of MicroBitDALImageRewrite by Joe Finney

Committer:
finneyj
Date:
Thu Apr 16 13:50:24 2015 +0000
Revision:
1:3e0360107f98
Parent:
0:47d8ba08580f
Child:
2:6597fe50dc94
Updates to include:; ;   - Asynchronous Scrolltext();   - First iteration of MessageBus implementation;   - Hardware configuration for SquareBoard protoype

Who changed what in which revision?

UserRevisionLine numberNew contents of line
finneyj 0:47d8ba08580f 1 /**
finneyj 0:47d8ba08580f 2 * Class definition for a MicroBit device.
finneyj 0:47d8ba08580f 3 *
finneyj 0:47d8ba08580f 4 * Represents the device as a whole, and includes member variables to that reflect the components of the system.
finneyj 0:47d8ba08580f 5 */
finneyj 0:47d8ba08580f 6
finneyj 0:47d8ba08580f 7 #ifndef MICROBIT_H
finneyj 0:47d8ba08580f 8 #define MICROBIT_H
finneyj 0:47d8ba08580f 9
finneyj 0:47d8ba08580f 10 #include "mbed.h"
finneyj 1:3e0360107f98 11 #include "MicroBitMessageBus.h"
finneyj 0:47d8ba08580f 12 #include "MicroBitButton.h"
finneyj 0:47d8ba08580f 13 #include "MicroBitDisplay.h"
finneyj 0:47d8ba08580f 14 #include "MicroBitImage.h"
finneyj 0:47d8ba08580f 15 #include "MicroBitIO.h"
finneyj 0:47d8ba08580f 16 #include "MicroBitLED.h"
finneyj 0:47d8ba08580f 17
finneyj 0:47d8ba08580f 18 #define MICROBIT_IO_PINS 8 // TODO: Need to know how many. :-)
finneyj 0:47d8ba08580f 19
finneyj 0:47d8ba08580f 20 // Enumeration of core components.
finneyj 0:47d8ba08580f 21 #define MICROBIT_ID_LEFT_BUTTON 1
finneyj 0:47d8ba08580f 22 #define MICROBIT_ID_RIGHT_BUTTON 2
finneyj 0:47d8ba08580f 23 #define MICROBIT_ID_USER_LED 3
finneyj 0:47d8ba08580f 24 #define MICROBIT_ID_DISPLAY 5
finneyj 0:47d8ba08580f 25 #define MICROBIT_ID_IO_1 6
finneyj 0:47d8ba08580f 26 #define MICROBIT_ID_IO_2 7
finneyj 0:47d8ba08580f 27 #define MICROBIT_ID_IO_3 8
finneyj 0:47d8ba08580f 28 #define MICROBIT_ID_IO_4 9
finneyj 0:47d8ba08580f 29 #define MICROBIT_ID_IO_5 10
finneyj 0:47d8ba08580f 30 #define MICROBIT_ID_IO_6 11
finneyj 0:47d8ba08580f 31 #define MICROBIT_ID_IO_7 12
finneyj 0:47d8ba08580f 32 #define MICROBIT_ID_IO_8 13
finneyj 0:47d8ba08580f 33
finneyj 0:47d8ba08580f 34 // mBed pin assignments of core components.
finneyj 0:47d8ba08580f 35 #define MICROBIT_PIN_USER_LED P0_18
finneyj 0:47d8ba08580f 36
finneyj 0:47d8ba08580f 37
finneyj 0:47d8ba08580f 38 class MicroBit
finneyj 0:47d8ba08580f 39 {
finneyj 1:3e0360107f98 40 // Internal constructor. The ARM compiler doesn't seem to support constructor chaining...
finneyj 1:3e0360107f98 41 void init();
finneyj 0:47d8ba08580f 42
finneyj 0:47d8ba08580f 43 public:
finneyj 1:3e0360107f98 44 static MicroBitMessageBus MessageBus;
finneyj 0:47d8ba08580f 45 //
finneyj 0:47d8ba08580f 46 // Add member variables to represent each of the core components on the device.
finneyj 0:47d8ba08580f 47 //
finneyj 0:47d8ba08580f 48
finneyj 0:47d8ba08580f 49 MicroBitLED userLED;
finneyj 0:47d8ba08580f 50 MicroBitDisplay display;
finneyj 1:3e0360107f98 51 MicroBitButton leftButton;
finneyj 0:47d8ba08580f 52 /*
finneyj 0:47d8ba08580f 53 MicroBitButton rightButton;
finneyj 1:3e0360107f98 54
finneyj 0:47d8ba08580f 55 MicroBitIO pins[MICROBIT_IO_PINS];
finneyj 0:47d8ba08580f 56 */
finneyj 0:47d8ba08580f 57
finneyj 0:47d8ba08580f 58 /**
finneyj 0:47d8ba08580f 59 * Constructor.
finneyj 0:47d8ba08580f 60 * Create a representation of a MicroBit device.
finneyj 0:47d8ba08580f 61 * @param messageBus callback function to receive MicroBitMessageBus events.
finneyj 0:47d8ba08580f 62 */
finneyj 1:3e0360107f98 63 MicroBit();
finneyj 0:47d8ba08580f 64 };
finneyj 0:47d8ba08580f 65
finneyj 0:47d8ba08580f 66 #endif
finneyj 0:47d8ba08580f 67