Git Product home page Git Product logo

dmd_stm32's Introduction

DMD_STM32a - LED Matrix library with Unicode fonts support

GitHub last commit (branch) GitHub commits since tagged version (branch) GitHub

Last version is v1.1.2 - Introduced multicolor for fixed and scrolling text

See video and dmd_multicolor example for details.

Attention! Recent versions are incompatibe with code prior v1.0.0 The main difference from 0.x.x versions is a new panel template format. You can see a brief explanation in the Wiki/About matrix patterns and in the comments of the DMD_Panel_Templates.h file.
Last version with old panel templates v0.9.5

About the library

The library initially started out as STM32 port of Freetronics DMD library (https://github.com/freetronics/DMD). Now it has grown into a separate project with support for different types of monochrome, two-color and RGB panels.

One of the important features of the library is support of Adafruit GFX format fonts: https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts. Using Adafruit fontconvert utility allows users to convert and display on DMD matrix Truetype fonts, including Unicode fonts with national characters of almost any language. The library includes Cyrillic and Turkish fonts. For using of national fonts, see the examples dmd_rg.ino and dmd_rgb_turk.ino (Turkish)

This code branch is further development of DMD_STM32 library. The code was totally rewritten, the library received a modular structure with a DMD_STM32a base class and several child classes for various matrices and connection types.

LED panels supported

Description Interface Pixels Scan Code module
Monochrome P10 panels HUB12 32x16 1/4 DMD_Monochrome_SPI.h
DMD_Parallel.h
Indoor RGB HUB75 32x16 1/8 DMD_RGB.h
32x32 1/16
64x32 1/16
64x64 1/32
80x40 1/20
128x64 1/32
Outdoor RGB HUB75 32x16 1/2 1/4 1/8 DMD_RGB.h
Two-color indoor HUB08 64x32 1/16 DMD_RGB.h
(work as RGB)
RGB with FM6126a driver HUB75 64x32 1/16 DMD_RGB_6126a.h
RGB with FM6353/6363 S-PWM drivers HUB75 128x64 1/32 DMD_RGB_6353.h
64x32 1/16

Read more about supported panels in the Wiki/Supported panels. The set of supported matrices is constantly updated.

Adding a new panels to the library

If your panel is not supported by the library yet, please feel free to open an issue using template

Other features

  • The graphics subsystem is inherited from Adafruit GFX library https://github.com/adafruit/Adafruit-GFX-Library
  • Dual memory buffering for reducing scanning artefacts and making some visual effects (see Wiki/Examples).
  • Two color modes for RGB: highcolor RGB444 and low memory consuming RGB111 mode for LED signs, information boards etc.
  • Multicolor strings for fixed text and scrolling (since v1.1.2)
  • Chaining up to 100 panels for Monochrome (46 tested) or 16 for RGB 64x32. The number of matrices is limited by the size of the controller memory.
  • For monochrome display - a new "Parallel" connection scheme, in which each horizontal row of panels is connected to a separate R_DATA pin

Compatible boards

  • STM32F1 - STM32F103C8 (bluepill) and STM32F103C6 boards tested
  • STM32F4 - STM32F401CC and STM32F411CE boards
  • Raspberry Pi Pico and other RP2040-based boards

Installation

There are two ways to install the library:

  • Download ZIP-archive directly from Releases section, open your Arduino IDE, click on Sketch > Include Library > Add . ZIP Library. Choose the zip file you just downloaded.
  • Using Library Manager (since Arduino IDE 1.6.2): navigate to Sketch > Include Library > Manage Libraries inside your Arduino IDE and search for the library, then click Install.

Pre-installation requirements

Arduino support packages for STM32 and Raspberry Pi Pico

Connection

For detailed info about matrix connection see Wiki:

Consult the examples for recommended pin combinations.

Documentation

Example videos

Adapters

Sometimes wiring can be tricky so here I will put links to useful PCB-boards for use with this code (are not affiliated with the DMD_STM32)

Most important versions

(22 Dec 2023 - v1.1.2) - Introduced multicolor for fixed and scrolling text

(30 Nov 2023 - v1.1.0) - Add support of panels with FM6353/6363 S-PWM drivers

(25 Mar 2023 - v1.0.4) - Add support of panels with FM6126a chip

(12 Feb 2023 - v1.0.0) - New panel template model with multiparameter specialization

(16 Sep 2022 - v0.9.0) - Add support of RP2040-based boards and using the DMA in the RGB modes for STM32F4 boards

(10 Jul 2022 - v0.8.0) - Add support of STM32F4 blackpills - STM32F401CC & STM32F411CE (Custom STM32 repo required! see below)

(19 Feb 2022 - v0.7.0) - Add support of "Outdoor" RGB panels with 1/2 1/4 1/8 scans

For full version history see CHANGES.txt

Acknowledgements

  • Evgeny Fokin for testing and provided matrices.
  • Eduard Yansapov - for testing.
  • @bilalibrir - for help with the code for Outdoor RGB matrix

Credits to open source community

Notice

This software is experimental and a work in progress. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.

dmd_stm32's People

Contributors

board707 avatar doomhammer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dmd_stm32's Issues

Low color//brightness problems

Hello !

Thanks you for this great library.

I have a problem with a P8 Outdoor display, everything seems to works fine, but, I can't have low colors for each pixels on the display.

It's like, when I'm making a RGB color of (15,15,15), the display is black instead of displaying the leds with low brightness. I can have low brightness on the panel by lowering the global brightness of the display, but I want to have low brightness for each pixel individually.

Maybe it's because of the color storage of 4 bits per channels ? So I if want to have high contrast it's not possible ?

Is there any workaround ?

Thanks you !

Why Arial_Black_16_ISO_8859_1 won't work?

//////CODE///////
#include <DMD_STM32.h>
//#include "st_fonts/SystemFont5x7.h"
#include "st_fonts/Arial_Black_16_ISO_8859_1.h"
#include "gfx_fonts/GlametrixLight12pt7b.h"
#include "gfx_fonts/GlametrixBold12pt7b.h"

// We'll use SPI 2
SPIClass dmd_spi(1);

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1

// ----- Select pins for P10 matrix connection ------------
// pins A, B, SCLK may be any digital I/O, pin nOE should be PWM pin as PB1,PA8

// SPI specific pins as CLK and R_DATA has predefined values:
// for SPI(1) CLK = PA5 R_DATA = PA7
// for SPI(2) CLK = PB13 R_DATA = PB15
// --------------------------------------------------------

#define DMD_PIN_A PB11
#define DMD_PIN_B PB12
#define DMD_PIN_nOE PB1
#define DMD_PIN_SCLK PB10

DMD dmd(DMD_PIN_A, DMD_PIN_B, DMD_PIN_nOE, DMD_PIN_SCLK, DISPLAYS_ACROSS, DISPLAYS_DOWN, dmd_spi );

// --- Define fonts ----
// DMD.h old style font
DMD_Standard_Font UkrRusArial_F(Arial_Black_16_ISO_8859_1);

// GFX font with sepatate parts for Latin and Cyrillic chars
//DMD_GFX_Font GlametrixL((uint8_t*)&GlametrixLight12pt7b,(uint8_t*)&GlametrixLight12pt8b_rus,0x80,13);
DMD_GFX_Font GlametrixBold((uint8_t*)&GlametrixBold12pt7b,(uint8_t*)&GlametrixBold12pt8b_rus, 0x80, 13);

/-------------------------------------------------------------------------------------
setup
Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------
/
void setup(void)
{

dmd.init();
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
// set matrix brightness (0-255)
dmd.setBrightness(80);
}

/--------------------------------------------------------------------------------------
loop
Arduino architecture main loop
--------------------------------------------------------------------------------------
/
void loop(void)
{

dmd.selectFont(&UkrRusArial_F);

const char MSG = "Fran""\xe7""ais, ""\xd6""sterreich, Magyarorsz""\xe1""g";
dmd.drawMarquee(MSG,strlen(MSG),(32
DISPLAYS_ACROSS)-1,0);
long start=millis();
long timer=start;
while(1){
if ((timer+30) < millis()) {
dmd.stepMarquee(-1,0);
timer=millis();
}
}
}

When I upload code to stm32 nothing is shown. Why?
P.S. I tried to make my own font but the same thing happens.
Thanks in advance.

Add a new panel (P10out-264T-2310-3A-20000)

Panel description

Dimensions (in pixels) : 32x16

Scan factor: 1/2

Chips on rear side: without marking (erased)

Model: P10-2S-3535-16x32-V2.3

Panel photos

IMG_4921_FRONT
IMG_4918_REAR

Sample videos

Pattern: 2,32,16,4,1

IMG_4923-pattern-test_tvai.mp4

Specifications

  • Library version: 1.01
  • Platform: STM32
  • MCU board: blackpil STM32F103C8T6
  • Connections: used pins
    DMD_PIN_A PB6
    DMD_PIN_B PB5
    DMD_PIN_nOE PB0
    DMD_PIN_SCLK PB7
    uint8_t custom_rgbpins[] = { PA6, PA0,PA1,PA2,PA3,PA4,PA5 }; // CLK, R0, G0, B0, R1, G1, B1

can't daisy chain more than 4 modules

hello guys i tried to design a soccer score board with this library where im trying to design in a size of 6ftx3ft with 36 P10 modules driven by stm32f103c8

include <angka_3.h>
#include "fonts/SystemFont5x7.h"
#include "fonts/Arial_Black_16_ISO_8859_1.h"
#include "fonts/UkrRusArial14.h";
#include "gfx_fonts/GlametrixLight12pt7b.h"
#include "gfx_fonts/GlametrixBold9pt7b.h"

DMD_Standard_Font UkrRusArial_F(angka_3);

// We'll use SPI 2
SPIClass dmd_spi(2);

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 4
#define DISPLAYS_DOWN 3

// ----- Select pins for P10 matrix connection ------------
// pins A, B, SCLK may be any digital I/O, pin nOE should be PWM pin as PB1,PA8

// SPI specific pins as CLK and R_DATA has predefined values:
// for SPI(1) CLK = PA5 R_DATA = PA7
// for SPI(2) CLK = PB13 R_DATA = PB15
// --------------------------------------------------------

#define DMD_PIN_A PB6
#define DMD_PIN_B PB7
#define DMD_PIN_nOE PB1
#define DMD_PIN_SCLK PA8

void setup()
{
Serial.begin(9600);
Serial.setTimeout(5);
// initialize Timer3
Timer3.setMode(TIMER_CH1, TIMER_OUTPUTCOMPARE);
Timer3.setPeriod(3000); // in microseconds
Timer3.setCompare(TIMER_CH1, 1); // overflow might be small
Timer3.attachInterrupt(TIMER_CH1, ScanDMD);

//clear/init the DMD pixels held in RAM
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
dmd.setBrightness(6000);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
digitalWrite(13,LOW);
digitalWrite(13,HIGH);
}

void loop()
{
if(boot_screen_flag==1)
{
dmd.selectFont(&UkrRusArial_F);
dmd.drawString( 2,3, " POST RUN ENABLED ", 20, GRAPHICS_NORMAL );
delay(1000);
dmd.drawString( 2,17, " IDC CHECK OK", 20, GRAPHICS_NORMAL );
delay(1000);
dmd.drawString( 2,29, " NETWORK ADAPTER OK", 20, GRAPHICS_NORMAL );
delay(1000);
dmd.drawString( 2,39, " BUS SPEED TEST OK", 20, GRAPHICS_NORMAL );
}
}

the problem im facing is when i try to run more than 4 modules chained in series display starts to flicker, Is that because of timer or am i lagging some where but the library says it can run up-to 16 displays without any performance lagging but less than 4 modules it works like a charm.

Support for BGR Led Panels

It seems I have a bunch of panels that have R and B channels swapped. Is there a convenient way to use such panels with this library?

Circles/ellipses support

Library does support drawing rectangles: void drawFilledBox(int x1, int y1, int x2, int y2, uint16_t color);, but doesn't support drawing circles yet. So I came up with this solution:

typedef struct vec2 { int16_t x, y; } vec2;
typedef uint16_t Rgb565; 

...

static void put_circle(vec2 center, int16_t r, Rgb565 color) {
    for (vec2 pos = { center.x - r, center.y - r }; pos.y < center.y + r; pos.y ++)
    for (pos.x = center.x - r; pos.x < center.x + r; pos.x ++)
        (void)((distance(pos, center) < r) && (*get_screen(pos) = color));
}

Assuming blue background, put_circle((vec2){5, 5}, 5, 0xf81f); produces this:

circle

It would be nice to have such function in a library as a method like drawFilledBox()

complete display screen flickering while scrolling single line

hello,
first of all thank you so much for writing such library for stm32.
I am having issue with the code which is written to display steady message at 2nd row and scrolling message at 1st row
at the same time.
i tried this in two ways:
1 ) call draw string to display the string and then call the marquee. it shifts all the display including static message.
`dmd.drawString(0,(DISPLAYS_DOWN - 2)* 16,"SCROLLING",10,GRAPHICS_NORMAL,0); // at 2nd row
dmd.drawMarquee("SCROLLING",10,(32DISPLAYS_ACROSS)-1,DISPLAYS_DOWN - 1) 16); // at 1st row

long prev_step =millis();
boolean ret=false;
while(!ret){
if ((millis() - prev_step) > 50 ) {
ret=dmd.stepMarquee(-1,0);
prev_step=millis();
}
}`

2 ) call the marquee and then draw string to display the string . it shows static message on 2nd row while scrolling message at 1st row but the screen is flickering. i know the reason it is flickering due to marquee is shifting whole screen and i am forcing to display the static message. but i dont know how to solve. please help me.
` dmd.drawMarquee("SCROLLING",10,(32DISPLAYS_ACROSS)-1,DISPLAYS_DOWN - 1) 16); //at 1st row

long prev_step =millis();
boolean ret=false;
while(!ret){
if ((millis() - prev_step) > 50 ) {
ret=dmd.stepMarquee(-1,0);
dmd.drawString(0,(DISPLAYS_DOWN - 2)* 16,"SCROLLING",10,GRAPHICS_NORMAL,0); //at 2nd row
prev_step=millis();
}
}`

video showing two rows but p10 display connected across for testing purpose only.
first row message ABC
second row message "1" static and other scrolling "SCROLLING"
VID-20201124-WA0006 (1)

PI PICO P6_32x32 1/8 scan module

IMG-2091
IMG-2092
IMG-2093

/*--------------------------------------------------------------------------------------
Demo for RGB panels

DMD_STM32a example code for STM32F103xxx board
------------------------------------------------------------------------------------- */
#include "DMD_RGB.h"
// Fonts includes
#include "st_fonts/SystemFont5x7.h"
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Woverflow"
//Number of panels in x and y axis
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
char a[10];
char b[10];
// Enable of output buffering
// if true, changes only outputs to matrix after
// swapBuffers(true) command
// If dual buffer not enabled, all output draw at matrix directly
// and swapBuffers(true) cimmand do nothing
#define ENABLE_DUAL_BUFFER false

#if (defined(STM32F1) || defined(STM32F4))
// ==== DMD_RGB pins ====
// mux pins - A, B, C... all mux pins must be selected from same port!
#define DMD_PIN_A PB6
#define DMD_PIN_B PB5
#define DMD_PIN_C PB4
#define DMD_PIN_D PB3
#define DMD_PIN_E PB8
// put all mux pins at list
uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E };

// pin OE must be one of PB0 PB1 PA6 PA7
#define DMD_PIN_nOE PB0
#define DMD_PIN_SCLK PB7

// Pins for R0, G0, B0, R1, G1, B1 channels and for clock.
// By default the library uses RGB color order.
// If you need to change this - reorder the R0, G0, B0, R1, G1, B1 pins.
// All this pins also must be selected from same port!
uint8_t custom_rgbpins[] = {PA6, PA0,PA1,PA2,PA3,PA4,PA5 }; // CLK, R0, G0, B0, R1, G1, B1

#elif (defined(ARDUINO_ARCH_RP2040))

// ==== DMD_RGB pins ====
// mux pins - A, B, C... all mux pins must be selected from same port!
#define DMD_PIN_A 6
#define DMD_PIN_B 7
#define DMD_PIN_C 8
#define DMD_PIN_D 9
#define DMD_PIN_E 10
// put all mux pins at list
uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E };

// pin OE must be one of PB0 PB1 PA6 PA7
#define DMD_PIN_nOE 15
#define DMD_PIN_SCLK 12

// Pins for R0, G0, B0, R1, G1, B1 channels and for clock.
// By default the library uses RGB color order.2
// If you need to change this - reorder the R0, G0, B0, R1, G1, B1 pins.
// All this pins also must be selected from same port!
uint8_t custom_rgbpins[] = { 11, 16,17,18,19,20,21 }; // CLK, R0, G0, B0, R1, G1, B1
#endif
// Fire up the DMD object as dmd<MATRIX_TYPE, COLOR_DEPTH>
// We use 64x32 matrix with 16 scans and 4bit color:
DMD_RGB <RGB32x16plainS8 , COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);
// other options are:
// - 32x16 matrix with 8scans
// - 80x40 matrix with 20scans
// - 64x64 matrix with 32scans
// Color depth - <COLOR_4BITS> or <COLOR_1BITS>

// --- Define fonts ----
// DMD.h old style font
DMD_Standard_Font Arial_black(SystemFont5x7);
// GFX font with sepatate parts for Latin and Cyrillic chars
//DMD_GFX_Font GlametrixL((uint8_t*)&GlametrixLight12pt7b, (uint8_t*)&GlametrixLight12pt8b_rus, 0x80, 13);

/*--------------------------------------------------------------------------------------
UTF8 char recoding

/--------------------------------------------------------------------------------------
setup
Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------
/
// create foreground colors
uint16_t col[] = {
dmd.Color888(255,0, 0), // red
dmd.Color888(0, 255, 0), // green
dmd.Color888(0, 0, 255), // blue
dmd.Color888(0, 255, 255), // blue
dmd.Color888(0, 0, 0), // blue
};

void setup(void)
{

// initialize DMD objects

dmd.init();
Serial.begin(9600);
Serial.println("PICO P4 RTC");
delay(1000);

}

/--------------------------------------------------------------------------------------
loop
Arduino architecture main loop
--------------------------------------------------------------------------------------
/

void loop(void)
{

dmd.selectFont(&Arial_black);
dmd.setBrightness(255);
dmd.setTextColor(00, 0);
while (1) 
{
  

          dmd.drawString(0,0,"PLAN",4,col[1]);
          dmd.drawString(0,8,"ACTAL",6,col[2]);
          dmd.drawString(0,16,"GAP",3,col[0]);
          dmd.drawString(0,24,"EFFY",4,col[1]);
 }
}

Some time display going stuck

hi sir,

P6 RGB or P10 Red color module display issue showing
at the same time serial port data send receiving working

please check picture.

after poweroff and on going to normal mode ,how to solve this issue

PHOTO-2023-05-30-14-33-12

P6 32x32 qiangli New MATRIX TYPES

Hi sir

I am now using new p6 32x32 matrix with 1/8 scan
please check module picture and code

/*--------------------------------------------------------------------------------------
Demo for RGB panels

DMD_STM32a example code for STM32 and RP2040 boards

Pattern test for 32x16 1/2 1/4 RGB panels
------------------------------------------------------------------------------------- */
#include "DMD_RGB.h"
//Number of panels in x and y axis
#define RGB32x32_S8_maxmurugan 3,32,32,8,1 // 32x32 1/8 matrix from @maxmurugan

#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1

// Output buffering - false
#define ENABLE_DUAL_BUFFER false

// ==== DMD_RGB pins ====
// mux pins - A, B, C... all mux pins must be selected from same port!
#define DMD_PIN_A 6
#define DMD_PIN_B 7
#define DMD_PIN_C 8
#define DMD_PIN_D 9
#define DMD_PIN_E 10
// put all mux pins at list
uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E };
#define DMD_PIN_nOE 15
#define DMD_PIN_SCLK 12
uint8_t custom_rgbpins[] = { 11, 16,17,18,19,20,21 }; // CLK, R0, G0, B0, R1, G1, B1
DMD_RGB <RGB32x32_S8_maxmurugan, COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);
uint16_t bg = 0; // background - black
uint16_t fg = 0; // foreground

void setup(void)
{
dmd.init();
fg = dmd.Color888(0, 0, 255);
dmd.setBrightness(50);
}

void loop(void) {
// fill the matrix with points row by row
for (int i = 0; i < dmd.height(); i++) {
for (int j = 0; j < dmd.width(); j++) {
dmd.drawPixel(j,i, fg);
delay(40);
}
}
// clear the screen
dmd.fillScreen(bg);
}

Untitled.1.mp4

IMG-1727

P10 RGB Panel new Scan

hi sir
this new p10 module qiangli 1/4 th scan
/*--------------------------------------------------------------------------------------
Demo for RGB panels

DMD_STM32a example code for STM32 and RP2040 boards

Pattern test for 32x16 1/2 1/4 RGB panels
------------------------------------------------------------------------------------- */
#include "DMD_RGB.h"
//Number of panels in x and y axis
#define RGB32x16plainS4 2,32,16,4,1
//#define RGB32x32_S8_maxmurugan2 3,40,20,5,1 // 32x32 1/8
//#define RGB32x32_S8_maxmurugan3 3,32,32,8,1 // 32x32 1/8
//#define RGB32x32_S8_maxmurugan4 3,32,32,8,2 // 32x32 1/8
//#define RGB32x32_S8_maxmurugan5 3,32,32,8,33 // 32x32 1/8

#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1

// Output buffering - false
#define ENABLE_DUAL_BUFFER false

// ==== DMD_RGB pins ====
// mux pins - A, B, C... all mux pins must be selected from same port!
#define DMD_PIN_A 6
#define DMD_PIN_B 7
#define DMD_PIN_C 8
#define DMD_PIN_D 9
#define DMD_PIN_E 10
// put all mux pins at list
uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E };
#define DMD_PIN_nOE 15
#define DMD_PIN_SCLK 12
uint8_t custom_rgbpins[] = { 11, 16,17,18,19,20,21 }; // CLK, R0, G0, B0, R1, G1, B1
//DMD_RGB <RGB32x32_S8_maxmurugan2, COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);
DMD_RGB_SHIFTREG_ABC <RGB32x16plainS4, COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);
uint16_t bg = 0; // background - black
uint16_t fg = 0; // foreground

void setup(void)
{
dmd.init();
fg = dmd.Color888(0, 0, 255);
dmd.setBrightness(50);
}

void loop(void) {
// fill the matrix with points row by row
for (int i = 0; i < dmd.height(); i++) {
for (int j = 0; j < dmd.width(); j++) {
dmd.drawPixel(j,i, fg);
delay(40);
}
}
// clear the screen
dmd.fillScreen(bg);
}

IMG-5732

cf9a2ec7-8404-49d5-bba1-9ca3da0f536c.mp4

Bluepill with GKGD P6 display issue

I connected P6 outdoor LED module with Bluepill STM32 but its showing two line on display

/*--------------------------------------------------------------------------------------
Demo for RGB panels

DMD_STM32a example code for STM32F103xxx board
------------------------------------------------------------------------------------- */
#include "DMD_RGB.h"

// Fonts includes
#include "st_fonts/SystemFont5x7.h"
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Woverflow"
//Number of panels in x and y axis
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
char a[10];
char b[10];
// Enable of output buffering
// if true, changes only outputs to matrix after
// swapBuffers(true) command
// If dual buffer not enabled, all output draw at matrix directly
// and swapBuffers(true) cimmand do nothing
#define ENABLE_DUAL_BUFFER false

// ==== DMD_RGB pins ====
// mux pins - A, B, C... all mux pins must be selected from same port!
#define DMD_PIN_A PB6
#define DMD_PIN_B PB5
#define DMD_PIN_C PB4
#define DMD_PIN_D PB3
#define DMD_PIN_E PB8
// put all mux pins at list
uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E };

// pin OE must be one of PB0 PB1 PA6 PA7
#define DMD_PIN_nOE PB0
#define DMD_PIN_SCLK PB7

// Pins for R0, G0, B0, R1, G1, B1 channels and for clock.
// By default the library uses RGB color order.
// If you need to change this - reorder the R0, G0, B0, R1, G1, B1 pins.
// All this pins also must be selected from same port!
uint8_t custom_rgbpins[] = {PA15, PA0,PA1,PA2,PA3,PA4,PA5 }; // CLK, R0, G0, B0, R1, G1, B1

// Fire up the DMD object as dmd<MATRIX_TYPE, COLOR_DEPTH>
// We use 64x32 matrix with 16 scans and 4bit color:
DMD_RGB_SHIFTREG_ABC <RGB32x32_S8_maxmurugan, COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);
// other options are:
// - 32x16 matrix with 8scans
// - 80x40 matrix with 20scans
// - 64x64 matrix with 32scans
// Color depth - <COLOR_4BITS> or <COLOR_1BITS>

// --- Define fonts ----
// DMD.h old style font
DMD_Standard_Font Arial_black(SystemFont5x7);
// GFX font with sepatate parts for Latin and Cyrillic chars
//DMD_GFX_Font GlametrixL((uint8_t*)&GlametrixLight12pt7b, (uint8_t*)&GlametrixLight12pt8b_rus, 0x80, 13);

/*--------------------------------------------------------------------------------------
UTF8 char recoding

-------------------------------------------------------------------------------------*/

// create foreground colors
uint16_t col[] = {
dmd.Color888(255,0, 0), // red
dmd.Color888(0, 255, 0), // green
dmd.Color888(0, 0, 255), // blue
dmd.Color888(0, 255, 255), // blue
dmd.Color888(0, 0, 0), // blue
};

void setup(void)
{
Serial.end();
// initialize DMD objects
dmd.init();
Serial.begin(9600);
Serial.println("PICO P4 RTC");
delay(1000);

}

/--------------------------------------------------------------------------------------
loop
Arduino architecture main loop
--------------------------------------------------------------------------------------
/

void loop(void) {
uint16_t bg = 0; // background - black
uint16_t fg = dmd.Color888(0, 255, 0);; // foreground
// draw pixels
for (int i = 0; i < dmd.height(); i++) {
for (int j = 0; j < dmd.width(); j++) {
dmd.drawPixel(j,i, fg);
delay(30);
}
}
// clear the screen
dmd.fillScreen(bg);

}

draw image

Hi , first of all I want to thank you for DMD_STM32.
I've seen that there is dmd.img in .cpp but I can't figure how to use it. which image format to use? which resolution? ... Can anyone help me with this? Is there any example? Thanks in advance.

DMD+W5500

Russian:
Могу ли я использовать данную библиотеку с модулем W5500? Есть ли прототип печатной платы для Pi Pico? Со своей стороны имею доступ ко многим панелям разных производителей, хочу протестировать на всех. Особенно интересны панели P2.5 128х64 с контактом D1между G1 и G2 (фото выложу позже) и 64х32 P5 (обе уличные). И еще нужно ли преобразовывать логику в 5V для всех панелей? подойдут ли 74HCT245?

Can I use this library with the W5500 module? Is there a prototype PCB for Pi Pico? For my part, I have access to many panels from different manufacturers, I want to test at all. Especially interesting are the panels P2.5 128x64 with contact D1 between G1 and G2 (I will post photos later) and 64x32 P5 (both street). And is it also necessary to convert the logic to 5V for all panels? Will 74HCT245 work?

24bit color depth no supported?

P10, HUB75, 1/4 scan, outdoor
STM32F103C8 and STM32F401CCU6

DMD_RGB <RGB32x16_S4_BIN, COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, 2, 1, false);

 for (int i = 0; i < 255; i++)
  {
      fg = dmd.Color888(i,0,0);
      dmd.fillScreen(fg);
      delay(5);
  }

In this form, the display misses the brightness of the LEDs, because of this there is no smoothness.
The COLOR_8BITS constant do not exist.
In file DMD_RGB.h need parameters in template DMD_RGB_BASE2?

Also in the current version, the led screen does not burn at full brightness. Based on power consumption.

Weird scan pattern

Hi @board707 !

Here's some more details about the cursed panel with weird pattern.

It's 2 mux pins, 2 scan lines, and what you see uses #define DISPLAY_TYPE 2,32,16,2,1

PXL_20231024_125207952

PXL_20231024_125534165.1.mp4

Color problem in panel increase

Hello, I use your library all the time.
There is no problem with green color when using a 2x2 P5 panel

I'm having trouble with panels turning green in 4x4 applications

There is no problem with other colors

my card is stmf4 black

I would be happy if you help me

WhatsApp.Video.2023-09-14.saat.01.15.42.mp4

ghosting effect at 1/4 scan RGB

Originally posted by @bilalibrir in #9 (comment)

I have noticed a ghosting effect and is a bit hard to show on camera. you can only see it at the D line. it could be the mux!!

VID_20220211_173913.mp4

i really like this library and looking forward to test the next releases.
thank you.

Flickering with RGB P4 Module on RPI PICO

I TRY YOUR CODE TOP-LINE SCROLLING AND BOTTOM-LINE STRING MESSAGE
HOW TO REMOVE BACKGROUND COLOUR AND FLICKERING?
PLEASE SUGGEST A CODE HERE.

void loop(void)
{

// create foreground colors
uint16_t col[] = {
    dmd.Color888(255,0, 0), // red
    dmd.Color888(0, 255, 0), // green
    dmd.Color888(0, 0, 255)  // blue

};
uint16_t bg = 0;  // background - black
int col_cnt = 3;   // color count

// text
char s[] = "          MURUGAN CHENNAI";
// transcode message to UTF for use with GFX fonts
char k[30];

utf8_rus(k, (const unsigned char*)s);
char* m = s;
// select standard font
dmd.selectFont(&UkrRusArial_F);
// set text foreground and background colors
dmd.setTextColor(col[0], bg);
// shift steps in pixels for running text (positive - shift right, negative - left)
// running text shift interval
uint16_t interval = 25;
long prev_step = millis();
dmd.setBrightness(200);

// Cycle for tests:
// -- running texts moving at x and y axis with single and double speed
// -- vertical scrolling message
while (1) {
    if ((millis() - prev_step) > interval) 
    {
            dmd.drawString(8,16,"12:34:56",8,col[1]);  //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
            
            if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds
                dmd.clearScreen(true);
                dmd.setTextColor(col[0], bg);
                dmd.drawMarqueeX(m, 0,0);
            }
            // output mem buffer to matrix
            dmd.swapBuffers(true);
        prev_step = millis();

    }
}

}

won't display big string

Hi, I have problem to display big string from serial input. Stm32 recived string 350 charachters but only displays 170. Help?

Flickering issue on 4bit RGB modes in v1.1.0

Attention
The last version (v1.1.0) of the library exhibits problems in some 4-bit color modes on standard (non-PWM) RGB panels.
The causes of the problems lie in recent code changes. Version 1.0.7 and earlier do not experience these problems.

A fix will be released soon.

Error in STM32F401RC6 compilation

I am using STM32F401RC6 controller and this core https://github.com/stm32duino/Arduino_Core_STM32
not sure why below compilation error comes

arduino-cli compile -b STMicroelectronics:stm32:GenF4 dmd_monochrome

In file included from C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_RGB.h:24,
from C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_RGB.cpp:9:
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:235:40: error: 'voidFuncPtr' has not been declared
235 | virtual void initialize_timers(voidFuncPtr handler);
| ^~~~~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:264:9: error: 'PortType' does not name a type
264 | PortType clk_clrmask = 0;
| ^~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:265:9: error: 'PortType' does not name a type
265 | PortType clkmask = 0;
| ^~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:275:9: error: 'OE_PWM_Polarity' does not name a type
275 | OE_PWM_Polarity OE_polarity = OE_PWM_POSITIVE;
| ^~~~~~~~~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_RGB.cpp: In constructor 'DMD_RGB_BASE::DMD_RGB_BASE(byte, uint8_t*, byte, byte, uint8_t*, byte, byte, bool, uint8_t, uint8_t, byte, byte)':
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_RGB.cpp:32:9: error: 'OE_polarity' was not declared in this scope
32 | OE_polarity = OE_PWM_NEGATIVE;
| ^~~~~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_RGB.cpp:32:23: error: 'OE_PWM_NEGATIVE' was not declared in this scope
32 | OE_polarity = OE_PWM_NEGATIVE;
| ^~~~~~~~~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_RGB.cpp: In member function 'virtual void DMD_RGB_BASE::init(uint16_t)':
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_RGB.cpp:167:27: error: invalid conversion from 'void ()()' to 'int' [-fpermissive]
167 | initialize_timers(scan_running_dmd_R);
| ^~~~~~~~~~~~~~~~~~
| |
| void (
)()
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:235:52: note: initializing argument 1 of 'virtual void DMD::initialize_timers(int)'
235 | virtual void initialize_timers(voidFuncPtr handler);
| ~~~~~~~~~~~~^~~~~~~
In file included from C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.cpp:27:
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:235:40: error: 'voidFuncPtr' has not been declared
235 | virtual void initialize_timers(voidFuncPtr handler);
| ^~~~~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:264:9: error: 'PortType' does not name a type
264 | PortType clk_clrmask = 0;
| ^~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:265:9: error: 'PortType' does not name a type
265 | PortType clkmask = 0;
| ^~~~~~~~
C:\Users\Phalguni\Downloads\DMD_STM32-dev-V2\examples\STM32F4_RP2040\dmd_monochrome\DMD_STM32a.h:275:9: error: 'OE_PWM_Polarity' does not name a type
275 | OE_PWM_Polarity OE_polarity = OE_PWM_POSITIVE;
| ^~~~~~~~~~~~~~~

Used library Version Path
SPI 1.0.0 C:\Users\Phalguni\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.6.0\libraries\SPI
SrcWrapper 1.0.1 C:\Users\Phalguni\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.6.0\libraries\SrcWrapper

Used platform Version Path
STMicroelectronics:stm32 2.6.0 C:\Users\Phalguni\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.6.0
Error during build: exit status 1

Novelty ways of joining the panels

I have 5 32x16 P10 panels that I'd like to put to some use. They are some rare parts so I assume it'd be hard to find anything compatible with them, therefore I'd like to use all 5 of them at once.

This gives me some possibilities regarding connections and resolutions:

Simple 5x1 for 160x16 display

Classy 2x2 for 64x32 display

The second could be potentially more sueful but then one panels is left without job.

An alternative popped to my mind abou usin 5x1 but sideways to give a nice 80x32 display with ribbons coming in a zigzag shape from behind.

The thing is: how best to approach this from the code perspective as I assume the library is not ready for such crazy ways of behavior?

P10 Monochrome support for Rpi pico

I tested with P10RGB and P4RGB working well for using the clock same library will support P10 red module?

Please give the P10 red module support and also explain different scan method

please give me a P10 red module with Pico library.

p4 module 32x64 pixel

char s[] = "welcome to board707 abcdefghijklmnopqrstuvwxyz";

dmd.drawString(0,a10,strlen(a10),col[4]);

fill first line remaining char go to next line automatically

how to program ?

please help sir

Add a new 32x16 4s panel

Panel HRLOP10-4S-3535

Dimensions (in pixels) : 32x16

Scan factor: 1/4

Chips on rear side: probably 74 series (only 74 visible)

Panel photos

2023-11-13 at 10 40 53
2023-11-13 at 10 41 10

Sample videos

Pattern: 2,32,16,4,1

Mux pins: 2

2023-11-13.at.03.12.05_stab_apo8.mp4

Specifications

  • Library version: 1.01

  • Platform: STM32

  • MCU board: blackpil STM32F103C8T6

  • Connections: used pins

    DMD_PIN_A PB6
    DMD_PIN_B PB5

    DMD_PIN_nOE PB0
    DMD_PIN_SCLK PB7

    CLK:PA6 R1:PA0 G1:PA1 B1:PA2 R2:PA3 G2:PA4 B2:PA5

SPIClass

Hi, sorry for what I'm sure is a simple question: When I compile the dmd_demo sketch in Arduino, I get the following message:

_Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Generic STM32F1 series, Generic F103C8Tx, STM32CubeProgrammer (SWD), Enabled (generic 'Serial'), None, Low/Full Speed, Smallest (-Os default), None, Newlib Nano (default)"

dmd_demo:48:19: error: no matching function for call to 'SPIClass::SPIClass(int)'

48 | SPIClass dmd_spi(2);

  |                   ^

In file included from \Documents\Arduino\libraries\DMD_STM32-old-V1/DMD_STM32.h:47,

             from \Documents\Arduino\libraries\DMD_STM32-old-V1\examples\STM32F1\dmd_demo\dmd_demo.ino:42:

\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:114:5: note: candidate: 'SPIClass::SPIClass(uint32_t, uint32_t, uint32_t, uint32_t)'

114 | SPIClass(uint32_t mosi, uint32_t miso, uint32_t sclk, uint32_t ssel = PNUM_NOT_DEFINED);

  |     ^~~~~~~~

\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:114:5: note: candidate expects 4 arguments, 1 provided

\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:113:5: note: candidate: 'SPIClass::SPIClass()'

113 | SPIClass();

  |     ^~~~~~~~

\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:113:5: note: candidate expects 0 arguments, 1 provided

\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:111:7: note: candidate: 'constexpr SPIClass::SPIClass(const SPIClass&)'

111 | class SPIClass {

  |       ^~~~~~~~

C:\Users\Leon.Hutton\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:111:7: note: no known conversion for argument 1 from 'int' to 'const SPIClass&'

C:\Users\Leon.Hutton\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:111:7: note: candidate: 'constexpr SPIClass::SPIClass(SPIClass&&)'

C:\Users\Leon.Hutton\Documents\ArduinoData\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI\src/SPI.h:111:7: note: no known conversion for argument 1 from 'int' to 'SPIClass&&'

exit status 1

no matching function for call to 'SPIClass::SPIClass(int)'_

Any ideas? I suspect something simple I am doing wrong...

Cannot compile example

Hello,

I try to compile dmd_demo (dmd_demo.ino in examples folder), but failed with following error:
error: no matching function for call to 'SPIClass::SPIClass(int)' SPIClass dmd_spi(2); ^

I use BluePill(STM32F103C8), with Arduino IDE 1.8.0, and STM32Duino 1.7.0

Thank you.

How define Latch pin

I have not found any information on connecting the latch pin, I would like to see where to define this pin in the documentation. Is there any example where the Latch pin is overridden?

PIO support?

Hi there,

Could I use RP2004 framework based on PlatformIO?

Add a new panel 128x64 32s FM6363C, DP245D

128x64 rgb 32s panel

Dimensions (in pixels) : 128x64

Scan factor: 1/32

Chips on rear side: 6363C, DP245D, 74hc040

Panel photos

00003db0-4b4d-4bb2-906c-2fda0a64ffe0
abe33c12-3be5-4412-a6cf-22757211dc22
4a8f6910-f63e-45bf-9c85-5306374cc5c9
5ebd464c-03f4-48e0-b3c8-17bf7fae90e3
ddd9332f-70f7-489e-9370-443fff2da4bc

Sample videos

Specifications

  • Library version: 1.01
  • Platform: STM32
  • MCU board: bluepil STM32F103
  • Connections: use pattern test default pins

STM32 BluePill F103C8

setting
stm321

/*--------------------------------------------------------------------------------------
Demo code for DMD panels

DMD_STM32a example code for STM32F103xxx board
------------------------------------------------------------------------------------- /
// choose between Parallel ans SPI wiring
// comment line below for SPI connection
/
--------------------------------------------------------------------------------------
Includes
--------------------------------------------------------------------------------------*/

#include "DMD_Monochrome_Parallel.h"

// Fonts includes
#include "st_fonts/UkrRusArial14.h"

//Number of panels in x and y axis
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 2

// Enable of output buffering
// if true, changes only outputs to matrix after
// swapBuffers(true) command
// If dual buffer not enabled, all output draw at matrix directly
// and swapBuffers(true) cimmand do nothing
#define ENABLE_DUAL_BUFFER true

// ----- Select pins for P10 matrix connection ------------
// pins A, B, SCLK may be any digital I/O, pin nOE should be Timer3 PWM pin as PB0,PB1
// if connect as SPI, do not use corresponding MiSO pin - PA6 for SPI1 and PB14 for SPI2
#define DMD_PIN_A PA1
#define DMD_PIN_B PA4
#define DMD_PIN_nOE PB1
//#define DMD_PIN_nOE PA6
#define DMD_PIN_SCLK PA15
//#define DMD_PIN_SCLK PB4

// pins for SPI connect
// SPI specific pins as CLK and R_DATA has predefined values:
// for SPI(1) CLK = PA5 R_DATA = PA7
// for SPI(2) CLK = PB13 R_DATA = PB15
// --------------------------------------------------------

uint8_t pins[] = { PA5, PA7, PA6 }; // CLK , row1, row 2

//Fire up the DMD object as dmd
DMD_Monochrome_Parallel dmd(DMD_PIN_A, DMD_PIN_B, DMD_PIN_nOE, DMD_PIN_SCLK, pins, DISPLAYS_ACROSS, DISPLAYS_DOWN,ENABLE_DUAL_BUFFER);

// --- Define fonts ----
// DMD.h old style font
DMD_Standard_Font UkrRusArial_F(UkrRusArial14);

// GFX font with sepatate parts for Latin and Cyrillic chars
//DMD_GFX_Font GlametrixL((uint8_t*)&GlametrixLight12pt7b,(uint8_t*)&GlametrixLight12pt8b_rus,0x80,13);

/*--------------------------------------------------------------------------------------
UTF8 char recoding

--------------------------------------------------------------------------------------/
int utf8_rus(char
dest, const unsigned char* src) {

uint16_t i, j;
for ( i =0, j =0; src[i]; i++) {
if ((src[i] == 0xD0 )&& src[i+1]) { dest[j++] = src[++i] - 0x10;}
else if ((src[i] == 0xD1 )&& src[i+1]) {dest[j++] = src[++i] + 0x30; }
else dest[j++] = src[i];
}
dest[j] ='\0';
return j;
}

/--------------------------------------------------------------------------------------
setup
Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------
/

void setup(void)
{

// initialize DMD objects
// scan DMD row each 700 us
dmd.init(700);
dmd.setBrightness(80);

}

/--------------------------------------------------------------------------------------
loop
Arduino architecture main loop
--------------------------------------------------------------------------------------
/
void loop(void)
{

// text
const char m[] = "Привет Ардуино!";
// transcode message to UTF for use with GFX fonts
char k[30];
utf8_rus(k, (const unsigned char* )m);

// but initially select standard font
dmd.selectFont(&UkrRusArial_F);

// shift steps in pixels for running text (positive - shift right, negative - left)
int8_t step[] = { 1,-1,-2,2 };
// running text shift interval
uint16_t interval = 50;

long prev_step = millis();
uint8_t i = 0, b = 0;
uint8_t test = 255;
uint8_t test_cnt = 4;

 // Cycle for tests:
// -- running texts moving at x and y axis with single and double speed
// -- brightness control
// -- vertical scrolling message
while (1) {
    if ((millis() - prev_step) > interval) {
        if (test >= test_cnt) {
            test = 0;
            // draw message
            dmd.drawMarqueeX(m, -1 * (dmd.stringWidth(m)), 0);
            dmd.swapBuffers(true);

        }
        switch (test) {
          // moving text at x axis
        case 0:
            if (dmd.stepMarquee(step[i], 0) & 1) { // if text is reached screen bounds

                dmd.clearScreen(true);
                i++;
                // if all moving finished
                if (i > 3) {
                  // go to next stage
                    i =0;
                    test++;
                    dmd.drawMarqueeX(m, 0, 0);
                }
                else {
                    if (step[i] < 0) dmd.drawMarqueeX(m, dmd.width() - 1, 0);
                    else dmd.drawMarqueeX(m, -1 * dmd.stringWidth(m), 0);
                }
            }
            else {
                
                if (step[i] != 1) dmd.drawFilledBox(0, 0, 5, dmd.height() - 1, GRAPHICS_INVERSE);
            }
            // output mem buffer to matrix
            dmd.swapBuffers(true);
            break;
        
        
        // change brightness
        case 1:
            b++;
            dmd.setBrightness(b);
            if (b > 200) {
                test++;
                b = 80;
                i = 0;
                dmd.setBrightness(b);
                dmd.drawMarqueeX(m, 0, 0);
            }
            dmd.swapBuffers(true);
            break;

        // moving text at y axis
        case 2:
            if (dmd.stepMarquee(0, step[i]) & 1) {

                // clear the screen
                dmd.clearScreen(true);
                // select new moving speed
                i++;
                // if all moving finished
                if (i > 3) {
                  // go to next stage
                    test++;
                    // select GFX font for vertical scroll
                    dmd.selectFont(&GlametrixL);
                    dmd.drawMarquee(k, strlen(k), dmd.width() - 1, 0, 1);

                }
                else {
                    if (step[i] < 0) dmd.drawMarqueeX(m, 0, dmd.height());
                    else dmd.drawMarqueeX(m, 0, 0);
                }
            }
            // output mem buffer to matrix
            dmd.swapBuffers(true);
            break;

        // vertical scrolling    
        case 3:

            dmd.stepMarquee(-1, 0, 1);
            dmd.swapBuffers(true);
            break;

        }

        prev_step = millis();

    }
}

}

Top line get flicker at Start of the scrolling text

    https://user-images.githubusercontent.com/4962604/206518659-8ec8b6a9-5f3e-4be5-b5e8-e4a5775daa9a.MOV

/*--------------------------------------------------------------------------------------
Demo code for DMD panels

DMD_STM32a example code for STM32F103xxx board
------------------------------------------------------------------------------------- /
// choose between Parallel ans SPI wiring
// comment line below for SPI connection
#include <RTClock.h>
#define DMD_PARA
/
--------------------------------------------------------------------------------------
Includes
--------------------------------------------------------------------------------------*/
#if defined(DMD_PARA)
#include "DMD_Monochrome_Parallel.h"
#else
#include "DMD_MonoChrome_SPI.h"
#endif

// Fonts includes
#include "st_fonts/SystemFont5x7.h"
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Woverflow"
#include "gfx_fonts/GlametrixLight12pt7b.h"
#include "gfx_fonts/GlametrixBold12pt7b.h"
#pragma GCC diagnostic warning "-Wnarrowing"
#pragma GCC diagnostic warning "-Woverflow"

//Number of panels in x and y axis
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1

// Enable of output buffering
// if true, changes only outputs to matrix after
// swapBuffers(true) command
// If dual buffer not enabled, all output draw at matrix directly
// and swapBuffers(true) cimmand do nothing
#define ENABLE_DUAL_BUFFER true

// ----- Select pins for P10 matrix connection ------------
// pins A, B, SCLK may be any digital I/O, pin nOE should be Timer3 PWM pin as PB0,PB1
// if connect as SPI, do not use corresponding MiSO pin - PA6 for SPI1 and PB14 for SPI2
#define DMD_PIN_A PA0
#define DMD_PIN_B PA1
#define DMD_PIN_nOE PB1
//#define DMD_PIN_nOE PA6
#define DMD_PIN_SCLK PA2
//#define DMD_PIN_SCLK PB4

// pins for SPI connect
// SPI specific pins as CLK and R_DATA has predefined values:
// for SPI(1) CLK = PA5 R_DATA = PA7
// for SPI(2) CLK = PB13 R_DATA = PB15
// --------------------------------------------------------

//=== Config for Parallel connect ====
#if defined(DMD_PARA)
//pins for rows at x axis
// example for two rows
// all those pins must be selected from same port!
uint8_t pins[] = { PA5, PA6, PA7 }; // CLK , row1, row 2

//Fire up the DMD object as dmd
DMD_Monochrome_Parallel dmd(DMD_PIN_A, DMD_PIN_B, DMD_PIN_nOE, DMD_PIN_SCLK, pins, DISPLAYS_ACROSS, DISPLAYS_DOWN,ENABLE_DUAL_BUFFER);
#else

//=== Config for SPI connect ====
SPIClass dmd_spi(1);
DMD_MonoChrome_SPI dmd(DMD_PIN_A, DMD_PIN_B, DMD_PIN_nOE, DMD_PIN_SCLK, DISPLAYS_ACROSS, DISPLAYS_DOWN, dmd_spi, ENABLE_DUAL_BUFFER);
#endif

// --- Define fonts ----
// DMD.h old style font
DMD_Standard_Font UkrRusArial_F(SystemFont5x7);

// GFX font with sepatate parts for Latin and Cyrillic chars
DMD_GFX_Font GlametrixL((uint8_t*)&GlametrixLight12pt7b,(uint8_t*)&GlametrixLight12pt8b_rus,0x80,13);

RTClock rt (RTCSEL_LSE); // initialise
uint32 tt;

byte Sop_packet =0;
int str =0;
char Serial_data[250];
const unsigned int Message_length =100;
char* m = "MAXTEQ";
char k[100];
/*--------------------------------------------------------------------------------------
UTF8 char recoding

--------------------------------------------------------------------------------------/
int utf8_rus(char
dest, const unsigned char* src) {

uint16_t i, j;
for ( i =0, j =0; src[i]; i++) {
if ((src[i] == 0xD0 )&& src[i+1]) { dest[j++] = src[++i] - 0x10;}
else if ((src[i] == 0xD1 )&& src[i+1]) {dest[j++] = src[++i] + 0x30; }
else dest[j++] = src[i];
}
dest[j] ='\0';
return j;
}

/--------------------------------------------------------------------------------------
setup
Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------
/

void setup(void)
{

// initialize DMD objects
// scan DMD row each 700 us
dmd.init(700);
dmd.setBrightness(80);
Serial.begin(9600);
Serial.print("1236523442");

}

/--------------------------------------------------------------------------------------
loop
Arduino architecture main loop
--------------------------------------------------------------------------------------
/
void loop(void)
{
// m[] = "MAXTEQ";
// text
// transcode message to UTF for use with GFX fonts
utf8_rus(k, (const unsigned char* )m);
// but initially select standard font
dmd.selectFont(&UkrRusArial_F);

// shift steps in pixels for running text (positive - shift right, negative - left)
int8_t step[] = { 1,-1,-2,2 };
// running text shift interval
uint16_t interval = 35;

long prev_step = millis();
uint8_t i = 0, b = 0;
uint8_t test = 255;
uint8_t test_cnt = 4;

 // Cycle for tests:
// -- running texts moving at x and y axis with single and double speed
// -- brightness control
// -- vertical scrolling message
while (1) {
  Get_Rtc_Time();
          while(Serial.available()>0)
    {
       static char Message[Message_length];
       static unsigned int Message_pos = 0;
       char inByte = Serial.read();
       //message comming in 
       if(inByte != '\n' && Sop_packet ==1)
       {
        //add in coming byte in our message
        Message[Message_pos] = inByte;
        Message_pos++;
        
       }
       //full message received
       else
       {
        //add null char to string
        Message[Message_pos] = '\0';
        if(Message_pos>0)
        {
          m = Message;
          utf8_rus(k, (const unsigned char*)m);
          Serial.print(m);
        }
        Message_pos =0 ;
        Sop_packet =0;
       }
       if(inByte == '[')Sop_packet =1;
      
    }
    char buf[10];
    sprintf(buf,"%5d",tt);
    dmd.drawString(2,0,buf,sizeof(buf),1); //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
    if ((millis() - prev_step) > interval) {

            if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds

                dmd.clearScreen(true);
                //dmd.drawMarquee(m, strlen(m), dmd.width()-10,(dmd.height() > 0)? 16 : 0, 1);
                dmd.selectFont(&UkrRusArial_F);
                dmd.drawMarquee(k, strlen(k), dmd.width() - 1, 8, 1);
                }
                 dmd.swapBuffers(true);
                 prev_step = millis();                   
            }
          
    }

}
void Get_Rtc_Time()
{

if (rt.getTime()!=tt)
{
tt = rt.getTime();

Serial.print("time is: ");
Serial.println(tt);

}
}

Originally posted by @maxmurugan in #18 (comment)

Pico + RTOS

First of all, thank you for your great work!
At the beginning I tried your dmd_rgb example and it worked fine. Then tried to experiment with it. I would like to use an RTOS task to generate images at the background (as I did on ESP32). Here a big problem arose: if I include the FreeRTOS.h the matrix stops working. (even if there is no tasks created, just the include) I presume the two libraries both try to use some same resources (timer?) which causes the conflict. I am afraid that my knowledgeat the moment is still not enough to find the exact reason. Maybe you can find and correct it easily. If it would be a too big work, then please take it as a feature request for the future.

P5 32x64 scan problem

I have a p5 32x64 1/8 color scanning screen, I used your patterns, but I was not successful, can you help me?

`#define NAME_OF_PANEL MUX pins, Panel_width, Panel_height, scan, pattern ID
#define RGB64x32_S8_OKSingra 3,64,32,8,1
// Pins for R0, G0, B0, R1, G1, B1 channels and for clock.
// By default the library uses RGB color order.
// If you need to change this - reorder the R0, G0, B0, R1, G1, B1 pins.
// All this pins also must be selected from same port!
uint8_t custom_rgbpins[] = { PA15, PA0,PA1,PA2,PA3,PA4,PA5 }; // CLK, R0, G0, B0, R1, G1, B1

// Fire up the DMD object as dmd<MATRIX_TYPE, COLOR_DEPTH>
// We use 64x32 matrix with 16 scans and 4bit color:
DMD_RGB <RGB64x32_S8_OKSingra , COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);
// other options are:
// - 32x16 matrix with 8scans
// - 80x40 matrix with 20scans
// - 64x64 matrix with 32scans
// Color depth - <COLOR_4BITS_Packed>, <COLOR_4BITS> or <COLOR_1BITS>

// --- Define fonts ----
// DMD.h old style font
DMD_Standard_Font UkrRusArial_F(UkrRusArial_14);
// GFX font with sepatate parts for Latin and Cyrillic chars
DMD_GFX_Font GlametrixL((uint8_t*)&GlametrixLight12pt7b, (uint8_t*)&GlametrixLight12pt8b_rus, 0x80, 13);

/*--------------------------------------------------------------------------------------
UTF8 char recoding

--------------------------------------------------------------------------------------/
int utf8_rus(char
dest, const unsigned char* src) {

uint16_t i, j;
for (i = 0, j = 0; src[i]; i++) {
    if ((src[i] == 0xD0) && src[i + 1]) { dest[j++] = src[++i] - 0x10; }
    else if ((src[i] == 0xD1) && src[i + 1]) { dest[j++] = src[++i] + 0x30; }
    else dest[j++] = src[i];
}
dest[j] = '\0';
return j;

}

/--------------------------------------------------------------------------------------
setup
Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------
/

void setup(void)
{

// initialize DMD objects
dmd.init(); 

}

/*--------------------


loop
Arduino architecture main loop
--------------------------------------------------------------------------------------*/

void loop(void) {
uint16_t bg = 0; // background - black
uint16_t fg = dmd.Color888(0, 255, 0);; // foreground
// draw pixels
for (int i = 0; i < dmd.height(); i++) {
for (int j = 0; j < dmd.width(); j++) {
dmd.drawPixel(j,i, fg);
delay(30);
}
}
// clear the screen
dmd.fillScreen(bg);

}`

the most i could do

WhatsApp.Video.2023-03-31.saat.17.38.25.mp4

issues with 1/4 scan for rgb panel

I'm having a problem using an RGB (16*32) 1/4 Scan panel with this Library with no succes , the RGB panel has the snake pattern.
are you working to implement this feature or not? if not please can you do it and thanks in advance.
I tried to read the code but didn't understand most of it.
thankyou.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.