Start testing output on Adafruit Matrix Portal S3

This commit is contained in:
Will Tatam
2024-01-12 23:26:42 +00:00
parent aae9b62a00
commit 308812875b
3 changed files with 75 additions and 6 deletions

View File

@@ -2162,3 +2162,27 @@ build_flags = ${esp32_4MB_V4_S_base.build_flags}
; RAM: [=== ] 25.4% (used 83144 bytes from 327680 bytes)
; Flash: [==========] 96.4% (used 1516029 bytes from 1572864 bytes)
;
[env:adafruit_matrixportal_esp32s3]
platform = espressif32 ; latest
board = adafruit_matrixportal_esp32s3
extends = esp32_4MB_V4_M_base
build_unflags = ${env:esp32S3_8MB_M.build_unflags} ;; use the same as "normal" S3 buildenv
build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
${common_mm.build_flags_S}
-D WLED_RELEASE_NAME=matrixportal_esp32s3
-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode
-D WLED_DISABLE_ADALIGHT ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
${common_mm.animartrix_build_flags}
-D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
-D WLED_DISABLE_LOXONE ; FLASH 1272 bytes
-D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes
-D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes
-D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes
-D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
-D WLED_DEBUG
; -D SR_DEBUG
; -D MIC_LOGGER
-D WLED_ENABLE_SMARTMATRIX -D NO_GFX
-D DEFAULT_LED_TYPE=60

View File

@@ -464,6 +464,41 @@ void BusNetwork::cleanup() {
BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) {
mxconfig.double_buff = false; // <------------- Turn on double buffer
mxconfig.mx_width = 32;
mxconfig.mx_height = 32;
/*
Matrix SS Portal
uint8_t rgbPins[] = {42, 41, 40, 38, 39, 37};
uint8_t addrPins[] = {45, 36, 48, 35, 21};
uint8_t clockPin = 2;
uint8_t latchPin = 47;
uint8_t oePin = 14;
*/
#if defined(ARDUINO_ADAFRUIT_MATRIXPORTAL_ESP32S3) // MatrixPortal ESP32-S3
USER_PRINTLN("MatrixPanel_I2S_DMA - Martrix Poral S3 config");
mxconfig.gpio.r1 = 42;
mxconfig.gpio.g1 = 41;
mxconfig.gpio.b1 = 40;
mxconfig.gpio.r2 = 38;
mxconfig.gpio.g2 = 39;
mxconfig.gpio.b2 = 37;
mxconfig.gpio.lat = 47;
mxconfig.gpio.oe = 14;
mxconfig.gpio.clk = 2;
mxconfig.gpio.a = 45;
mxconfig.gpio.b = 36;
mxconfig.gpio.c = 48;
mxconfig.gpio.d = 35;
mxconfig.gpio.e = 21;
#else
/*
#define R1_PIN GPIO_NUM_2
#define G1_PIN GPIO_NUM_15
@@ -483,10 +518,7 @@ BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
#define CLK_PIN GPIO_NUM_22
*/
HUB75_I2S_CFG mxconfig;
mxconfig.double_buff = false; // <------------- Turn on double buffer
mxconfig.mx_width = 64;
mxconfig.mx_height = 64;
USER_PRINTLN("MatrixPanel_I2S_DMA - ESP32 config");
mxconfig.gpio.r1 = 2;
mxconfig.gpio.g1 = 15;
@@ -505,6 +537,8 @@ BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
mxconfig.gpio.d = 21;
mxconfig.gpio.e = 12;
#endif
this->_len = (mxconfig.mx_width * mxconfig.mx_height);
USER_PRINTLN("MatrixPanel_I2S_DMA config");
@@ -514,20 +548,30 @@ BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
USER_PRINTLN("MatrixPanel_I2S_DMA created");
// let's adjust default brightness
display->setBrightness8(125); // range is 0-255, 0 - 0%, 255 - 100%
display->setBrightness8(25); // range is 0-255, 0 - 0%, 255 - 100%
// Allocate memory and start DMA display
if( not display->begin() ) {
Serial.println("****** !KABOOM! I2S memory allocation failed ***********");
}
USER_PRINTLN("MatrixPanel_I2S_DMA started");
}
void BusSmartMatrix::setPixelColor(uint16_t pix, uint32_t c) {
uint8_t r = R(c);
uint8_t g = G(c);
uint8_t b = B(c);
display->drawPixelRGB888(1, 1, r, g, b);
uint8_t x = pix % mxconfig.mx_width;
uint8_t y = floor(pix / mxconfig.mx_width);
// display->drawPixelRGB888(x, y, r, g, b);
display->drawPixelRGB888(1, 31, 0, 255, 0 );
display->drawPixelRGB888(31, 31, 255, 0, 0 );
display->drawPixelRGB888(1, 31, 0, 0, 255 );
}
void BusSmartMatrix::setBrightness(uint8_t b, bool immediate) {

View File

@@ -369,6 +369,7 @@ class BusSmartMatrix : public Bus {
private:
MatrixPanel_I2S_DMA *display = nullptr;
HUB75_I2S_CFG mxconfig;
};
#endif