You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • @Gordon,
    I've added a function to read screendata. This data is given as 3 bytes for r/g/b.
    Colourdata for writing is a word (5 bit for red, 6 bits for green and 5 for blue).
    Reading data is done this way.

    ....    
    sData = new Uint16Array(cnt);  //cnt is number of pixels to be read
    writeCMD(0x2E);    //read memory command
        dc.write(1);
        spi.send(z);    //z is any value, this needs to be sent for unknown reason
        for(var i = 0; i < cnt; i++){ 
          r = spi.send(z)>>3;g = spi.send(z)>>2; b = spi.send(z)>>3; //read 3 bytes for 3 colours
          sData[i] = (r<<11) + (g<<5) + b;
        }
        ce.write(1);
        return sData;       
    
    

    Data should have same format as for writing. I could switch upper and lower byte, thats correct. Any suggestion, how to do that ? May be a short assembler is best solution ?
    BTW, reading data this way is very slow, any suggestion to do better ?

About

Avatar for JumJum @JumJum started