Microbug / MicroBitDAL_SB2_TEST

Fork of MicroBitDALImageRewrite by Joe Finney

Committer:
finneyj
Date:
Sat May 16 22:28:56 2015 +0000
Revision:
5:8bf639bbedb5
Parent:
0:47d8ba08580f
Heap corruption bugfix... fixed:; ; - Heap corruption from BLE stack (hangover from BETA online build?); - BLEDevice can't be brought up in static context; - Calling scheduler callback when scheduler not initialised; - Rewrite of MicroBitImage linear bufs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
finneyj 0:47d8ba08580f 1 /**
finneyj 0:47d8ba08580f 2 * Class definition for MicroBit LED.
finneyj 0:47d8ba08580f 3 *
finneyj 0:47d8ba08580f 4 * n.b. This is disjoint from the Display class,
finneyj 0:47d8ba08580f 5 * and used only to represent the two stsus LEDs.
finneyj 0:47d8ba08580f 6 */
finneyj 0:47d8ba08580f 7
finneyj 0:47d8ba08580f 8 #ifndef MICROBIT_LED_H
finneyj 0:47d8ba08580f 9 #define MICROBIT_LED_H
finneyj 0:47d8ba08580f 10
finneyj 0:47d8ba08580f 11 #include "mbed.h"
finneyj 0:47d8ba08580f 12
finneyj 0:47d8ba08580f 13 class MicroBitLED
finneyj 0:47d8ba08580f 14 {
finneyj 0:47d8ba08580f 15 /**
finneyj 0:47d8ba08580f 16 * Unique, enumerated ID for this component.
finneyj 0:47d8ba08580f 17 * Used to track asynchronous events in the event bus.
finneyj 0:47d8ba08580f 18 */
finneyj 0:47d8ba08580f 19 int id;
finneyj 0:47d8ba08580f 20 DigitalOut pin;
finneyj 0:47d8ba08580f 21
finneyj 0:47d8ba08580f 22 public:
finneyj 0:47d8ba08580f 23 /**
finneyj 0:47d8ba08580f 24 * Constructor.
finneyj 0:47d8ba08580f 25 * Create an LED representation with the given ID.
finneyj 0:47d8ba08580f 26 * @param id the ID of the new LED object.
finneyj 0:47d8ba08580f 27 */
finneyj 0:47d8ba08580f 28 MicroBitLED(int id, PinName pin);
finneyj 0:47d8ba08580f 29
finneyj 0:47d8ba08580f 30 /**
finneyj 0:47d8ba08580f 31 * Sets this LED to the brightness specified.
finneyj 0:47d8ba08580f 32 * @param b The brightness to set the LED, in the range 0..255.
finneyj 0:47d8ba08580f 33 */
finneyj 0:47d8ba08580f 34 void setBrightness(int b);
finneyj 0:47d8ba08580f 35
finneyj 0:47d8ba08580f 36 /**
finneyj 0:47d8ba08580f 37 * Tests the brightness of this LED.
finneyj 0:47d8ba08580f 38 * @return the brightness of this LED, in the range 0..255.
finneyj 0:47d8ba08580f 39 */
finneyj 0:47d8ba08580f 40 int getBrightness();
finneyj 0:47d8ba08580f 41 };
finneyj 0:47d8ba08580f 42
finneyj 0:47d8ba08580f 43 #endif
finneyj 0:47d8ba08580f 44