Yes, of course:
MatrixCommonHub75.h:
/*
* SmartMatrix Library - Common Definitions for Driving HUB75 Panels
*
* Copyright (c) 2020 Louis Beaudoin (Pixelmatix)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SmartMatrixCommonHUB75_h
#define SmartMatrixCommonHUB75_h
#define DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS 32
#define HUB75_RGB_COLOR_CHANNELS_IN_PARALLEL 2
#define SM_PANELTYPE_HUB75_32ROW_MOD16SCAN 0
#define SM_PANELTYPE_HUB75_16ROW_MOD8SCAN 1
#define SM_PANELTYPE_HUB75_64ROW_MOD32SCAN 2
#define SM_PANELTYPE_HUB75_4ROW_MOD2SCAN 3
#define SM_PANELTYPE_HUB75_8ROW_MOD4SCAN 4
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD2SCAN 5
#define SM_PANELTYPE_HUB12_16ROW_32COL_MOD4SCAN 6 // HUB12 panels have limited support, the height needs to be doubled to account for the fact they only use one RGB channel, though SmartMatrix Library will fill the second channel
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN 7
#define SM_PANELTYPE_HUB75_2ROW_MOD1SCAN 8
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V2 9
#define SM_PANELTYPE_HUB75_32ROW_64COL_MOD8SCAN 10
#define SM_PANELTYPE_HUB75_64ROW_64COL_MOD16SCAN 11
#define SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V11 21
#define SMARTMATRIX_HUB75_32ROW_MOD16SCAN SM_PANELTYPE_HUB75_32ROW_MOD16SCAN
#define SMARTMATRIX_HUB75_16ROW_MOD8SCAN SM_PANELTYPE_HUB75_16ROW_MOD8SCAN
#define SMARTMATRIX_HUB75_64ROW_MOD32SCAN SM_PANELTYPE_HUB75_64ROW_MOD32SCAN
#define SMARTMATRIX_HUB75_4ROW_MOD2SCAN SM_PANELTYPE_HUB75_4ROW_MOD2SCAN
#define SMARTMATRIX_HUB75_8ROW_MOD4SCAN SM_PANELTYPE_HUB75_8ROW_MOD4SCAN
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN SM_PANELTYPE_HUB75_16ROW_32COL_MOD2SCAN
#define SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN SM_PANELTYPE_HUB12_16ROW_32COL_MOD4SCAN
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN
#define SMARTMATRIX_HUB75_2ROW_MOD1SCAN SM_PANELTYPE_HUB75_2ROW_MOD1SCAN
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V2
#define SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN SM_PANELTYPE_HUB75_32ROW_64COL_MOD8SCAN
#define SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN SM_PANELTYPE_HUB75_64ROW_64COL_MOD16SCAN
#define SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 SM_PANELTYPE_HUB75_16ROW_32COL_MOD4SCAN_V11
#define CONVERT_PANELTYPE_TO_MATRIXPANELHEIGHT(x) ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 64 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? 4 : 0) | \
(x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? 8 : 0) | \
(x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 16*2 : 0) | \
(x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? 2 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 64 : 0))
#define CONVERT_PANELTYPE_TO_MATRIXROWPAIROFFSET(x) ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 8 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 8 : 0) | \
(x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? 2 : 0) | \
(x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? 4 : 0) | \
(x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 16 : 0) | \
(x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 8*2 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 8 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 8 : 0) | \
(x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? 1 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 8 : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0))
#define CONVERT_PANELTYPE_TO_MATRIXSCANMOD(x) ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 16 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? 8 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 2 : 0) | \
(x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? 2 : 0) | \
(x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? 4 : 0) | \
(x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 4 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 4 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 4 : 0) | \
(x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 8 : 0) | \
(x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? 1 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 4 : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? 32 : 0))
#define CONVERT_PANELTYPE_TO_MATRIXPANELWIDTH(x) ((x == SMARTMATRIX_HUB75_32ROW_MOD16SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN ? 64 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_MOD8SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_4ROW_MOD2SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
(x == SMARTMATRIX_HUB75_8ROW_MOD4SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
(x == SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN ? 64 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2 ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11 ? 32 : 0) | \
(x == SMARTMATRIX_HUB75_2ROW_MOD1SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0) | \
(x == SMARTMATRIX_HUB75_64ROW_MOD32SCAN ? DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS : 0))
#define MATRIX_PANEL_HEIGHT (CONVERT_PANELTYPE_TO_MATRIXPANELHEIGHT(panelType))
#define MATRIX_STACK_HEIGHT (matrixHeight / MATRIX_PANEL_HEIGHT)
#define COLOR_CHANNELS_PER_PIXEL 3
#define LATCHES_PER_ROW (refreshDepth/COLOR_CHANNELS_PER_PIXEL)
#define COLOR_DEPTH_BITS (refreshDepth/COLOR_CHANNELS_PER_PIXEL)
#define MATRIX_SCAN_MOD (CONVERT_PANELTYPE_TO_MATRIXSCANMOD(panelType))
#define COLS_PER_PANEL (CONVERT_PANELTYPE_TO_MATRIXPANELWIDTH(panelType))
#define PHYSICAL_ROWS_PER_REFRESH_ROW (MATRIX_PANEL_HEIGHT / MATRIX_SCAN_MOD / HUB75_RGB_COLOR_CHANNELS_IN_PARALLEL)
#define ROW_PAIR_OFFSET (CONVERT_PANELTYPE_TO_MATRIXROWPAIROFFSET(panelType))
#define MULTI_ROW_REFRESH_REQUIRED (PHYSICAL_ROWS_PER_REFRESH_ROW > 1)
#define PIXELS_PER_LATCH ((matrixWidth * matrixHeight) / MATRIX_PANEL_HEIGHT * PHYSICAL_ROWS_PER_REFRESH_ROW)
#define SM_HUB75_OPTIONS_NONE 0
#define SM_HUB75_OPTIONS_C_SHAPE_STACKING (1 << 0)
#define SM_HUB75_OPTIONS_BOTTOM_TO_TOP_STACKING (1 << 1)
#define SM_HUB75_OPTIONS_HUB12_MODE (1 << 2)
#define SM_HUB75_OPTIONS_MATRIXCALC_LOWPRIORITY (1 << 3)
#define SM_HUB75_OPTIONS_ESP32_INVERT_CLK (1 << 4)
#define SM_HUB75_OPTIONS_ESP32_CALC_TASK_CORE_1 (1 << 5)
#define SM_HUB75_OPTIONS_FM6126A_RESET_AT_START (1 << 6)
#define SM_HUB75_OPTIONS_T4_CLK_PIN_ALT (1 << 7)
// old naming convention kept for compatibility
#define SMARTMATRIX_OPTIONS_NONE SM_HUB75_OPTIONS_NONE
#define SMARTMATRIX_OPTIONS_C_SHAPE_STACKING SM_HUB75_OPTIONS_C_SHAPE_STACKING
#define SMARTMATRIX_OPTIONS_BOTTOM_TO_TOP_STACKING SM_HUB75_OPTIONS_BOTTOM_TO_TOP_STACKING
#define SMARTMATRIX_OPTIONS_HUB12_MODE SM_HUB75_OPTIONS_HUB12_MODE
#define SMARTMATRIX_OPTIONS_MATRIXCALC_LOWPRIORITY SM_HUB75_OPTIONS_MATRIXCALC_LOWPRIORITY
#define SMARTMATRIX_OPTIONS_ESP32_INVERT_CLK SM_HUB75_OPTIONS_ESP32_INVERT_CLK
#define SMARTMATRIX_OPTIONS_ESP32_CALC_TASK_CORE_1 SM_HUB75_OPTIONS_ESP32_CALC_TASK_CORE_1
#define SMARTMATRIX_OPTIONS_FM6126A_RESET_AT_START SM_HUB75_OPTIONS_FM6126A_RESET_AT_START
#define SMARTMATRIX_OPTIONS_T4_CLK_PIN_ALT SM_HUB75_OPTIONS_T4_CLK_PIN_ALT
// defines data bit order from bit 0-7, four times to fit in uint32_t
#define PACKED_HUB75_WORD_ORDER p0r1:1, p0g1:1, p0b1:1, p0r2:1, p0g2:1, p0b2:1, p1r1:1, p1g1:1, \
p1b1:1, p1r2:1, p1g2:1, p1b2:1, p2r1:1, p2g1:1, p2b1:1, p2r2:1, \
p2g2:1, p2b2:1, p3r1:1, p3g1:1, p3b1:1, p3r2:1, p3g2:1, p3b2:1
#endif
MatrixPanelMaps.cpp:
/*
* SmartMatrix Library - Matrix Panel Map Definitions
*
* Copyright (c) 2020 Louis Beaudoin (Pixelmatix)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "MatrixCommonHub75.h"
#include "MatrixPanelMaps.h"
// use this for all linear panels (e.g. panels that draw a single left-to-right line for each RGB channel)
const PanelMappingEntry defaultPanelMap[] =
{
{0, 0, DEFAULT_PANEL_WIDTH_FOR_LINEAR_PANELS},
{0, 0, 0} // last entry is all zeros
};
const PanelMappingEntry panelMap32x16Mod2[] =
{
{0, 71, -8},
{0, 87, -8},
{0, 103, -8},
{0, 119, -8},
{2, 72, 8},
{2, 88, 8},
{2, 104, 8},
{2, 120, 8},
{4, 7, -8},
{4, 23, -8},
{4, 39, -8},
{4, 55, -8},
{6, 8, 8},
{6, 24, 8},
{6, 40, 8},
{6, 56, 8},
{0, 0, 0} // last entry is all zeros
};
const PanelMappingEntry panelMapHub12_32x16Mod4[] =
{
{0, 24, 8},
{0, 56, 8},
{0, 88, 8},
{0, 120, 8},
{4, 16, 8},
{4, 48, 8},
{4, 80, 8},
{4, 112, 8},
{8, 8, 8},
{8, 40, 8},
{8, 72, 8},
{8, 104, 8},
{12, 0, 8},
{12, 32, 8},
{12, 64, 8},
{12, 96, 8},
{0, 0, 0} // last entry is all zeros
};
const PanelMappingEntry panelMap32x16Mod4[] =
{
{0, 0, 8},
{0, 16, 8},
{0, 32, 8},
{0, 48, 8},
{4, 8, 8},
{4, 24, 8},
{4, 40, 8},
{4, 56, 8},
{0, 0, 0} // last entry is all zeros
};
const PanelMappingEntry panelMap32x16Mod4V2[] =
{
{0, 15, -8},
{0, 31, -8},
{0, 47, -8},
{0, 63, -8},
{4, 0, 8},
{4, 16, 8},
{4, 32, 8},
{4, 48, 8},
{0, 0, 0} // last entry is all zeros
};
const PanelMappingEntry panelMap64x32Mod8[] =
{
{0, 64, 64},
{8, 0, 64},
{0, 0, 0} // last entry is all zeros
};
const PanelMappingEntry panelMap64x64Mod16[] =
{
{0,64,64},
{16,0,64},
{0,0,0}
};
const PanelMappingEntry panelMap32x16Mod4V11[] =
{
{0, 7, -8},
{0, 23, -8},
{0, 39, -8},
{0, 55, -8},
{4, 8, 8},
{4, 24, 8},
{4, 40, 8},
{4, 56, 8},
{0, 0, 0} // last entry is all zeros
};
//const PanelMappingEntry panelMap32x16Mod4V11[] =
//{
// {0, 8, -8},
// {0, 24, -8},
// {0, 40, -8},
// {0, 56, -8},
// {4, 9, 8},
// {4, 25, 8},
// {4, 41, 8},
// {4, 57, 7},
// {4, 0, 1},
// {0, 0, 0} // last entry is all zeros
//};
const PanelMappingEntry * getMultiRowRefreshPanelMap(unsigned char panelType) {
switch(panelType) {
case SMARTMATRIX_HUB75_64ROW_64COL_MOD16SCAN:
return panelMap64x64Mod16;
case SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN:
return panelMap64x32Mod8;
case SMARTMATRIX_HUB75_16ROW_32COL_MOD2SCAN:
return panelMap32x16Mod2;
case SMARTMATRIX_HUB12_16ROW_32COL_MOD4SCAN:
return panelMapHub12_32x16Mod4;
case SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN:
return panelMap32x16Mod4;
case SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V2:
return panelMap32x16Mod4V2;
case SMARTMATRIX_HUB75_16ROW_32COL_MOD4SCAN_V11:
return panelMap32x16Mod4V11;
default:
return defaultPanelMap;
}
}
I think that should be it.