Got a P5 64x64 panel with fm6126 chip and a ESP32 .
Is is now running Espruino with @JumJum code after some small changes.
/* jshint esversion: 6 */ var P_A = D19, P_B = D23, P_C = D18, P_D = D5, P_E = D15, P_R1 = D13, P_R2 = D27, P_G1 = D21, P_G2 = D17, P_B1 = D12, P_B2 = D4, P_LAT = D22, P_OE = D2, P_CLK = D14, MaxLed = 256, X = 64, Y = 64; var BLACK = 0, RED = 1, BLUE = 2, MAGENTA = 3, GREEN = 4, YELLOW = 5, TUTQUOISE = 6, // .... WHITE = 15; function Led64x64() { var me = this; var Pen; //pin Enable var sfnc, dfnc; // bound functions to shift data and set address var ledBuf; //graphics.buffer for LED var arr; //array of drawing functions var boardDur; //refresh time for panel in mS var tmr; //interval timer for refresh me.init = function() { initFM6126(); initPins(P_R1, P_R2, P_B1, P_B2, P_G1, P_G2, P_A, P_B, P_C, P_D, P_E, P_LAT, P_CLK, P_OE); boarDur = 20; return initGraphic(); }; me.stop = function() { if (tmr) clearInterval(tmr); }; me.start = function() { tmr = setInterval(function() { sfnc(arr); }, boardDur); }; me.clear = function(c) { clearInterval(); grf.setBgColor(0); grf.clear(); }; function initFM6126() { var C12 = [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; var C13 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]; digitalWrite([P_OE, P_LAT, P_CLK], 0b100); // Send Data to control register 11 for (var l = 0; l < MaxLed; l++) { y = l % 16; if (C12[y]) { digitalWrite([P_R1, P_G1, P_B1, P_R2, P_B2, P_G2], 0b111111); } else { digitalWrite([P_R1, P_G1, P_B1, P_R2, P_B2, P_G2], 0); } digitalWrite(P_LAT, (l > MaxLed - 12) ? 1 : 0); digitalWrite(P_CLK, 1); digitalWrite(P_CLK, 0); } digitalWrite(P_LAT, 0); digitalWrite(P_CLK, 0); // Send Data to control register 12 for (l = 0; l < MaxLed; l++) { y = l % 16; if (C13[y]) { digitalWrite([P_R1, P_G1, P_B1, P_R2, P_B2, P_G2], 0b111111); } else { digitalWrite([P_R1, P_G1, P_B1, P_R2, P_B2, P_G2], 0); } digitalWrite(P_LAT, (l > MaxLed - 13) ? 1 : 0); digitalWrite(P_CLK, 1); digitalWrite(P_CLK, 0); } digitalWrite(P_LAT, 0); digitalWrite(P_CLK, 0); } function initPins(R1, R2, B1, B2, G1, G2, A, B, C, D, E, Latch, Clock, Enable) { Pen = Enable; sfnc = shiftOut.bind(null, [R2, G2, B2, undefined, R1, G1, B1], { clk: Clock }); dfnc = digitalWrite.bind(null, [Enable, Latch, Latch, E, D, C, B, A, Enable]); } function initGraphic() { gr = Graphics.createArrayBuffer(X, Y, 4, { interleavex: true }); ledBuf = gr.buffer; createFuncArr(); return gr; } function createFuncArr() { arr = []; arr.push({ callback: Pen.reset.bind(Pen) }); for (i = 0; i < 32; i++) { arr.push(new Uint8Array(ledBuf, i * X, Y)); arr.push({ callback: dfnc.bind(null, 65 | i << 1) }); } arr.push({ callback: Pen.set.bind(Pen) }); } } test = function() { setInterval(function() { grf.setColor(Math.random() * 10); grf.fillPoly([Math.random() * 63, Math.random() * 63, Math.random() * 63, Math.random() * 63, Math.random() * 63, Math.random() * 63 ], true); grf.setColor(0xffff); grf.setFont("6x8", 2).drawString(times, 0, 0, true); times++; }, 1E3); lf.start(); }; var lf = new Led64x64(); var grf = lf.init(); var times = 0; setTimeout(test, 1E3);
If you watch the video you will immediately figure that refresh is too slow to have a stable picture.
Any idea how to improve speed?
Could i2s be the kicker?
Have to try this code with a original Espruino board, hopefully it is faster.
https://youtu.be/ontmWG33XVA
@MaBe started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Got a P5 64x64 panel with fm6126 chip and a ESP32 .
Is is now running Espruino with @JumJum code after some small changes.
If you watch the video you will immediately figure that refresh is too slow to have a stable picture.
Any idea how to improve speed?
Could i2s be the kicker?
Have to try this code with a original Espruino board, hopefully it is faster.
https://youtu.be/ontmWG33XVA