mbed.org local branch of microbit-dal. The real version lives in git at https://github.com/lancaster-university/microbit-dal

Dependencies:   BLE_API nRF51822 mbed-dev-bin

Dependents:   microbit Microbit IoTChallenge1 microbit ... more

Embed: (wiki syntax)

« Back to documentation index

MicroBitFont Class Reference

Class definition for a MicrobitFont This class represents a font that can be used by the display to render text. More...

#include <MicroBitFont.h>

Public Member Functions

 MicroBitFont (const unsigned char *font, int asciiEnd=MICROBIT_FONT_ASCII_END)
 Constructor.
 MicroBitFont ()
 Default Constructor.

Static Public Member Functions

static void setSystemFont (MicroBitFont font)
 Modifies the current system font to the given instance of MicroBitFont.
static MicroBitFont getSystemFont ()
 Retreives the font object used for rendering characters on the display.

Detailed Description

Class definition for a MicrobitFont This class represents a font that can be used by the display to render text.

A MicroBitFont is 5x5. Each Row is represented by a byte in the array.

Row Format: ================================================================ | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | ================================================================ | N/A | N/A | N/A | Col 1 | Col 2 | Col 3 | Col 4 | Col 5 | | 0x80 | 0x40 | 0x20 | 0x10 | 0x08 | 0x04 | 0x02 | 0x01 |

Example: { 0x08, 0x08, 0x08, 0x0, 0x08 }

The above will produce an exclaimation mark on the second column in form the left.

We could compress further, but the complexity of decode would likely outweigh the gains.

Definition at line 57 of file MicroBitFont.h.


Constructor & Destructor Documentation

MicroBitFont ( const unsigned char *  characters,
int  asciiEnd = MICROBIT_FONT_ASCII_END 
)

Constructor.

Sets the font represented by this font object.

Parameters:
fontA pointer to the beginning of the new font.
asciiEndthe char value at which this font finishes.

Definition at line 66 of file MicroBitFont.cpp.

MicroBitFont (  )

Default Constructor.

Configures the default font for the display to use.

Definition at line 77 of file MicroBitFont.cpp.


Member Function Documentation

MicroBitFont getSystemFont (  ) [static]

Retreives the font object used for rendering characters on the display.

Definition at line 96 of file MicroBitFont.cpp.

void setSystemFont ( MicroBitFont  font ) [static]

Modifies the current system font to the given instance of MicroBitFont.

Parameters:
fontthe new font that will be used to render characters on the display.

Definition at line 88 of file MicroBitFont.cpp.