this code is supposed to display an image onto a lcd display on an arduino mega 2560
this is the header file
/*
* Routine for drawing an image patch from the SD card to the LCD display.
*/
#ifndef _LCD_IMAGE_H
#define _LCD_IMAGE_H
typedef struct {
char *file_name;
uint16_t ncols;
uint16_t nrows;
} lcd_image_t;
/* Draws the referenced image to the LCD screen.
*
* img : the image to draw
* tft : the initialized tft struct
* icol, irow : the upper-left corner of the image patch to draw
* scol, srow : the upper-left corner of the screen to draw to
* width, height : controls the size of the patch drawn.
*/
void lcd_image_draw(lcd_image_t *img, Adafruit_ST7735 *tft,uint16_t icol, uint16_t irow, uint16_t scol, uint16_t srow, uint16_t width, uint16_t height);
#endif
this is the actual code
/* Simple Image Drawing
*
* Draws an image to the screen. The image is stored in "parrot.lcd" on
* the SD card. The image file contains only raw pixel byte-pairs.
*/
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <SD.h>
#include "lcd_image.h"
// standard U of A library settings, assuming Atmel Mega SPI pins
#define SD_CS 5 // Chip select line for SD card
#define TFT_CS 6 // Chip select line for TFT display
#define TFT_DC 7 // Data/command line for TFT
#define TFT_RST 8 // Reset line for TFT (or connect to +5V)
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
lcd_image_t map_image = { "parrot.lcd", 128, 128 };
void setup(void) {
Serial.begin(9600);
// If your TFT's plastic wrap has a Red Tab, use the following:
tft.initR(INITR_REDTAB); // initialize a ST7735R chip, red tab
// If your TFT's plastic wrap has a Green Tab, use the following:
//tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab
Serial.print("Initializing SD card...");
if (!SD.begin(SD_CS)) {
Serial.println("failed!");
return;
}
Serial.println("OK!");
// clear to yellow
tft.fillScreen(tft.Color565(0xff, 0xff, 0x00));
lcd_image_draw(&map_image, &tft, 0, 0, 0, 0, 128, 128);
lcd_image_draw(&map_image, &tft, 0, 0, 64, 64, 64, 64);
}
void loop() {
}
this is the error im getting
Compiling 'parrot_display' for 'Arduino Mega 2560 or Mega ADK'
parrot_display.cpp.o : In function `setup'
parrot_display.cpp : undefined reference to `lcd_image_draw(lcd_image_t*, Adafruit_ST7735*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)'
parrot_display.cpp : undefined reference to `lcd_image_draw(lcd_image_t*, Adafruit_ST7735*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)'
avr-objcopy* : No such file
avr-objcopy* : No such file
Couldn't determine program size: C:\arduino\arduino-1.0.1\hardware\tools\avr\bin\avr-size: _display.hex': No such file
are there additional files required or changes needs to be made to the code?