Skip to content
Jannick Fahlbusch ฏ๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎ edited this page Feb 3, 2018 · 6 revisions

void Init(cLEDMatrixBase *Matrix, uint16_t Width, uint16_t Height, int16_t OriginX = 0, int16_t OriginY = 0);

This function should also be called as part of your setup routine and must be called at least once for each instance of cLEDText.
'Matrix' parameter should be a pointer to your cLEDMatrix instance.
'Width' and 'Height' are the dimensions of the area in which the text will be displayed.
'OriginX' and 'OriginY' are the matrix coordinates of the bottom left corner of the area.
NOTE: The dimensions and origin provided here are independent of the LED Matrix size, they can be smaller to restrict text to a portion of the display or larger to allow control over where the text stops when using Delay control codes.

void SetFont(const uint8_t *FontData);

This function should be called as part of your setup routine and must be called at least once for each instance of cLEDText, but may be called at any time to change the font. I have provided several font header files in this GitHub. See the Font Header page for more information on the format.

#include <FontMatrise.h>
ScrollingMsg.SetFont(MatriseFontData);

void SetText(unsigned char *Txt, uint16_t TxtSize);

This function is called to set the unsigned 8 bit array that contains the text and control codes. The 'TxtSize' parameter is needed as zero values can occur in the array when using control codes. NOTE: If your text array is statically initialised, use the 'const' keyword in its delcaration as the compiler will place this in the ROM area rather then RAM.

const unsigned char TxtDemo[] = { "THIS IS A MESSAGE" };
ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);

int UpdateText();

This function is called repeatedly to render the text data into the LED matrix. Each call advances the frame by 1 pixel in the chosen scroll direction. If the frame has been rendered the return code will be '0'. If the end of the Text Array has been reached it will return '-1', at this point you will then need to do another 'SetText' call to reset the text array followed by a call to 'UpdateText' to render the frame.
If EFFECT_CUSTOM_RC has been used in the text array it will override the '0' return code with its defined return code when it reaches the displayable area.

if (ScrollingMsg.UpdateText() == -1)
{
ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
ScrollingMsg.UpdateText();
}

uint8_t FontWidth();

Returns the current font width as a uint8_t.

uint8_t FontHeight();

Returns the current font height as a uint8_t.

void SetBackgroundMode(uint16_t Options, uint8_t Dimming = 0x00);

This function allows you to set the background mode and optionally if the mode is BACKGND_DIMMING, the dimming percentage (BACKGND_ERASE, BACKGND_LEAVE, BACKGND_DIMMING).

void SetScrollDirection(uint16_t Options);

This allows you to set the scrolling direction (SCROLL_LEFT, SCROLL_RIGHT, SCROLL_UP, SCROLL_DOWN).

void SetTextDirection(uint16_t Options);

This allows you to set the character direction (CHAR_UP, CHAR_DOWN, CHAR_LEFT, CHAR_RIGHT).

void SetTextColrOptions(uint16_t Options, uint8_t ColA1 = 0xff, uint8_t ColA2 = 0xff, uint8_t ColA3 = 0xff, uint8_t ColB1 = 0xff, uint8_t ColB2 = 0xff, uint8_t ColB3 = 0xff);

This allows you to set the text mode and colour. You can use a combination of the defines for flexible colour control (COLR_RGB, COLR_HSV, COLR_GRAD_CV, COLR_GRAD_AV, COLR_GRAD_CH, COLR_GRAD_AH). If you are just setting a single colour mode, you only need to provide the first three uint8_t's. There are two other colour modes (COLR_EMPTY & COLR_DIMMING). The EMPTY one will leave any '1' bits in the font data untouched allowing the background to show through and the DIMMING one will dim those '1' bits to ColA1 percent and as such is the only uint8_t that needs to be supplied when specifying the DIMMING option.

void SetFrameRate(uint8_t Rate);

This changes the X/Y update rate of the message e.g. a Rate of 2 will only update X/Y every other call to UpdateText().

void SetOptionsChangeMode(uint16_t Options);

By default the LEDText routine will scroll text off the display area before implementing any change in scroll direction or the end of the message. If this function is called with the INSTANT_OPTIONS_MODE define this behaviour is changed and the delay is removed. Example 4 demonstrates this usage. Calling this function with a '0' will reset to default behaviour.