-
-
Notifications
You must be signed in to change notification settings - Fork 22
Reference
The main DMD class contains a graphic interface functions, inherited from Adafruit GFX library. It accompanied with DMD_Font class. These classes haven't be used by user directly.
User interfaces to led panels hardware are grouped on the second level (the bluish headers). In some cases of specific RGB panels user would need to use a specialized RGB drivers like DMD_RGB_FM6363
(violet headers).
- Monochrome panels - you have to use
DMD_MonoChrome_SPI
orDMD_Monochrome_Parallel
class, depending of the connection mode. - RGB panels with BINARY or DIRECT mux - needs the
DMD_RGB
type. - RGB panels with SHIFT_REGISTER mux - use the
DMD_RGB_SHIFTREG_ABC
class. - Panels with FM6126 drivers - use
DMD_RGB_FM6126
type. - Panels with FM6353/6363 drivers - use
DMD_RGB_FM6353
orDMD_RGB_FM6363
respectively.
-
void init( uint16_t scan_interval = 1000 )
Monochrome modes
Parameters:uint16_t
Returns:
Init DMD instance. Param set the length of single scan in microseconds. Minimumscan_interval
is 100us, default = 1000. Note that since the monochrome scan loop contains a four scans, the resulting frame rate willFPS = 1.000.000us / (4 * scan_interval)
-
void clearScreen( byte bNormal )
Parameters:byte
Returns:
Switch all pixels off. Parameter controls whether it use normal (true) or inverted mode panel filling. In DMD_RGB class the parameter ignored and 0x00 value always used. -
void fillScreen( uint16_t color )
Parameters:uint16_t
Returns:
Fill screen with selected color. For monochrome mode only two values allowed - 1 or 0. -
void inverseAll( uint8_t flag )
Monochrome modes
Parameters:uint8_t
Returns:
Set inverse flag - to invert the behavior the pixels on display. Use it for P10 Monochrome matrix inverted by design. Default value is false. -
void setBrightness( uint8_t level )
Parameters:uint8_t
Returns:
Set panel brightness level in 0-255 range. -
void setConnectScheme( uint8_t sch )
Parameters:uint8_t
Returns:
Set connection scheme for chaining a multiple panels. The value can be one of follows:CONNECT_NORMAL
,CONNECT_ROTATE
,CONNECT_ZIGZAG
. See details in Connection wiki -
void setRotation( uint8_t x )
Parameters:uint8_t
Returns:
Rotate the picture in screen. Rotation flag can be any of follows: 0 - 0 degrees(no rotation), 1 - 90 deg, 2- 180, 3 -270. -
void swapBuffers( boolean copy )
Dual buffering mode
Parameters:boolean
Returns:
In dual buffering mode send the internal buffer to output and make the previous output buffer available for drawing. The bool flag determines whether the new draw buffer will be initialized with the contents of the old one.
-
int drawChar( const int bX, const int bY, const unsigned char letter, uint16_t color, byte orientation = 0 )
int drawChar( const int bX, const int bY, const unsigned char letter, uint16_t color, int16_t miny, int16_t maxy, byte orientation = 0 )
Draw a single char with font, selected byselectFont()
using custom background color.
Parameters:- bX, bY - start coordinates (top left point)
- letter - char code
- color - color - 16-bit color to draw
- mixy, maxy - most upper and lower text point relative to bY (optional)
- orientation - horizontal (0) or vertical (1)
Returns: X-position change (in pixels) as a result of printing a symbol.
-
void drawMarquee( const char* bChars, int length, int left, int top, byte orientation = 0 )
void drawMarqueeX( const char* bChars, int left, int top, byte orientation = 0 )
Draw a string and prepare it to scroll. Should be called beforestepMarquee()
.drawMarqueeX()
variant expects a null-terminated string and don't need a length.
Parameters:- bChars - string data
- length - string length
- left, top - start coordinates
- orientation - horizontal (0) or vertical (1)
Only one marquee can be used at the time.
To set color of the text and background usesetMarqueeColor(text_color, bg_color)
method. -
void drawString( int bX, int bY, const char* bChars, int length, T color, int16_t miny, int16_t maxy, byte orientation = 0 )
void drawString( int bX, int bY, const char* bChars, int length, T color, byte orientation = 0 )
void drawStringX( int bX, int bY, const char* bChars, T color, byte orientation = 0 )
Draw a text string with font, selected byselectFont()
using custom background color. drawStringX() variant expects a null-terminated string and don't need a length, other two prints only first chars of long text.
Parameters:- bX, bY - start coordinates (top left point)
- bChars - string data
- length - string length
- color - color to draw text with, 16-bit single value or DMD_Colorlist for multicolor text
- mixy, maxy - most upper and lower text point relative to bY - defines the area will covered by background color
- orientation - horizontal (0) or vertical (1)
-
uint8_t stepMarquee( int amountX, int amountY, byte orientation = 0 )
Scroll the marquee by amountX and amountY pixels. The marquee should be prepared bydrawMarquee()
.
Returns:- MARQUEE_OUT_OF_SCREEN - text left the screen
- MARQUEE_JUSTIFY_ON_LEFT - leftmost pixel of the text is on screen position 0
- MARQUEE_JUSTIFY_ON_RIGHT - rightmost pixel of the text is on the right end of screen
- or returns 0 in any other case
-
void selectFont( DMD_Font* font )
Parameters:DMD_Font*
Returns:
Select a font for drawing chars, strings and marquee text. -
int charWidth( const unsigned char letter, byte orientation = 0 )
Parameters:const unsigned char
Returns: charwidth in pixels
Returns the width of a single character using defined text font. -
uint16_t stringWidth( const char* bChars, uint16_t length = 0, byte orientation = 0 )
uint16_t stringWidthV( const char* bChars, uint16_t length = 0 )
Returns: text width in pixels.
Return string width in pixels using defined text font. The versionstringWidthV()
is for vertical scrolling. -
void stringBounds( const char* bChars, uint16_t length, int16_t* w, int16_t* min_y, int16_t* max_y, byte orientation = 0 )
Calculate string bounds in pixels using selected font and put it to parameters w, min_y, max_y.
Parameters:- bChars - string data
- length - string length
- w, min_y, max_y - width and upmost and lowest text points relative to upper left corner of the text.
- orientation - horizontal (0) or vertical (1)
-
void disableFastTextShift( bool shift )
Parameters:boolean
Returns:
Default method to scrolling the marquee is shifting of entire screen.
Set this flag (true) to avoid this if you need to display more than one string at time. -
void drawFilledBox( int x1, int y1, int x2, int y2, uint16_t color )
Overloaded function to fill the box(rectangle) with selected color. See the Adafruit GFX for detail.
-
void init( uint16_t scan_interval = 200 )
RGB mode
Parameters:uint16_t
Returns:
Init DMD_RGB instance. Unlike the base class, in the DMD_RGB class the meaning of theinit()
parameter has changed - now it is a frames per seconds in Hz. The value is internally limited by length of panel update cycle. -
uint16_t Color333( uint8_t r, uint8_t g, uint8_t b )
uint16_t Color444( uint8_t r, uint8_t g, uint8_t b )
uint16_t Color888( uint8_t r, uint8_t g, uint8_t b )
Parameters:uint18_t, uint18_t, uint8_t
- red, green and blue color values
Returns: 16 bits Color565 value
Color conversion from Color333, Color444 and Color888 to Color565 value. -
void drawFastVLine( int16_t x, int16_t y, int16_t h, uint16_t color )
void drawFastHLine( int16_t x, int16_t y, int16_t w, uint16_t color )
Overloaded functions to draw the line. See the Adafruit GFX for detail. -
void setTextColor( uint16_t col, uint16_t bg )
Parameters:uint16_t, uint16_t
- 16 bits Color565 value
Returns:
Set text foreground and background colors. -
void setMarqueeColor( uint16_t text_color, uint16_t bg_color )
Parameters:uint16_t, uint16_t
- 16 bits Color565 value
Returns:
Set marquee foreground and background colors. -
void setMarqueeColor( DMD_Colorlist* colors )
Parameters:DMD_Colorlist*
- 16 bits Color565 values list
Returns:
Set marquee foreground and background colors, multicolor version. Parameter is a pointer to list of colors, 1st is for background, and next colors loops over text chars. -
void setColorOrder( DMD_Color_order color_order )
Parameters:DMD_Color_order
Returns:
Change of order of input RGB signals. The available options are:RGB (default), RBG, BRG, BGR, GRB, GBR
To create correct DMD_RGB class instance, you have to choose a proper template parameters - the matrix type and color mode. There are a lot of types of HUB75 panels exists with different sizes, multiplexing and pixel mappings. All these are configured by "matrix pattern" - a strings of digits, represents a key characteristics of given panel.
There are two types of matrix patterns - standard and extended. The standard pattern can be used to setup of any supported panel and has a structure as follows:
Extended patterns used only for i.e. "Quarter_scan_panels' - indoor panels which has scan factor a quarter of height.
The library does provide to users a rich set of predefined matrix patterns. Below is a list of patterns for a most common RGB panels:
- RGB32x16plainS8 - 32x16 1/8 scan
- RGB40x20plainS10 - 40x20 1/10 scan
- RGB32x32plainS16 - 32x32 1/16 scan
- RGB64x32plainS16 - 64x32 1/16 scan
- RGB80x40plainS20 - 80x40 1/20 scan
- RGB64x64plainS32 - 64x64 1/32 scan
- RGB128x64plainS32 - 128x64 1/32 scan
Full list of implemented patterns see in DMD_Panel_Templates.h
file. If you haven't found a suitable pattern for your matrix, please feel free to open an issue using template.
As for the color mode, I recommend choosing COLOR_4BITS_Packed
mode if you using a STM32F1 based board, and COLOR_4BITS
for STM32F4 and RP 2040 boards.