The Bubbleworks / NanoBit

Dependents:   TheBubbleWorks_MicroBorg

Fork of NanoBit by Wayne Keenan

Embed: (wiki syntax)

« Back to documentation index

MicroBitDisplay Class Reference

MicroBitDisplay Class Reference

Class definition for a MicroBitDisplay. More...

#include <NanoBitDisplay.h>

Public Member Functions

 MicroBitDisplay (uint16_t id=MICROBIT_ID_DISPLAY, uint8_t x=MICROBIT_DISPLAY_WIDTH, uint8_t y=MICROBIT_DISPLAY_HEIGHT)
 Constructor.
virtual void systemTick ()
 Frame update method, invoked periodically to strobe the display.
void setBrightness (int b)
 Sets the display brightness to the specified level.
int getBrightness ()
 Fetches the current brightness of this display.
void enable ()
 Enables the display, should only be called if the display is disabled.
void disable ()
 Disables the display, should only be called if the display is enabled.
void clear ()
 Clears the current image on the display.

Detailed Description

Class definition for a MicroBitDisplay.

A MicroBitDisplay represents the LED matrix array on the MicroBit device.

Definition at line 51 of file NanoBitDisplay.h.


Constructor & Destructor Documentation

MicroBitDisplay ( uint16_t  id = MICROBIT_ID_DISPLAY,
uint8_t  x = MICROBIT_DISPLAY_WIDTH,
uint8_t  y = MICROBIT_DISPLAY_HEIGHT 
)

Constructor.

Create a representation of a display of a given size. The display is initially blank.

Parameters:
xthe width of the display in pixels.
ythe height of the display in pixels.

Example:

 MicroBitDisplay display(MICROBIT_ID_DISPLAY, 5, 5),

Definition at line 53 of file NanoBitDisplay.cpp.


Member Function Documentation

void clear (  )

Clears the current image on the display.

Simplifies the process, you can also use uBit.display.image.clear

Example:

 uBit.display.clear(); //clears the display

Definition at line 176 of file NanoBitDisplay.cpp.

void disable (  )

Disables the display, should only be called if the display is enabled.

Display must be disabled to avoid MUXing of edge connector pins.

Example:

 uBit.display.disable(); //disables the display

Definition at line 163 of file NanoBitDisplay.cpp.

void enable (  )

Enables the display, should only be called if the display is disabled.

Example:

 uBit.display.enable(); //reenables the display mechanics

Definition at line 149 of file NanoBitDisplay.cpp.

int getBrightness (  )

Fetches the current brightness of this display.

Returns:
the brightness of this display, in the range 0..255.

Example:

 uBit.display.getBrightness(); //the current brightness
void setBrightness ( int  b )

Sets the display brightness to the specified level.

Parameters:
bThe brightness to set the brightness to, in the range 0..255.

Example:

 uBit.display.setBrightness(255); //max brightness

Definition at line 191 of file NanoBitDisplay.cpp.

void systemTick (  ) [virtual]

Frame update method, invoked periodically to strobe the display.

Internal frame update method, used to strobe the display.

TODO: Write a more efficient, complementary variation of this method for the case where MICROBIT_DISPLAY_ROW_COUNT > MICROBIT_DISPLAY_COLUMN_COUNT.

Definition at line 78 of file NanoBitDisplay.cpp.