7 years, 11 months ago.

Sharp Memory Colour LCD

I'm trying to use my existing library to work the colour Memory LCD, but got a bit stuck. Not sure whether it is possible to change the code below or to try a different approach.

The problem is I need to set three bits to generate the colours Red, Green, Blue. The mono displays only have one bit to set.

The display is arranged as 128 x128 pixels, however the x range is three times this (384) to accommodate the three colour bits.

single bit code snip

// Existing Color definitions for mono
#define White			0xFF
#define Black			0X00

// Color definitions for colour bits
//#define Black         0x00
#define Blue			0X01
#define Green			0X02
#define Cyan			0X03
#define Red				0X04
#define Magenta			0X05
#define Yellow			0X06
//#define White			0X07


void SharpLCD::pixel(uint16_t x, uint16_t y, uint8_t colour) {
    uint8_t swapx = 7 - ((uint16_t)x & 0x07);
	    x = ((uint16_t)x & 0xFFF8) | swapx;
	    // determine if row has pixel changes
	    bool change = ((pixelBuffer[((y * DISPLAY_WIDTH) + x) / DISPLAY_BUFFER_TYPE_SIZE] & (1 << (x % DISPLAY_BUFFER_TYPE_SIZE)))
	    		   != ((colour & 0x01) << (x % DISPLAY_BUFFER_TYPE_SIZE)));
		if(change) {
            // xor operation
            pixelBuffer[((y * DISPLAY_WIDTH) + x) / DISPLAY_BUFFER_TYPE_SIZE] ^= (1 << (x % DISPLAY_BUFFER_TYPE_SIZE));
            // update pixel change status of this line
            RowState[y / DISPLAY_BUFFER_TYPE_SIZE] |= (1 << (y % DISPLAY_BUFFER_TYPE_SIZE));
		}
}

I have got the display working by setting the x (display width) to 384, displays black/white characters and graphics but they are a third of the width they should be. I have seen an example video of the display working on the net (Arduino), but can't find any code examples.

Any help would be appreciated.

Many thanks

Paul

1 Answer

7 years, 11 months ago.

Data sheet?

found this link

https://github.com/pkourany/Adafruit_SharpMem

The main difference between the monochrome and color displays is the bit-packing that is required since now 1 pixel = 3 bits. So each line is 48bytes (128 3-bit pixels). The only trick is now the 3-bit boundaries don't match up with byte boundaries. No biggy but just a pain. A fully buffered screen will need 6,144bytes of RAM