0

Troubleshooting with adafruit_ILI9341::drawRGBBitmap
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Troubleshooting with adafruit_ILI9341::drawRGBBitmap

by PaoloMarinelo on Fri Dec 08, 2017 10:40 am

Hi !

I'm trying to modify the pictureEmbeded.ino example from adafruit_ILI9341 libraries.
I want to put a picture (mks_petit.c) converted with GIMP.
But I have an error :
Code: Select all | TOGGLE FULL SIZE
angleNelson:45: error: no matching function for call to 'Adafruit_ILI9341::drawRGBBitmap(int, int, const unsigned char [22081], const unsigned int&, const unsigned int&)'

   tft.drawRGBBitmap(184, 60, mks.pixel_data, mks.width, mks.height);


That's my angleNelson.ino :
Code: Select all | TOGGLE FULL SIZE
// ILI9341 example with embedded color bitmaps in sketch.
// WILL NOT FIT ON ARDUINO UNO OR OTHER AVR BOARDS;
// uses large bitmap image stored in array!

// Options for converting images to the format used here include:
//   http://www.rinkydinkelectronics.com/t_imageconverter565.php
// or
//  GIMP (https://www.gimp.org/) as follows:
//    1. File -> Export As
//    2. In Export Image dialog, use 'C source code (*.c)' as filetype.
//    3. Press export to get the export options dialog.
//    4. Type the desired variable name into the 'prefixed name' box.
//    5. Uncheck 'GLIB types (guint8*)'
//    6. Check 'Save as RGB565 (16-bit)'
//    7. Press export to save your image.
//  Assuming 'image_name' was typed in the 'prefixed name' box of step 4,
//  you can have to include the c file, then using the image can be done with:
//    tft.drawRGBBitmap(0, 0, image_name.pixel_data, image_name.width, image_name.height);
//  See also https://forum.pjrc.com/threads/35575-Export-for-ILI9341_t3-with-GIMP

#include "SPI.h"
#include <Adafruit_ILI9341.h>
#include "mks_petit.c"

// ESP8266:
#define TFT_DC 2
#define TFT_CS  5

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

void setup() {
  tft.begin();
  tft.fillScreen(ILI9341_BLACK);
  tft.drawRGBBitmap(184, 60, mks.pixel_data, mks.width, mks.height);
}

void loop(void) {
     
   
}

That's a part of my picture mks.c :
Code: Select all | TOGGLE FULL SIZE
/* GIMP RGBA C-Source image dump (mks_petit.c) */

static const struct {
  unsigned int     width;
  unsigned int     height;
  unsigned int     bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
  unsigned char    pixel_data[184 * 60 * 2 + 1];
} mks = {
  184, 60, 2,
  "\000\000\000\000


One more thing, the pictureEmbeded.ino example from adafruit work well.

Thank you for helping me

PaoloMarinelo
 
Posts: 2
Joined: Fri Dec 08, 2017 10:25 am

Re: Troubleshooting with adafruit_ILI9341::drawRGBBitmap

by PaoloMarinelo on Sun Dec 17, 2017 1:37 pm

Hi !
Find myself the solution,
replace
Code: Select all | TOGGLE FULL SIZE
tft.drawRGBBitmap(184, 60, mks.pixel_data, mks.width, mks.height);

by
Code: Select all | TOGGLE FULL SIZE
tft.drawRGBBitmap(184, 60, (const uint16_t *) mks.pixel_data, mks.width, mks.height);

Bye !

PaoloMarinelo
 
Posts: 2
Joined: Fri Dec 08, 2017 10:25 am

Please be positive and constructive with your questions and comments.