CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

SSD1306

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MCUprogrammer



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

SSD1306
PostPosted: Sat Apr 06, 2024 6:30 am     Reply with quote

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: 9253
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Apr 06, 2024 6:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Apr 06, 2024 6:51 am     Reply with quote

I don't understand what you mean.
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
gaugeguy



Joined: 05 Apr 2011
Posts: 304

View user's profile Send private message

PostPosted: Mon Apr 08, 2024 7:50 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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