constant values in custom header file

Hi,

What is the proper way to define constnat values in a header file?

#ifndef Pictures_h
#define Pictures_h

#include "Arduino.h"

class Pictures
{
public:

static const unsigned char PROGMEM splashScreen[];

};


#endif

I would like to move this from my main file to a header:

static const unsigned char PROGMEM splashScreen[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x20, 0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87, 0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87, 0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x20, 0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

keninger:
I would like to move this from my main file to a header:

Why?

(The code you posted will fail to link.)

Takes up too much space and it is harder to read the code

Pictures.cpp seems like a good place for a constant declared in Pictures.h.

Why not in Pictures.cpp? Why is "to a header" so important?

It is not important to be in a header, I am just not familiar with C++ and had no idea what is the way to do it, I used other libraries as templates, could you please help me out what the proper way is to do it?

Do not, never ever, put (large) array values, strings and so on in a header! If you include the header twice from different files these values will also be embedded in the binary twice thus taking up twice the amount of space for no reason. Use extern like this:

//const.h file:

#ifndef CONST_H
#define CONST_H

extern const char MY_STRING[];

#endif //CONST_H

//const.cpp file:

#include "const.h"

const char MY_STRING[] = "Hello World!";

Doing it like this will ensure that the cstring "Hello World!" is only embedded once in the binary no matter how many files include "const.h".

1 Like

Danois90:
Use extern like this:

How well does that work for static class members?

(That is the current topic. Maybe you should have read the original post before replying.)

keninger:
It is not important to be in a header ... could you please help me out what the proper way is to do it?

"In a header" was the only mistake. Create a cpp file that will be included in the build; Pictures.cpp is a good choice. Put the array in that file with two minor changes...

const unsigned char PROGMEM Pictures::splashScreen[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, ...

Note: PROGMEM may have to go last...

const unsigned char Pictures::splashScreen[] PROGMEM =

Thank you! it works, I just didn't have to use static in the .cpp file

Thanks for the help again!

Pictures.h

#ifndef Pictures_H
#define Pictures_H

#include "Arduino.h"

class Pictures{
 public:
 static const unsigned char PROGMEM splashScreen[];
};


#endif

Pictures.cpp

#include "Pictures.h"

const unsigned char PROGMEM Pictures::splashScreen[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ...};

And what can I do if I would like to have multiple images and not want to have a new type for all of them, because in the cpp I only seem to be able assign values to types.

I would like to have two images

class Pictures{
 public:
 
 
 class SplashScreen{
 public :
 static const unsigned char PROGMEM image[];
 static int logoHeight;
 static int logoWidth;
 };
 
 static SplashScreen splashScreen;
 
 
};

Too much static.

You will have to separate the image field storage from the class (that means you will be using a pointer).

I tried to do that, but how do you change the value of that in the cpp file? Because in the cpp it only allows me to change class or namespace values.

keninger:
And what can I do if I would like to have multiple images and not want to have a new type for all of them, because in the cpp I only seem to be able assign values to types.

I would like to have two images

What does that mean? If you want 2 images, then define 2 variables - splashScreen1 and splashScreen2.

Or, do you want an array of Splash Screens? If so, then state your requirements clearly.

Danois90:
Do not, never ever, put (large) array values, strings and so on in a header! If you include the header twice from different files these values will also be embedded in the binary twice

Shouldn't matter because every headerfile should be protected to prevent multiple inclusion, many other
things break if you don't do this.

MarkT:
Shouldn't matter .....

Of course it does. If you define a variable (i.e. allocate storage space), as oppose to declare it (i.e. tell the compiler what type it is), in a header file, then you’ll create an instance of that variable in EVERY source file that includes the header file. This is more than likely not what you intended. Rather, you probably wanted to make a single variable that’s global across multiple source files.

To do that, you declare it ‘extern’ in the header and define it in one (and only one) source file.

It’s the same idea with static members variables of C++ classes. You declare them with the rest of the class in the .h file and define them once (and only once) in the .cpp file.

My header file:

#ifndef Pictures_H
#define Pictures_H

#include "Arduino.h"

class Pictures{
	public:
	
	class Picture{
		public :
		static const unsigned char PROGMEM image[];
		static int logoHeight;
		static int logoWidth;
	};
	
	public : static Picture splashScreen;
	public : static Picture splashScreen2;
	
};

#endif

my cpp file:

#include "Pictures.h"

const unsigned char PROGMEM Pictures::Picture::image[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x20, 0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87, 0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87, 0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x20, 0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

int Pictures::Picture::logoHeight=32;
int Pictures::Picture::logoWidth=128;

and I want to give variables values in the cpp file, like splashScreen.logoWidth and splashScreen2.logoWidth

It's still unclear what you want to do. How about a more complete explanation? While while you're at it, why not write in English -- paragraphs, sentences, punctuation, capitalization, etc?

I would like to have multiple "Pictures" defined in the header file, when in arduino I define :

Pictures pictures;

I will then be able to use the different "pictures" I am trying to set up

drawLogo(pictures.splashScreen.image,pictures.splashScreen.logoWidth,pictures.splashScreen.logoHeight);

drawLogo(pictures.anotherLogo.image,pictures.anotherLogo.logoWidth,pictures.anotherLogo.logoHeight);

Something like this:

Pictures.h:

#ifndef PICTURES_H_
#define PICTURES_H_

#include "Arduino.h"

struct Picture {
  const uint8_t * const image;
  const uint8_t logoHeight;
  const uint8_t logoWidth;
};

extern Picture splashScreen;
extern Picture anotherLogo;

#endif

Pictures.cpp:

#include "Pictures.h"

const uint8_t screen1[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
    0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0,
    0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,
    0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x0C, 0x20, 0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87,
    0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F,
    0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F,
    0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x08, 0x87, 0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x20,
    0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x06, 0x10, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
    0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x01, 0xC0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
    0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

const uint8_t screen2[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
    0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0,
    0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,
    0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x0C, 0x20, 0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87,
    0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F,
    0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F, 0xF1, 0x18, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8F,
    0xF1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x08, 0x87, 0xE1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x02, 0x10, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x20,
    0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x06, 0x10, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0F, 0xF0, 0x60, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
    0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x01, 0xC0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
    0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x02, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

Picture splashScreen = { screen1, 32, 128 };
Picture anotherLogo = { screen2, 32, 128 };

Usage:

#include "Pictures.h"


drawLogo(splashScreen.image, splashScreen.logoHeight, splashScreen.logoWidth);
drawLogo(anotherLogo.image, anotherLogo.logoHeight, anotherLogo.logoWidth);