|
|
View previous topic :: View next topic |
Author |
Message |
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
SSD1306 |
Posted: Sat Apr 06, 2024 6:30 am |
|
|
Hello.
PIC18F26Q71
CCS 5.117
There are 2 logos. I want to print the logo I want. If I try to print one by one, there is no problem. But if I want to choose which logo to print in the function, the whole screen is filled with white pixels.
Where am I going wrong?
Let me share the relevant parts of the code.
Code: |
rom uint8_t Logo1[64][16] = {................} // There's hex data inside.
rom uint8_t Logo2[96][12] = {................} // There's hex data inside.
Function prototype
void pDisplay(uint8_t startX, uint8_t startY, uint8_t width, uint8_t height,uint8_t *printLogo);
The function I sent.
pDisplay(0, 0, 128,64,Logo1);
void pDisplay(uint8_t startX, uint8_t startY, uint8_t width, uint8_t height,uint8_t *printLogo)
{
uint8_t x, y;
uint8_t displayX, displayY;
uint8_t value, i;
uint8_t screenWidth = 128;
uint8_t screenHeight = 64;
// Exit the function if the image exceeds the screen size
if (startX + width > screenWidth || startY + height > screenHeight)
{
return;
}
displayY = startY;
for(y=0;y<height;y++)
{
displayX = startX;
for(x=0;x<width;x++)
{
if((x % 8) == 0)
{
value = printLogo[(height - 1) - y][x/8];
i = 7;
}
oled_pixel(displayX, displayY, bit_test(value, i) == 0);
displayX++;
i--;
}
displayY++;
}
}
|
_________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9232 Location: Greensville,Ontario
|
|
Posted: Sat Apr 06, 2024 6:45 am |
|
|
what you give isn't a program to chose which of the 'logos' to print.
assuming that each 'logo' does display properly, it's not the 'display' function problem. |
|
|
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
|
Posted: Sat Apr 06, 2024 6:51 am |
|
|
I don't understand what you mean. _________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Mon Apr 08, 2024 7:50 am |
|
|
When you pass the address of a pointer, you are only passing the start address.
It does not have any inherent knowledge of whether it is a multi-dimensional array. You will need to treat it as a one-dimensional array and calculate the location based on the size of the array. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|