6 years, 9 months ago.

RA8875 Layers mode

I am using the RA8875 library: https://developer.mbed.org/components/RA8875-Based-Display/

I am trying to use the layers but it doesnt seem to work and I suspect it is because i need this: lcd.SetLayerMode(TransparentMode); but i havent a clue what to put in the brackets, it doesnt accept int, any idea what is to be put in there?

What I am aiming to achive is on layer 0 is normal sized text and on layer 1 to have larger text.

This is what I have tried so far:

            lcd.printf("Nicks LCD\r\n");
            lcd.printf("(%3d,%3d)", p.x, p.y);

Have I missed something? any help appreciated.


1 Answer

6 years, 9 months ago.

Hi Nick,

The function you mentioned accepts an enum which has the following possible values:

    typedef enum
        ShowLayer0,         ///< Only layer 0 is visible, layer 1 is hidden (default)
        ShowLayer1,         ///< Only layer 1 is visible, layer 0 is hidden
        LightenOverlay,     ///< Lighten-overlay mode
        TransparentMode,    ///< Transparent mode
        BooleanOR,          ///< Boolean OR mode
        BooleanAND,         ///< Boolean AND mode
        FloatingWindow      ///< Floating Window mode
    } LayerMode_T;

I haven't used this screen before, but from what you described I think you might want to set it to BooleanOR.

Accepted Answer

How would you use it? It wont accept the name in the brackets

posted by Nick Oliver 21 Apr 2015

I'm pretty sure you have to refer to it as RA8875::BooleanOR. Is that how you're using it?

posted by Brian Daniels 21 Apr 2015

Yes it worked, I used TransparentMode and got what I expected. Thanks. This is probably meant to be in another question but do you know how to set the font size different on each layer?

posted by Nick Oliver 21 Apr 2015

It looks like there's a function called "SetTextFontSize" in RA8875.h. I would look through that file, it has some documentation on all of the available functions

posted by Brian Daniels 21 Apr 2015

I have question about the layers. I would like to draw an image on layer 0, print another on layer 1 and then swab between both layers. I would like to see the image imediatly. Something like this seems not to work. Can someone help me?

"/local/Test1.bmp", "/local/Test2.bmp", "/local/Test3.bmp", "/local/Test4.bmp" lcd.SelectDrawingLayer(0); lcd.SetLayerMode(RA8875::ShowLayer0); r = lcd.RenderBitmapFile(0,0, files[0]); print .bmp on the screeb lcd.SelectDrawingLayer(1); select drawing layer 1 r = lcd.RenderBitmapFile(0,0, files[1]); print .bmp on layer 1 wait(5); wait lcd.SetLayerMode(RA8875::ShowLayer1); / show layer 1

posted by peter staelens 01 Feb 2016

Peter, your question might be best as a new question -

I didn't compile this, but something like this may get you going if you haven't solved it.

const char * files[] = {
    "/local/Test1.bmp", "/local/Test2.bmp", "/local/Test3.bmp", "/local/Test4.bmp"
const int count = sizeof(files)/sizeof(files[0]);    // '4', based on the list above.
int layer = 0;

while (1) {
    lcd.SelectDrawingLayer(layer & 1);               // alternate layers
    lcd.SetLayerMode( (layer & 1) ? RA8875::ShowLayer1 : RA8875::ShowLayer0); 
    r = lcd.RenderBitmapFile(0,0, files[layer]);     // this command takes a while
    layer = (layer + 1) % count;                     // circulate 0, 1, 2, 3, 0, ...
    wait(5);                                         // time per image is 5 + time to load the next bitmap
posted by David Smart 14 Mar 2016