_bufferSize is the length of the graphics buffer, in my case 5808 bytes (176*264/8).
So the code is this (inside a lot more code):
IL91874.prototype.grfxBlackWhite = function () {
var _display = this;
var g = Graphics.createArrayBuffer(
this.display.displaySizeX,
this.display.displaySizeY,
this.display.bpp,
{msb: true}
);
g.clear = function(clearColor){
new Uint8Array(this.buffer).fill(clearColor);print(this);
};
g.flip = function(callback){
//this does not work
_display.wCmd(_display.display.CMD.DATA_START_TRANSMISSION_1);
_display.wData(this.buffer);
//this works
//_display.wCmd(_display.display.CMD.DATA_START_TRANSMISSION_1);
//for (let i=0;i<this.buffer.length;i++) _display.wData(this.buffer[i]);
_display.waitBusy(callback);
};
return g;
};
IL91874.prototype.wCmd = function (command) {
digitalWrite(this.dcPin, 0);
this.spi.write(command, this.cs1Pin);
};
IL91874.prototype.wData = function (data) {
digitalWrite(this.dcPin, 1);
this.spi.write(data, this.cs1Pin);
};
So what it does is, when flip is called, transmit the buffer data to the papers ram.
It is actually only a modification of the SSD1606 module code. In there the flip function it does exactly the same: transmit the buffer data via SPI as an Uint8Array (as I just learned, more a view to the buffer?).
Maybe that's the problem? I'm assuming that what works in the example code also would work in my case.
Otherwise I can only think of a problem in transmitting speed. I played around with the SPI baud rate (set it lower) but to no avail.
I mean, the code does work, but writing 2 buffers (one for red, one for black) takes about 3.5s each + the 15s update cycle of the paper. I think there is potential for speeding up things.
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.
_bufferSize is the length of the graphics buffer, in my case 5808 bytes (176*264/8).
So the code is this (inside a lot more code):
So what it does is, when flip is called, transmit the buffer data to the papers ram.
It is actually only a modification of the SSD1606 module code. In there the flip function it does exactly the same: transmit the buffer data via SPI as an Uint8Array (as I just learned, more a view to the buffer?).
Maybe that's the problem? I'm assuming that what works in the example code also would work in my case.
Otherwise I can only think of a problem in transmitting speed. I played around with the SPI baud rate (set it lower) but to no avail.
I mean, the code does work, but writing 2 buffers (one for red, one for black) takes about 3.5s each + the 15s update cycle of the paper. I think there is potential for speeding up things.