Go Down

Topic: Inserting a bmp image (Read 6 times) previous topic - next topic

fnb111

Today at 10:46 am Last Edit: Today at 10:46 am by fnb111
Arduino: 1.8.5 (Windows 10), Board: "Arduino Due (Programming Port)"

C:\Users\Johan Prinsloo\Documents\Arduino\BitmapExample\BitmapExample.ino: In function 'void setup()':

BitmapExample:41: error: invalid conversion from 'unsigned int' to 'unsigned int*' [-fpermissive]

   drawBitmap(20, 20, 83, 83, ButtonPlay[0x1AE9]); // (0,0) where on the screen, (64,64) size of image, (conix_64x64) image name.

                                               ^

BitmapExample:52: error: initializing argument 5 of 'void drawBitmap(int, int, int, int, unsigned int*)' [-fpermissive]

 void drawBitmap(int x, int y, int sx, int sy, unsigned int *data)

      ^

C:\Users\Johan Prinsloo\Documents\Arduino\BitmapExample\BitmapExample.ino: In function 'void loop()':

BitmapExample:48: error: too few arguments to function 'void drawBitmap(int, int, int, int, unsigned int*)'

   drawBitmap();

              ^

C:\Users\Johan Prinsloo\Documents\Arduino\BitmapExample\BitmapExample.ino:52:6: note: declared here

 void drawBitmap(int x, int y, int sx, int sy, unsigned int *data)

      ^

exit status 1
invalid conversion from 'unsigned int' to 'unsigned int*' [-fpermissive]

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


Code: [Select]

/*DUE and 2.8" UNO TFT multi pin screen

*/
#include <MCUFRIEND_kbv.h>
#include <Adafruit_GFX.h>
#include <TouchScreen.h>
MCUFRIEND_kbv tft;

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4



#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define LIGHTGREY 0xDEDB
#define GREY    0xCE79

extern unsigned int ButtonPlay[0x1AE9]; // "conix_[0x1000]" must match the name in the file.

void setup() {

  Serial.begin(9600);
  Serial.print("Starting...");
  tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation(2);


  /* add in the functions to get your LCD started */
  drawBitmap(20, 20, 83, 83, ButtonPlay[0x1AE9]); // (0,0) where on the screen, (64,64) size of image, (conix_64x64) image name.

}


void loop()
{
  drawBitmap();
}


void drawBitmap(int x, int y, int sx, int sy, unsigned int *data)
{
  int tc = 0;
  for (int Y = 0; Y < sy; Y++)
  {
    for (int X = 0; X < sx; X++)
    {
      tft.drawPixel(X + x, Y + y, pgm_read_word(&data[tc]));
      if (tc < (sx * sy)) tc++;
    }
  }
}


Members

I received the error above when I compile this. Please help me to fix this. Thanks

Go Up