Error adding new update code

I’m having a little trouble adding an lcd update routine to the exisiting pokitto lib.
for some reason I’m getting


Pokkitris\main.cpp|581|error: 'class Pokitto::Display' has no member named 'updateRegion'|

When trying to implement my additional code.


extern void lcdRefreshRegionMode1(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t *, uint16_t*);


void Pokitto::lcdRefreshRegionMode1(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t * scrbuf, uint16_t* paletteptr) {

	setWindow(y0, x0, y1-1, x1-1);


    uint8_t pix;
    uint8_t quartWide=(x1-x0)/4; // 220/4;
    uint8_t pic;
    for(int y=y0; y<y1; y++){
        for(int x=x0; x<x0+quartWide; x++){
            pic = scrbuf[x+quartWide*y];
            pix = (pic >> 6)&3; write_data(paletteptr[pix]);
            pix = (pic >> 4)&3; write_data(paletteptr[pix]);
            pix = (pic >> 2)&3; write_data(paletteptr[pix]);
            pix = pic &3;       write_data(paletteptr[pix]);


/** Send display buffer region to display hardware */
static void updateRegion(uint16_t,uint16_t,uint16_t,uint16_t);


void Display::updateRegion(int16_t x, int16_t y,int16_t x2, int16_t y2){
    lcdRefreshRegionMode1(x0, x1, y0, y1, m_scrbuf, paletteptr);

Can someone explain where I went wrong? As far as I can tell I have added the correct code to the correct classes etc.

So you can build PokittoLib successfully but building your own app fails?

  • Are you sure your app is using the same PokittonDisplay.h? Try to make some intentional error to PokittoDisplay.h to see if it is really used.

  • Or when building PokittoLib, try to put some intentional error to updateRegion() implementation to see if it really gets compiled

Simple: your function parameters are not the same

In declaration you go uint16_t, and in your call you got int16_t

1 Like

It’s also worth noting that you marked updateRegion as static but you’re trying to call it like a member function.
That will work, but static functions are typically called like so: Display::updateRegion(0, 0, 219, 175).

Also I’m pretty sure that extern isn’t needed.

I’m also getting the error without calling it.
Also I changed everything to int16_t and that didn’t fix anything.

1 Like

Without access to your actual project, very difficult to say. It can be anything from a simple typo to declaration outside of curved braces. Please make a github account or similar, if I could run the project thru embitz myself, its clear in <5 min.

Edit: I will help you out if you need. You are making valuable additions to the code, I would like you to work on the same codebase in order to be able to use that code

1 Like

Weirdly it seems to be working online. I don’t know if I fixed it while copy+pasting it, or if maybe the offline compiler is more strict about something.

Well, that’s just weird. I exported the code from the online compiler so I could compile it offline and the error is back.

i will do the same to see it myself

are you 100% sure embitz is not looking at a different PokittoDisplay.h in another directory? because thats what it sounds like

EDIT: just checked your code on mbed.

The only possible cause is your embitz project search directories are pointing to another place. You think you are editing the right header file but the project is reading another file

How do I tell?

Right click the Pokitto::Display class and choose “show decaration”. See that you end up in the header file you thought you should (right click filename tab and choose “show in folder”)

1 Like

I see you have 2 targets: sensitive and pokittris. Any chance you’ve duplicated the header files?

Also: please start keeping a github git repo (or bitbucket if u want a private repo). Solving something like this would be a 2 min job if I could open up the exact project.

1 Like