I still get an error when trying to copy the buffer even when there is output data in it? Here is the full test code.
// Set up matrix
SPI2.setup({baud:3200000, mosi:B15});
var m = Graphics.createArrayBuffer(16,8,24,{zigzag:true});
m.flip = function(){ SPI2.send4bit(m.buffer, 0b0001, 0b0011); };
m.setRotation(1); // Rotate board 90degs
var mCopy = Graphics.createArrayBuffer(16,8,24,{zigzag:true});
m.setColor(0.3, 0.5, 0.7);
m.setPixel(0,0);
m.setPixel(4,4);
m.flip();
// Save copy
mCopy.buffer.set(m.buffer);
// Clear matrix
m.clear();
m.flip();
// copy it back
m.buffer.set(mCopy.buffer);
m.flip();
Uncaught Error: Field or method does not already exist, and can't create it on ArrayBuffer
at line 1 col 13
mCopy.buffer.set(m.buffer);
^
at line 1 col 9
m.buffer.set(mCopy.buffer);
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.
I still get an error when trying to copy the buffer even when there is output data in it? Here is the full test code.