Neil
2018-09-15 16:07:27 UTC
Hi all,
I've got bitmaps defined using const (to store it in program memory) in
my PIC32 code as...
const unsigned char Logo1Bitmap[312] =
{
0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xF0,
0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0,
...
}
I also have this function...
void DrawBitmap(signed short XPos, signed short YPos, signed short
width, signed short height, unsigned char *bitmap, unsigned short color);
When I pass the bitmap to the function like this...
DrawBitmap(85, 28, 52, 42, Logo1Bitmap, 0x7BEF);
I get warning messages like this...
warning: passing argument 5 of 'DrawBitmap' discards 'const' qualifier
from pointer target type [enabled by default]
DrawBitmap(85, 28, 52, 42, Logo1Bitmap, 0x7BEF);
The only way I can get the warning to go away is to do this...
DrawBitmap(85, 28, 52, 42, (unsigned char *)&Logo1Bitmap[0],
0x7BEF);
It works properly either way, but I'm unclear what it thinks I'm doing
wrong. And what's the right way to do this?
Cheers,
-Neil.
I've got bitmaps defined using const (to store it in program memory) in
my PIC32 code as...
const unsigned char Logo1Bitmap[312] =
{
0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xF0,
0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0,
...
}
I also have this function...
void DrawBitmap(signed short XPos, signed short YPos, signed short
width, signed short height, unsigned char *bitmap, unsigned short color);
When I pass the bitmap to the function like this...
DrawBitmap(85, 28, 52, 42, Logo1Bitmap, 0x7BEF);
I get warning messages like this...
warning: passing argument 5 of 'DrawBitmap' discards 'const' qualifier
from pointer target type [enabled by default]
DrawBitmap(85, 28, 52, 42, Logo1Bitmap, 0x7BEF);
The only way I can get the warning to go away is to do this...
DrawBitmap(85, 28, 52, 42, (unsigned char *)&Logo1Bitmap[0],
0x7BEF);
It works properly either way, but I'm unclear what it thinks I'm doing
wrong. And what's the right way to do this?
Cheers,
-Neil.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist