Displays text on a WS2812 (NeoPixel) matrix display
Dependencies: mbed miniFont wsDrive
Displays text on an array of WS2812 LEDs (NeoPixels)
Text is 5 rows tall so any grid larger than that can be used. The font supports A-Z (capitals only, any lowercase input will be capitalised) numbers and some basic punctuation. Letters are 5 LEDs wide, some numbers and punctuation are smaller but generally you need 6 pixels wide per character you wish to fit. If displaying a string a 1 row space is left between characters, for other spacings either edit the code or print one letter at a time and adjust the offset for the next letter.
LEDs must be connected in horizontal rows, top row first. Rows can be either direction or alternating directions.
NOTE: The testing on this has been fairly minimal. It works with my one physical configuration, I think the logic for other configurations is correct but haven't tested it. If you find a problem please let me know.
Diff: miniFont/miniFont.h
- Revision:
- 2:0006602e8713
- Parent:
- 1:2014f027ed6f
--- a/miniFont/miniFont.h Thu Nov 06 17:32:12 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#ifndef __miniFont_h__ -#define __miniFont_h__ - -#include "mbed.h" - -class miniFont -{ -public: - - miniFont(); - uint8_t getPixWidth(char letter); - uint8_t getPixHeight(char letter); - bool getChar(char letter, const char **rowArray); - - bool isFixedWidth() {return fixedWidth;}; - void setFixedWidth(bool newValue) {fixedWidth = newValue;}; - - bool isRotated() {return rotate90;}; - void setRotated(bool newValue) {rotate90 = newValue;}; - -private: - - - uint8_t getMinPixWidth(char letter); - bool getRawChar(char letter, const char **rowArray); - bool getVerticalChar(char letter, const char **rowArray); - - static const uint8_t maxWidth = 5; - static const uint8_t maxHeight = 5; - - bool rotate90; - bool fixedWidth; - char letterBuffer[5]; - char rotateBuffer[5]; - - - static const char letters[26][5]; - - static const char numbers[10][5]; - - static const char dot[5]; - static const char space[5]; - static const char exclam[5]; - static const char quest[5]; - -}; - - -#endif