I've adapted the UTFT_Bitmap example (thank you Henning Karlsen).
Now it has a tux icon on PROGMEM_FAR and it shows rotation example:
The make the tuxfar.c file just copy | paste the tux.c file, rename it to tuxfar.c and change to the following:
//#include <avr/pgmspace.h>
#define GET_FAR_ADDRESS(var) \
({ \
uint_farptr_t tmp; \
\
__asm__ __volatile__( \
\
"ldi %A0, lo8(%1)" "\n\t" \
"ldi %B0, hi8(%1)" "\n\t" \
"ldi %C0, hh8(%1)" "\n\t" \
"clr %D0" "\n\t" \
: \
"=d" (tmp) \
: \
"p" (&(var)) \
); \
tmp; \
})
#define PROGMEM_FAR __attribute__((section(".fini7")))
const unsigned short tuxfar[0x400] PROGMEM_FAR ={
The rest is the same as in tux.c
The UTFT_Bitmap.pde must be:
// UTFT_Bitmap (C)2012 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//
// This program is a demo of the drawBitmap()-function.
//
// This demo was made to work on the 320x240 modules.
// Any other size displays may cause strange behaviour.
//
// This program requires the UTFT library.
//
#include <UTFT.h>
#include <avr/pgmspace.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
// Uncomment the next line for Arduino 2009/Uno
//UTFT myGLCD(ITDB32S,19,18,17,16); // Remember to change the model parameter to suit your display module!
// Uncomment the next line for Arduino Mega
UTFT myGLCD(ITDB32S,38,39,40,41); // Remember to change the model parameter to suit your display module!
extern unsigned int info[0x400];
extern unsigned int icon[0x400];
extern unsigned int tux[0x400];
extern unsigned int tuxfar[0x400];
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
}
void loop()
{
myGLCD.fillScr(255, 255, 255);
myGLCD.setColor(255, 255, 255);
myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228);
for (int x=0; x<10; x++)
for (int y=0; y<7; y++)
myGLCD.drawBitmap (x*32, y*32, 32, 32, info);
delay(5000);
myGLCD.fillScr(255, 255, 255);
myGLCD.setColor(255, 255, 255);
myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228);
int x=0;
for (int s=0; s<4; s++)
{
x+=(s*32);
myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1);
}
x=0;
for (int s=4; s>0; s--)
{
myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s);
x+=(s*32);
}
delay(5000);
myGLCD.fillScr(255, 255, 255);
myGLCD.setColor(255, 255, 255);
myGLCD.print("Near and far PROGMEM with icon rotation", CENTER, 228);
x=0;
for (int s=0; s<4; s++)
{
myGLCD.drawBitmap (39+x, 40, 32, 32, tux, 45*s, 16, 16);
x+=70;
}
x=0;
for (int s=4; s<8; s++)
{
myGLCD.drawBitmap (39+x, 170, 32, 32, tuxfar, 45*s, 16, 16);
x+=70 ;
}
delay(5000);
}
Which is basically the original file with adding tuxfar and showing the rotation example in the end.