update function and pgmspace errors

Understanding the language, error messages, etc.

update function and pgmspace errors

Postby Duhjoker » Mon Oct 24, 2016 6:12 am

ok so im almost live with the gamebuino andvanced prototype library. I managed to get the drawbitmap and tilemap functions done. I just needed the one drawbitmap command with the dx and all that in it then I had to go through gamebuino .h and commented out all the set color commands and then had to update all the draw commands to the color functions and blah blah blah.

im having a couple problems though. the update function in the display files use the pcd8544 stuff and I cant figure out if I can use it eith my screen.

also im getting a bunch of errors to the sound.cpp file that I cant figure out.

Code: Select all
Arduino: 1.6.11 (Windows 7), TD: 1.30-beta3, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz optimize speed (overclock), US English"

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp: In member function 'void Display::drawBitmap(int8_t, int8_t, int8_t, int8_t, const uint8_t*, uint8_t, uint8_t, uint8_t, uint8_t, uint16_t)':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp:681:9: warning: unused variable 'largest' [-Wunused-variable]

  int8_t largest = 0;

         ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp:682:9: warning: unused variable 'largesty' [-Wunused-variable]

  int8_t largesty = 0;

         ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp: In member function 'void Display::drawBitmap1(int16_t, int16_t, const uint8_t*, int16_t, int16_t, uint16_t)':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp:594:27: warning: 'byte' may be used uninitialized in this function [-Wmaybe-uninitialized]

       if(i & 7) byte <<= 1;

                           ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp: In member function 'void Display::drawBitmap2(int16_t, int16_t, const uint8_t*, int16_t, int16_t, uint16_t, uint16_t)':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp:614:27: warning: 'byte' may be used uninitialized in this function [-Wmaybe-uninitialized]

       if(i & 7) byte <<= 1;

                           ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp: In member function 'void Display::drawBitmap3(int16_t, int16_t, uint8_t*, int16_t, int16_t, uint16_t)':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp:632:27: warning: 'byte' may be used uninitialized in this function [-Wmaybe-uninitialized]

       if(i & 7) byte <<= 1;

                           ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp: In member function 'void Display::drawBitmap4(int16_t, int16_t, uint8_t*, int16_t, int16_t, uint16_t, uint16_t)':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp:649:27: warning: 'byte' may be used uninitialized in this function [-Wmaybe-uninitialized]

       if(i & 7) byte <<= 1;

                           ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp: In member function 'void Display::drawXBitmap(int16_t, int16_t, const uint8_t*, int16_t, int16_t, uint16_t)':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\DisplayRGB.cpp:669:27: warning: 'byte' may be used uninitialized in this function [-Wmaybe-uninitialized]

       if(i & 7) byte >>= 1;

                           ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp: In member function 'boolean Gamebuino::update()':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp:187:12: error: 'class Display' has no member named 'update'

    display.update(); //send the buffer to the screen

            ^

In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:11:0,

                 from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Arduino.h:1,

                 from C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.h:23,

                 from C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp:21:

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp: In member function 'int8_t Gamebuino::menu(const char* const*, uint8_t)':

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:80:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

 #define pgm_read_word(addr) (*(const unsigned short *)(addr))

                                                             ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp:282:49: note: in expansion of macro 'pgm_read_word'

     display.println((const __FlashStringHelper*)pgm_read_word(items+i));

                                                 ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp: In member function 'void Gamebuino::changeGame()':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp:517:10: error: 'class Display' has no member named 'update'

  display.update();

          ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp:523:10: error: 'class Display' has no member named 'update'

  display.update();

          ^

Error compiling for board Teensy 3.2 / 3.1.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.



for now can we deal with these errors first?
Last edited by Duhjoker on Sat Oct 29, 2016 9:33 am, edited 1 time in total.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: update function and pgmspace errors

Postby rodot » Mon Oct 24, 2016 6:59 am

Most of these are only warning, the error which prevents you from compiling is the first one when you read from top to bottom. In your case :

Code: Select all
C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Gamebuino.cpp:187:12: error: 'class Display' has no member named 'update'

    display.update(); //send the buffer to the screen
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: update function and pgmspace errors

Postby Duhjoker » Mon Oct 24, 2016 11:40 pm

I was just reading the reference for the gb.display.update since I was having a problem with it and now I see that I don't really needed it.

But what do I do about the pgm_space error. I've looked at both the arduino version and the teensy version of the file pgmspace and they are nearly identical with the teensy version having a few more defines. All the same int and uint values are there.

Also what amount of memory should I allocate for the buffer. It's set at 512 but I could get away with as much as say 2048B or 2 KB.

here are sound errors. can I please get some help with the pgm space stuff
Code: Select all
Arduino: 1.6.11 (Windows 7), TD: 1.30-beta3, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz optimize speed (overclock), US English"

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp: In member function 'void Sound::begin()':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:62:2: error: 'TCCR2B' was not declared in this scope

  TCCR2B = (TCCR2B & B11111000) | 1; //set timer 2 prescaler to 1 -> 30kHz PWM on pin 3

  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:66:2: error: 'TCCR1A' was not declared in this scope

  TCCR1A = 0;

  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:67:2: error: 'TCCR1B' was not declared in this scope

  TCCR1B = 0;

  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:68:2: error: 'TCNT1' was not declared in this scope

  TCNT1 = 0;

  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:70:2: error: 'OCR1A' was not declared in this scope

  OCR1A = 280; // compare match register

  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:71:18: error: 'WGM12' was not declared in this scope

  TCCR1B |= (1 << WGM12); // CTC mode

                  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:72:18: error: 'CS10' was not declared in this scope

  TCCR1B |= (1 << CS10); // 1 prescaler

                  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:73:2: error: 'TIMSK1' was not declared in this scope

  TIMSK1 |= (1 << OCIE1A); // enable timer compare interrupt

  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:73:18: error: 'OCIE1A' was not declared in this scope

  TIMSK1 |= (1 << OCIE1A); // enable timer compare interrupt

                  ^

In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:11:0,

                 from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Arduino.h:1,

                 from C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.h:23,

                 from C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:20:

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp: In member function 'void Sound::updateTrack(uint8_t)':

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:80:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

 #define pgm_read_word(addr) (*(const unsigned short *)(addr))

                                                             ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:124:32: note: in expansion of macro 'pgm_read_word'

   playPattern((const uint16_t*)pgm_read_word(&(patternSet[channel][patternID])), channel);

                                ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp: In member function 'void Sound::command(uint8_t, uint8_t, int8_t, uint8_t)':

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:80:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

 #define pgm_read_word(addr) (*(const unsigned short *)(addr))

                                                             ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:278:34: note: in expansion of macro 'pgm_read_word'

   instrumentData[i] = (uint16_t*)pgm_read_word(&(instrumentSet[i][X]));

                                  ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp: At global scope:

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:456:4: error: expected constructor, destructor, or type conversion before '(' token

 ISR(TIMER1_COMPA_vect){ // timer compare interrupt service routine

    ^

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp: In static member function 'static void Sound::updateOutput()':

C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolorMAIN\Sound.cpp:564:2: error: 'OCR2B' was not declared in this scope

  OCR2B = output; //60x faster than analogOutput() !

  ^

Error compiling for board Teensy 3.2 / 3.1.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: update function and pgmspace errors

Postby rodot » Tue Oct 25, 2016 12:03 pm

The sound won't work because it directly access registers of the atmea328, like TCCR2B or TCCR1A, as the error messages says.
You'd better disable sound at least for now, this library is a bit complicated as it uses registers, interruptions, pointers etc.
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: update function and pgmspace errors

Postby Duhjoker » Thu Oct 27, 2016 3:47 am

Ok well the Gamebuino Advanced Prototype is almost live!!!!!!!!!!

I feel kind of stupid. See for some reason I had <AVR/pgmspace> removed from the Gamebuino.h file so it wasn't including the right companion software.

Soooo that means I can compile the Gamebuino, DisplayRGB, buttons and battery with no problems. Whether it can compile an actual game is yet to be seen as now I still have to finish my hardware.

In the meantime I need to add buttons to the buttons get the back light file to work and finally sound. Plus a set color command. That one seems to be a lil persnickety and driving me nuts.

Edit::: 01:11MT ok I fixed the set color function I just made it simply setColor(uint16_t color) now all the setColor commands will work with just the name of the color setColor(GREEN).

I also replaced button c with button X and added Y, L,R,S(start) and T(select). Had to change the BTN_C commands in the menu function to T for now until I can look at it right and streamline line it a lil. So twelve total buttons ABXY LRUD LRselectstart. Gonna try to fix the backlight file to work now.

01:55MT how exactly do I work with the backlight file. My screens display file included only one backlight command.....

setBacklight(uint8_t pmw)

Void display::setBacklight(uint8_t pmw)
{
(this->pmw, pmw);
}

02:40MT ok just fixed the backlight file. Had to take a look at both the 5110 library and gamebuinos to figure it out. But it was as easy as changing set in the .h to setbacklight and every where else it's needed.

So now it's sound.

Ok sound.......

The only problem I'm having is with the timers. Don't suppose I could get a some help with this. Is there a way to include the file into my source that those timers belong to?
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 14 guests

cron