Sadly I don't have any context to give! I was coding along, minding my own business, did a little change. Moved a couple local variable to being global.. Then I got this error. So I quicly move them back and I still get the error.
Here's the library I was working on..
The .h file..
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>
#include "mapper.h"
#if not defined USE_ADAFRUIT_SHIELD_PINOUT
#error "For use with the shield, make sure to #define USE_ADAFRUIT_SHIELD_PINOUT in the TFTLCD.h library file"
#endif
// These are the pins for the shield!
#define YP A1 // must be an analog pin, use "An" notation!
#define XM A2 // must be an analog pin, use "An" notation!
#define YM 7 // can be a digital pin
#define XP 6 // can be a digital pin
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
#define OHMS 300
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// Rotation
#define PORTRAIT 0 // USB up
#define LANDSCAPE 1 // USB left
#define INV_PORTRAIT 2 // USB down
#define INV_LANDSCAPE 3 // USB right
// ****** colorObj ******
class colorObj {
public:
colorObj(byte inRed, byte inGreen, byte inBlue);
colorObj(word color16);
colorObj(void);
void setColor(byte red, byte green, byte blue);
void setColor(word color16);
word getColor16(void);
byte getRed(void);
byte getGreen(void);
byte getBlue(void);
void printRGB(void);
private :
word convertRGB(byte red, byte green, byte bue);
byte red;
byte green;
byte blue;
};
// ****** colorMapper ******
class colorMapper {
public:
colorMapper(colorObj* inStart, colorObj* inEnd);
colorMapper(word startC16,word endC16);
word Map(float percent);
void printColors(void);
private :
mapper* redMapper;
mapper* greenMapper;
mapper* blueMapper;
};
// ****** screenObj ******
class screenObj :
public Adafruit_TFTLCD {
public:
screenObj(int Dummy);
boolean init(int inRotation=PORTRAIT);
//void setRotation(int inRotation);
Point getPoint();
private :
mapper* xMapper;
mapper* yMapper;
TouchScreen* ts;
};
And the source code..
#include "screenObj.h"
#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940
/* These are the guys I moved and the compiler broke.
word redMask = (B11111000 * 256);
word greenMask = (B00000111 * 256) + B11100000;
word blueMask = B00011111;
*/
// ****** colorObj ******
colorObj::colorObj(byte inRed, byte inGreen, byte inBlue) {
setColor(inRed,inGreen,inBlue);
}
colorObj::colorObj(word inColor16) {
setColor(inColor16);
}
colorObj::colorObj(void) {
setColor(0,0,0);
}
void colorObj::setColor(byte inRed, byte inGreen, byte inBlue) {
red = inRed;
green = inGreen;
blue = inBlue;
//Serial.println("setColor(byte inRed, byte inGreen, byte inBlue)");
//Serial.print( "ColorObj RGB : ");Serial.print(red);Serial.print(", ");Serial.print(green);Serial.print(", ");Serial.println(blue);
}
void colorObj::setColor(word color16) {
word redMask = (B11111000 * 256);
word greenMask = (B00000111 * 256) + B11100000;
word blueMask = B00011111;
red = (color16 & redMask) >> 8;
green = (color16 & greenMask) >> 5;
blue = color16 & blueMask;
//Serial.print("color16 : ");Serial.println(color16,BIN);
//printRGB();
}
word colorObj::getColor16(void) {
return convertRGB(red,green,blue);
}
byte colorObj::getRed(void) {
return red;
}
byte colorObj::getGreen(void) {
return green;
}
byte colorObj::getBlue(void) {
return blue;
}
void colorObj::printRGB(void) {
Serial.print( "ColorObj RGB : ");
Serial.print(red);
Serial.print(", ");
Serial.print(green);
Serial.print(", ");
Serial.println(blue);
}
word colorObj::convertRGB(byte inRed, byte inGreen, byte inBlue) {
word color;
color = inRed;
color >>= 3;
color <<= 6;
inGreen >>= 2;
color |= inGreen;
color <<= 5;
inBlue >>= 3;
color |= inBlue;
return color;
}
// ****** colorMapper ******
colorMapper::colorMapper(colorObj* inStart, colorObj* inEnd) {
//Serial.println("colorMapper::colorMapper(colorObj* inStart, colorObj* inEnd)");
redMapper = new mapper(0,100,inStart->getRed(),inEnd->getRed());
greenMapper = new mapper(0,100,inStart->getGreen(),inEnd->getGreen());
blueMapper = new mapper(0,100,inStart->getBlue(),inEnd->getBlue());
}
colorMapper::colorMapper(word startC16,word endC16) {
//Serial.println("colorMapper::colorMapper(word startC16,word endC16)");
colorObj startColor(startC16);
colorObj endColor(endC16);
redMapper = new mapper(0,100,startColor.getRed(),endColor.getRed());
greenMapper = new mapper(0,100,startColor.getGreen(),endColor.getGreen());
blueMapper = new mapper(0,100,startColor.getBlue(),endColor.getBlue());
}
word colorMapper::Map(float percent) {
//Serial.println("colorMapper::Map(float percent)");
colorObj tempColor(
(byte)round(redMapper->Map(percent)),
(byte)round(greenMapper->Map(percent)),
(byte)round(blueMapper->Map(percent))
);
return tempColor.getColor16();
}
void colorMapper::printColors(void) {
colorObj startColor(
(byte)round(redMapper->Map(0)),
(byte)round(greenMapper->Map(0)),
(byte)round(blueMapper->Map(0))
);
colorObj endColor(
(byte)round(redMapper->Map(100)),
(byte)round(greenMapper->Map(100)),
(byte)round(blueMapper->Map(100))
);
Serial.println("Mapper start / end");
startColor.printRGB();
endColor.printRGB();
}
// ****** screenObj ******
screenObj::screenObj(int dummy)
:
Adafruit_TFTLCD(LCD_CS, LCD_CD, LCD_WR, LCD_RD, 0)
{
ts = new TouchScreen(XP, YP, XM, YM, OHMS);
xMapper = new mapper(TS_MINX, TS_MAXX, width(), 0);
yMapper = new mapper(TS_MINY, TS_MAXY, height(), 0);
int place = dummy;
}
boolean screenObj::init(int inRotation) {
uint16_t identifier;
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
reset();
identifier = readRegister(0x0);
if (identifier == 0x9325 || identifier == 0x9328) {
begin(identifier);
setRotation(inRotation);
return true;
}
else
return false;
}
Point screenObj::getPoint() {
Point pt;
pt = ts->getPoint();
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
pt.x = xMapper->Map(pt.x);
pt.y = yMapper->Map(pt.y);
switch (getRotation()) {
case 0:
break;
case 1:
swap(pt.x,pt.y);
pt.x = pt.x;
pt.y = height() - pt.y;
break;
case 2:
pt.x = width() - pt.x;
pt.y = height() - pt.y;
break;
case 3:
swap(pt.x,pt.y);
pt.x = width() - pt.x;
pt.y = pt.y;
break;
}
return(pt);
}
And it gives me..
/var/folders/QT/QToGN6mK2RmPDU+1YrkbM++++TM/-Tmp-//ccbinRWR.s: Assembler messages:
/var/folders/QT/QToGN6mK2RmPDU+1YrkbM++++TM/-Tmp-//ccbinRWR.s:1278: Error: even register number required
/var/folders/QT/QToGN6mK2RmPDU+1YrkbM++++TM/-Tmp-//ccbinRWR.s:1288: Error: even register number required
/var/folders/QT/QToGN6mK2RmPDU+1YrkbM++++TM/-Tmp-//ccbinRWR.s:1478: Error: even register number required
/var/folders/QT/QToGN6mK2RmPDU+1YrkbM++++TM/-Tmp-//ccbinRWR.s:1488: Error: even register number required
-jim lee