├── Libraries ├── Arduino │ ├── Examples │ │ ├── SparkFunChronoLCDColor │ │ │ └── SparkFunChronoLCDColor.ino │ │ ├── SparkFunLCDWithArcFunction │ │ │ └── SparkFunLCDWithArcFunction.ino │ │ ├── SparkFunPrintBitmap │ │ │ └── SparkFunPrintBitmap.ino │ │ ├── SparkFunTestPattern │ │ │ └── SparkFunTestPattern.ino │ │ └── SparkFunZanyCircles │ │ │ └── SparkFunZanyCircles.ino │ ├── README.md │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── SparkFunColorLCDShield.cpp │ │ └── SparkFunColorLCDShield.h └── README.md ├── README.md └── hardware ├── Color-LCD-Shield.brd └── Color-LCD-Shield.sch /Libraries/Arduino/Examples/SparkFunChronoLCDColor/SparkFunChronoLCDColor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ChronoLCD Color - An example sketch for the SparkFun Color LCD Shield Library 3 | by: Jim Lindblom 4 | SparkFun Electronics 5 | date: 6/23/11 6 | license: CC-BY SA 3.0 - Creative commons share-alike 3.0 7 | use this code however you'd like, just keep this license and 8 | attribute. Let me know if you make hugely, awesome, great changes. 9 | 10 | This sketch draws an analog and digital clock on the Color LCD 11 | Shield. You can also use the on-board buttons to set the hours 12 | and minutes. 13 | 14 | Use the defines at the top of the code to set the initial time. 15 | You can also adjust the size and color of the clock. 16 | 17 | To set the time, first hit S3. Then use S1 and S2 to adjust the 18 | hours and minutes respsectively. Hit S3 to start the clock 19 | back up. 20 | 21 | This example code should give you a good idea of how to use 22 | the setCircle, setLine, and setStr functions of the SparkFun Color LCD 23 | Shield Library. 24 | */ 25 | #include 26 | 27 | // Enter the time below in 12-hr format 28 | #define HOURS 10 29 | #define MINUTES 21 30 | #define SECONDS 00 31 | #define AMPM 0 // enter 0 for AM, 1 for PM 32 | 33 | #define CLOCK_RADIUS 45 // radius of clock face 34 | #define CLOCK_CENTER 50 // If you adjust the radius, you'll probably want to adjust this 35 | #define H_LENGTH 25 // length of hour hand 36 | #define M_LENGTH 35 // length of minute hand 37 | #define S_LENGTH 43 // length of second hand 38 | 39 | #define BACKGROUND BLACK // room for growth, adjust the background color according to daylight 40 | #define C_COLOR RED // This is the color of the clock face, and digital clock 41 | #define H_COLOR BLUE // hour hand color 42 | #define M_COLOR GREEN // minute hand color 43 | #define S_COLOR YELLOW // second hand color 44 | 45 | LCDShield lcd; 46 | 47 | int hours, minutes, seconds, ampm; 48 | int buttonPins[3] = {3, 4, 5}; 49 | 50 | void setup() 51 | { 52 | /* Set up the button pins as inputs, set pull-up resistor */ 53 | for (int i=0; i<3; i++) 54 | { 55 | pinMode(buttonPins[i], INPUT); 56 | digitalWrite(buttonPins[i], HIGH); 57 | } 58 | 59 | hours = HOURS; 60 | minutes = MINUTES; 61 | seconds = SECONDS; 62 | ampm = AMPM; 63 | 64 | /* Initialize the LCD, set the contrast, clear the screen */ 65 | lcd.init(PHILIPS); 66 | lcd.contrast(-63); 67 | lcd.clear(BACKGROUND); 68 | 69 | drawClock(); // Draw the clock face, this includes 12, 3, 6, 9 70 | displayAnalogTime(hours, minutes, seconds); // Draw the clock hands 71 | displayDigitalTime(hours, minutes, seconds, ampm); // Draw the digital clock text 72 | } 73 | 74 | void loop() 75 | { 76 | /* We'll run around checking for button presses, 77 | until it's been a second */ 78 | while(millis() % 1000) 79 | { 80 | if (!digitalRead(buttonPins[2])) 81 | setTime(); // If S3 was pressed, go set the time 82 | } 83 | 84 | /* We'll get here if it's been a second. We need to increase 85 | seconds by 1 and then go from there */ 86 | seconds++; 87 | if (seconds >= 60) 88 | { 89 | seconds = 0; // If seconds is 60, set it back to 0 90 | minutes++; // and increase minutes by 1 91 | if (minutes >= 60) 92 | { 93 | minutes = 0; // If minutes is 60, set it back to 0 94 | hours++; // and increase hours by 1 95 | if (hours == 12) 96 | ampm ^= 1; // If it's 12 o'clock, flip ampm 97 | if (hours >= 13) 98 | hours = 1; // If hours is 13, set it to 1. 12-hr clock. 99 | } 100 | } 101 | /* Once each second, we'll redraw the clock with new values */ 102 | drawClock(); 103 | displayAnalogTime(hours, minutes, seconds); 104 | displayDigitalTime(hours, minutes, seconds, ampm); 105 | } 106 | /* 107 | setTime uses on-shield switches S1, S2, and S3 to set the time 108 | pressing S3 will exit the function. S1 increases hours, S2 109 | increases seconds. 110 | */ 111 | void setTime() 112 | { 113 | /* Reset the clock to midnight */ 114 | seconds = 0; 115 | minutes = 0; 116 | hours = 12; 117 | ampm = 0; 118 | 119 | /* Draw the clock, so we can see the new time */ 120 | drawClock(); 121 | displayAnalogTime(hours, minutes, seconds); 122 | displayDigitalTime(hours, minutes, seconds, ampm); 123 | 124 | while (!digitalRead(buttonPins[2])) 125 | ; // wait till they let go of S1 126 | 127 | /* We'll run around this loop until S3 is pressed again */ 128 | while(digitalRead(buttonPins[2])) 129 | { 130 | /* If S1 is pressed, we'll update the hours */ 131 | if (!digitalRead(buttonPins[0])) 132 | { 133 | hours++; // Increase hours by 1 134 | if (hours == 12) 135 | ampm ^= 1; // Flip am/pm if it's 12 o'clock 136 | if (hours >= 13) 137 | hours = 1; // Set hours to 1 if it's 13. 12-hour clock. 138 | 139 | /* and update the clock, so we can see it */ 140 | drawClock(); 141 | displayAnalogTime(hours, minutes, seconds); 142 | displayDigitalTime(hours, minutes, seconds, ampm); 143 | } 144 | if (!digitalRead(buttonPins[1])) 145 | { 146 | minutes++; // Increase minutes by 1 147 | if (minutes >= 60) 148 | minutes = 0; // If minutes is 60, set it back to 0 149 | 150 | /* and update the clock, so we can see it */ 151 | drawClock(); 152 | displayAnalogTime(hours, minutes, seconds); 153 | displayDigitalTime(hours, minutes, seconds, ampm); 154 | } 155 | } 156 | /* Once S3 is pressed, we'll exit, but not until it's released */ 157 | while(!digitalRead(buttonPins[2])) 158 | ; 159 | } 160 | 161 | /* 162 | displayDigitalTime() takes in values for hours, minutes, seconds 163 | and am/pm. It'll print the time, in digital format, on the 164 | bottom of the screen. 165 | */ 166 | void displayDigitalTime(int h, int m, int s, int ap) 167 | { 168 | char timeChar[12]; 169 | 170 | if (!ap) 171 | { 172 | sprintf(timeChar, "%.2d:%.2d:%.2d AM", h, m, s); 173 | } 174 | else 175 | { 176 | sprintf(timeChar, "%.2d:%.2d:%.2d PM", h, m, s); 177 | } 178 | /* Print the time on the clock */ 179 | lcd.setStr(timeChar, CLOCK_CENTER + CLOCK_RADIUS + 4, 22, 180 | C_COLOR, BACKGROUND); 181 | } 182 | 183 | /* 184 | drawClock() simply draws the outer circle of the clock, and '12', 185 | '3', '6', and '9'. Room for growth here, if you want to customize 186 | your clock. Maybe add dashe marks, or even all 12 digits. 187 | */ 188 | void drawClock() 189 | { 190 | /* Draw the circle */ 191 | lcd.setCircle(CLOCK_CENTER, 66, CLOCK_RADIUS, C_COLOR); 192 | 193 | /* Print 12, 3, 6, 9, a lot of arbitrary values are used here 194 | for the coordinates. Just used trial and error to get them 195 | into a nice position. */ 196 | lcd.setStr("12", CLOCK_CENTER - CLOCK_RADIUS, 66-9, C_COLOR, BACKGROUND); 197 | lcd.setStr("3", CLOCK_CENTER - 9, 66 + CLOCK_RADIUS - 12, C_COLOR, BACKGROUND); 198 | lcd.setStr("6", CLOCK_CENTER + CLOCK_RADIUS - 18, 66-4, C_COLOR, BACKGROUND); 199 | lcd.setStr("9", CLOCK_CENTER - 9, 66 - CLOCK_RADIUS + 4, C_COLOR, BACKGROUND); 200 | } 201 | 202 | /* 203 | displayAnalogTime() draws the three clock hands in their proper 204 | position. Room for growth here, I'd like to make the clock hands 205 | arrow shaped, or at least thicker and more visible. 206 | */ 207 | void displayAnalogTime(int h, int m, int s) 208 | { 209 | double midHours; // this will be used to slightly adjust the hour hand 210 | static int hx, hy, mx, my, sx, sy; 211 | 212 | /* Adjust time to shift display 90 degrees ccw 213 | this will turn the clock the same direction as text */ 214 | h -= 3; 215 | m -= 15; 216 | s -= 15; 217 | if (h <= 0) 218 | h += 12; 219 | if (m < 0) 220 | m += 60; 221 | if (s < 0) 222 | s += 60; 223 | 224 | /* Delete old lines: */ 225 | lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+sx, 66+sy, BACKGROUND); // delete second hand 226 | lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+mx, 66+my, BACKGROUND); // delete minute hand 227 | lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+hx, 66+hy, BACKGROUND); // delete hour hand 228 | 229 | /* Calculate and draw new lines: */ 230 | s = map(s, 0, 60, 0, 360); // map the 0-60, to "360 degrees" 231 | sx = S_LENGTH * sin(3.14 * ((double) s)/180); // woo trig! 232 | sy = S_LENGTH * cos(3.14 * ((double) s)/180); // woo trig! 233 | lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+sx, 66+sy, S_COLOR); // print second hand 234 | 235 | m = map(m, 0, 60, 0, 360); // map the 0-60, to "360 degrees" 236 | mx = M_LENGTH * sin(3.14 * ((double) m)/180); // woo trig! 237 | my = M_LENGTH * cos(3.14 * ((double) m)/180); // woo trig! 238 | lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+mx, 66+my, M_COLOR); // print minute hand 239 | 240 | midHours = minutes/12; // midHours is used to set the hours hand to middling levels between whole hours 241 | h *= 5; // Get hours and midhours to the same scale 242 | h += midHours; // add hours and midhours 243 | h = map(h, 0, 60, 0, 360); // map the 0-60, to "360 degrees" 244 | hx = H_LENGTH * sin(3.14 * ((double) h)/180); // woo trig! 245 | hy = H_LENGTH * cos(3.14 * ((double) h)/180); // woo trig! 246 | lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+hx, 66+hy, H_COLOR); // print hour hand 247 | } -------------------------------------------------------------------------------- /Libraries/Arduino/Examples/SparkFunLCDWithArcFunction/SparkFunLCDWithArcFunction.ino: -------------------------------------------------------------------------------- 1 | // This Sample Created by Tony Contrada (2/22/2013) for use with the Sparkfun Color LCD Shield 2 | // with the updated Arduino Color LCD Library. 3 | // This sample sketch illustrates the new setArf method and an updated setCircle method 4 | // which includes setting a Line Thickness in Pixels and the ability to Fill-In the circle. 5 | 6 | #include 7 | 8 | LCDShield lcd; // Creates an LCDShield, named lcd 9 | 10 | void setup() 11 | { 12 | lcd.init(PHILIPS); // Initializes lcd, using an PHILIPSdriver 13 | lcd.contrast(-64); // -51's usually a good contrast value 14 | lcd.clear(BLACK); // clear the screen 15 | 16 | //Creates RED Arc in the ENE Quadrant with a Line Thickness of 5 Pixels 17 | int segmentsRed[1] = {ENE}; 18 | lcd.setArc(60,50,40,segmentsRed,sizeof(segmentsRed),5,RED); 19 | 20 | //Creates YELLOW Arc in the NNE Quadrant with a Line Thickness of 10 Pixels 21 | int segmentsYellow[1] = {NNE}; 22 | lcd.setArc(60,50,40,segmentsYellow,sizeof(segmentsYellow),10,YELLOW); 23 | 24 | //Creates GREEN Arc in the WNW and NNW Quadrants with a FILL 25 | int segments[2] = {WNW,NNW}; 26 | lcd.setArc(60,50,40,segments,sizeof(segments),FILL,GREEN); 27 | 28 | //Creates PINK Circle with a FILL 29 | lcd.setCircle(90,100,20,PINK,FILL); 30 | 31 | //Creates CYAN Circle with a Line Thickness of 3 Pixels 32 | lcd.setCircle(90,35,25,CYAN,3); 33 | 34 | } 35 | 36 | void loop() 37 | { 38 | 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /Libraries/Arduino/Examples/SparkFunPrintBitmap/SparkFunPrintBitmap.ino: -------------------------------------------------------------------------------- 1 | /* 2 | PrintBitmap - An example sketch for the SparkFun Color LCD Shield Library 3 | by: Jim Lindblom 4 | SparkFun Electronics 5 | date: 6/23/11 6 | license: CC-BY SA 3.0 - Creative commons share-alike 3.0 7 | use this code however you'd like, just keep this license and 8 | attribute. Let me know if you make hugely, awesome, great changes. 9 | 10 | This sketch allows for printing of monochrome bitmap images on the display. They must be no 11 | larger than 128 by 128 pixels, and must be written in the char hexadecimal format used with C. 12 | A good convertor for windows can be found at http://en.radzio.dxp.pl/bitmap_converter/ . It 13 | should be converted in horizontal order. 14 | 15 | Bitmap printing additions made by Jacob Unwin (http://www.jacob-unwin.com ) 16 | */ 17 | 18 | #include 19 | 20 | LCDShield lcd; 21 | 22 | //this is the correct number of bytes for a 128 by 128 image. (I used the sparkfun logo) The image must be encoded horizontally 23 | //for it to display correctly 24 | char myBitmap[2048] = { 25 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 26 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 27 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 28 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 29 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 30 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 31 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 32 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 33 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x3f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, 34 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x3f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, 35 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, 36 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 37 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 38 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 39 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 40 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 41 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 42 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 43 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 44 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 45 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 46 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 47 | 0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x20,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 48 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 49 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 50 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 51 | 0x0f,0xe0,0x9f,0x01,0xfc,0x09,0x9e,0x1e,0x7f,0x70,0x73,0x9f,0x00,0x00,0x00,0x00, 52 | 0x3f,0xf1,0xff,0x87,0xfe,0x3f,0xde,0x3d,0xff,0x78,0xf3,0xff,0x80,0x00,0x00,0x00, 53 | 0x3c,0xf9,0xff,0xc7,0xdf,0x3f,0xde,0x79,0xff,0x78,0xf3,0xff,0xc0,0x00,0x00,0x00, 54 | 0x78,0x79,0xc3,0xcf,0x0f,0x3f,0x1c,0xf0,0x3c,0x78,0xf3,0xe3,0xc0,0x00,0x00,0x00, 55 | 0x7c,0x01,0xc1,0xe0,0x0f,0x3e,0x1f,0xe0,0x3c,0x78,0xf3,0xc3,0xc0,0x00,0x00,0x00, 56 | 0x3f,0xc1,0x81,0xe0,0x3f,0x3c,0x1f,0xe0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 57 | 0x1f,0xf1,0x81,0xe3,0xff,0x3c,0x1f,0xe0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 58 | 0x07,0xf9,0x81,0xe7,0xef,0x3c,0x1f,0xf0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 59 | 0x00,0xf9,0x81,0xef,0x07,0x3c,0x1e,0xf8,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 60 | 0x78,0x79,0xc1,0xef,0x0f,0x3c,0x1e,0x78,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 61 | 0x78,0x79,0xe3,0xcf,0x0f,0x3c,0x1e,0x3c,0x3c,0x7c,0xf3,0xc1,0xc0,0x00,0x00,0x00, 62 | 0x3f,0xf9,0xff,0xcf,0xff,0x3c,0x1e,0x3e,0x3c,0x7f,0xf3,0xc1,0xcf,0x00,0x00,0x00, 63 | 0x1f,0xf1,0xff,0x87,0xff,0x3c,0x1e,0x1e,0x3c,0x3f,0xf3,0xc1,0xc7,0x00,0x00,0x00, 64 | 0x07,0xc1,0x9e,0x03,0xe0,0x00,0x00,0x02,0x00,0x0e,0x20,0x00,0x00,0x00,0x00,0x00, 65 | 0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 66 | 0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 67 | 0x00,0x03,0x80,0x00,0x00,0x00,0xc0,0x00,0x00,0x18,0x00,0x00,0x08,0x08,0x00,0x00, 68 | 0x00,0x01,0x87,0xc3,0x03,0xe0,0xe1,0xf0,0xf8,0x3e,0x33,0x08,0x3e,0x1e,0x00,0x00, 69 | 0x00,0x01,0x86,0x03,0x03,0x01,0xb0,0xe0,0xdc,0x66,0x3b,0x08,0x66,0x32,0x00,0x00, 70 | 0x00,0x00,0x87,0xc3,0x03,0xe1,0x80,0x40,0xd8,0x63,0x3b,0x08,0x60,0x3c,0x00,0x00, 71 | 0x00,0x00,0x87,0x83,0x03,0xc1,0x80,0x40,0xf8,0x63,0x3f,0x08,0x60,0x0e,0x00,0x00, 72 | 0x00,0x00,0x06,0x03,0x03,0x01,0xb0,0x40,0xd8,0x66,0x37,0x08,0x66,0x32,0x00,0x00, 73 | 0x00,0x00,0x07,0xc3,0xe3,0xe0,0xe0,0x40,0xc8,0x3e,0x33,0x08,0x3e,0x3e,0x00,0x00, 74 | 0x00,0x00,0x07,0xc3,0xe3,0xe0,0xe0,0x40,0x88,0x3c,0x33,0x08,0x3c,0x1e,0x00,0x00, 75 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 76 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 77 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 78 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 79 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 80 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 81 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 82 | }; 83 | 84 | void setup(){ 85 | // Initialize the LCD, try using EPSON if it's not working 86 | lcd.init(PHILIPS); 87 | // lcd.init(PHILIPS, 1); // Philips init with colors swapped. (Try this if red makes blue, etc). 88 | lcd.contrast(-51); // Initialize contrast 89 | lcd.clear(WHITE); // Set background to white 90 | lcd.printBMP(myBitmap); //prints the bitmap 91 | } 92 | 93 | void loop(){ 94 | //we don't need to loop anything 95 | }; 96 | -------------------------------------------------------------------------------- /Libraries/Arduino/Examples/SparkFunTestPattern/SparkFunTestPattern.ino: -------------------------------------------------------------------------------- 1 | /* 2 | TestPattern - An example sketch for the SparkFun Color LCD Shield Library 3 | by: Jim Lindblom 4 | SparkFun Electronics 5 | date: 6/23/11 6 | license: CC-BY SA 3.0 - Creative commons share-alike 3.0 7 | use this code however you'd like, just keep this license and 8 | attribute. Let me know if you make hugely, awesome, great changes. 9 | 10 | This sketch has example usage of the Color LCD Shield's three 11 | buttons. It also shows how to use the setRect and contrast 12 | functions. 13 | 14 | Hit S1 to increase the contrast, S2 decreases the contrast, and 15 | S3 sets the contrast back to the middle. 16 | */ 17 | #include 18 | 19 | LCDShield lcd; 20 | 21 | int buttons[3] = {3, 4, 5}; // S1 = 3, S2 = 4, S3 = 5 22 | signed char cont = -51; // Philips medium contrast 23 | //signed char cont = 40; // Epson medium contrast 24 | 25 | void setup() 26 | { 27 | Serial.begin(9600); 28 | for (int i=0; i<3; i++) 29 | { 30 | pinMode(buttons[i], INPUT); // Set buttons as inputs 31 | digitalWrite(buttons[i], HIGH); // Activate internal pull-up 32 | } 33 | 34 | // Initialize the LCD, try using EPSON if it's not working 35 | lcd.init(PHILIPS); 36 | // lcd.init(PHILIPS, 1); // Philips init with colors swapped. (Try this if red makes blue, etc). 37 | lcd.contrast(cont); // Initialize contrast 38 | lcd.clear(WHITE); // Set background to white 39 | lcd.printLogo(); // Print SparkFun test logo 40 | testPattern(); // Print color bars on bottom of screen 41 | } 42 | 43 | void loop() 44 | { 45 | while(digitalRead(buttons[0])&&digitalRead(buttons[1])&&digitalRead(buttons[2])) 46 | ; // Wait, do nothing, until a button is pressed 47 | if (!digitalRead(buttons[0])) // If S1 is hit, increase contrast 48 | { 49 | cont++; 50 | if (cont > 63) // Philips contrast goes from 63 to -64 51 | cont = -64; 52 | } 53 | else if (!digitalRead(buttons[1])) // If s2 is hit, decrease contrast 54 | { 55 | cont--; 56 | if (cont < -64) 57 | cont = 63; 58 | } 59 | else if (!digitalRead(buttons[2])) // If S3 is hit, reset contrast 60 | { 61 | cont = 0; 62 | } 63 | lcd.contrast(cont); // give LCD contrast command 64 | Serial.println(cont); 65 | 66 | delay(100); // Delay to give each button press a little more meaning 67 | } 68 | 69 | void testPattern() 70 | { 71 | lcd.setRect(80, 2, 131, 19, 1, WHITE); 72 | lcd.setRect(80, 19, 131, 35, 1, YELLOW); 73 | lcd.setRect(80, 35, 131, 51, 1, CYAN); 74 | lcd.setRect(80, 51, 131, 67, 1, GREEN); 75 | lcd.setRect(80, 67, 131, 83, 1, MAGENTA); 76 | lcd.setRect(80, 83, 131, 99, 1, RED); 77 | lcd.setRect(80, 99, 131, 115, 1, BLUE); 78 | lcd.setRect(80, 115, 131, 131, 1, BLACK); 79 | } -------------------------------------------------------------------------------- /Libraries/Arduino/Examples/SparkFunZanyCircles/SparkFunZanyCircles.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ZanyCircles - An example sketch for the SparkFun Color LCD Shield Library 3 | by: Jim Lindblom 4 | SparkFun Electronics 5 | date: 6/23/11 6 | license: CC-BY SA 3.0 - Creative commons share-alike 3.0 7 | use this code however you'd like, just keep this license and 8 | attribute. Let me know if you make hugely, awesome, great changes. 9 | 10 | This simple sketch shows how you can use setCircle and setPixel 11 | with the SparkFun Color LCD Shield library. 12 | */ 13 | #include 14 | 15 | #define CIRCLES 10 // Number of zany circles in display 16 | #define BACKGROUND ORANGE // Color of background 17 | #define FOREGROUND BLUE // color of circles 18 | 19 | int radius = 1; // size of circles 20 | int jump = 5; // +/- of possible jump 21 | int xCir[CIRCLES]; // center points of circles 22 | int yCir[CIRCLES]; // cetner points of circles 23 | 24 | LCDShield lcd; 25 | 26 | void setup() 27 | { 28 | lcd.init(PHILIPS); // Try EPSON if this doesn't work. If colors are swapped try init(PHILIPS, 1) 29 | lcd.contrast(-51); // Feel free to change this for visibility, values between 0 and 60 30 | lcd.clear(BACKGROUND); 31 | 32 | // Initilize all circles' center points 33 | for (int i=0; i= 131-radius) 42 | xCir[i] = 131-radius; 43 | if (xCir[i] <= radius) 44 | xCir[i] = radius; 45 | if (yCir[i] >= 131-radius) 46 | yCir[i] = 131-radius; 47 | if (yCir[i] <= radius) 48 | yCir[i] = radius; 49 | } 50 | } 51 | 52 | void loop() 53 | { 54 | for (int i=0; i= 131-radius) 62 | xCir[i] = 131-radius; 63 | if (xCir[i] <= radius) 64 | xCir[i] = radius; 65 | if (yCir[i] >= 131-radius) 66 | yCir[i] = 131-radius; 67 | if (yCir[i] <= radius) 68 | yCir[i] = radius; 69 | } 70 | for (int i=0; i 5 | sentence=This is an Arduino library for SparkFun's Color LCD Shield 6 | paragraph=This is an Arduino library for SparkFun's Color LCD Shield 7 | category=Display 8 | url=https://github.com/sparkfun/SparkFun_Color_LCD_Shield_Arduino_Library 9 | architectures=* 10 | -------------------------------------------------------------------------------- /Libraries/Arduino/src/SparkFunColorLCDShield.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | LCDShield.cpp - Arduino Library to control a Nokia 6100 LCD, 3 | specifically that found on SparkFun's Color LCD Shield. 4 | This code should work for both Epson and Phillips display drivers 5 | normally found on the Color LCD Shield. 6 | 7 | License: CC BY-SA 3.0: Creative Commons Share-alike 3.0. Feel free 8 | to use and abuse this code however you'd like. If you find it useful 9 | please attribute, and SHARE-ALIKE! 10 | 11 | This is based on code by Mark Sproul, and Peter Davenport. 12 | Thanks to Coleman Sellers and Harold Timmis for help getting it to work with the Phillips Driver 7-31-2011 13 | */ 14 | 15 | #include "SparkFunColorLCDShield.h" 16 | 17 | /*extern "C" { 18 | #include "wiring.h" 19 | }*/ 20 | 21 | #include "Arduino.h" 22 | 23 | static char x_offset = 0; 24 | static char y_offset = 0; 25 | 26 | LCDShield::LCDShield() 27 | { 28 | 29 | #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) 30 | DDRB = ((1<68, 132<-69 scan direction 126 | 127 | LCDCommand(OSCON); // internal oscialltor ON (0xD1) 128 | LCDCommand(SLPOUT); // sleep out (0x94) 129 | 130 | LCDCommand(PWRCTR); // power ctrl (0x20) 131 | LCDData(0x0F); // everything on, no external reference resistors 132 | 133 | LCDCommand(DISINV); // invert display mode (0xA7) 134 | 135 | LCDCommand(DATCTL); // data control (0xBC) 136 | LCDData(0x03); // Inverse page address, reverse rotation column address, column scan-direction !!! try 0x01 137 | LCDData(0x00); // normal RGB arrangement 138 | LCDData(0x02); // 16-bit Grayscale Type A (12-bit color) 139 | 140 | LCDCommand(VOLCTR); // electronic volume, this is the contrast/brightness (0x81) 141 | LCDData(32); // volume (contrast) setting - fine tuning, original (0-63) 142 | LCDData(3); // internal resistor ratio - coarse adjustment (0-7) 143 | 144 | LCDCommand(NOP); // nop (0x25) 145 | 146 | delay(100); 147 | 148 | LCDCommand(DISON); // display on (0xAF) 149 | } 150 | else if (driver == PHILIPS) 151 | { 152 | LCDCommand(SLEEPOUT); // Sleep Out (0x11) 153 | LCDCommand(BSTRON); // Booster voltage on (0x03) 154 | LCDCommand(DISPON); // Display on (0x29) 155 | 156 | //LCDCommand(INVON); // Inversion on (0x20) 157 | 158 | // 12-bit color pixel format: 159 | LCDCommand(COLMOD); // Color interface format (0x3A) 160 | LCDData(0x03); // 0b011 is 12-bit/pixel mode 161 | 162 | LCDCommand(MADCTL); // Memory Access Control(PHILLIPS) 163 | if (colorSwap) 164 | LCDData(0x08); 165 | else 166 | LCDData(0x00); 167 | 168 | LCDCommand(SETCON); // Set Contrast(PHILLIPS) 169 | LCDData(0x30); 170 | 171 | LCDCommand(NOPP); // nop(PHILLIPS) 172 | } 173 | } 174 | 175 | void LCDShield::clear(int color) 176 | { 177 | if (driver) // if it's an Epson 178 | { 179 | LCDCommand(PASET); 180 | LCDData(0); 181 | LCDData(131); 182 | 183 | LCDCommand(CASET); 184 | LCDData(0); 185 | LCDData(131); 186 | 187 | LCDCommand(RAMWR); 188 | } 189 | else // otherwise it's a phillips 190 | { 191 | LCDCommand(PASETP); 192 | LCDData(0); 193 | LCDData(131); 194 | 195 | LCDCommand(CASETP); 196 | LCDData(0); 197 | LCDData(131); 198 | 199 | LCDCommand(RAMWRP); 200 | } 201 | 202 | for(unsigned int i=0; i < (131*131)/2; i++) 203 | { 204 | LCDData((color>>4)&0x00FF); 205 | LCDData(((color&0x0F)<<4)|(color>>8)); 206 | LCDData(color&0x0FF); 207 | } 208 | 209 | x_offset = 0; 210 | y_offset = 0; 211 | } 212 | 213 | void LCDShield::contrast(char setting) 214 | { 215 | if (driver == EPSON) 216 | { 217 | setting &= 0x3F; // 2 msb's not used, mask out 218 | LCDCommand(VOLCTR); // electronic volume, this is the contrast/brightness(EPSON) 219 | LCDData(setting); // volume (contrast) setting - course adjustment, -- original was 24 220 | LCDData(3); // TODO: Make this coarse adjustment variable, 3's a good place to stay 221 | } 222 | else if (driver == PHILIPS) 223 | { 224 | setting &= 0x7F; // msb is not used, mask it out 225 | LCDCommand(SETCON); // contrast command (PHILLIPS) 226 | LCDData(setting); // volume (contrast) setting - course adjustment, -- original was 24 227 | } 228 | } 229 | 230 | // Added by Steve Sparks @ Big Nerd Ranch. 231 | // This swaps the Epson RGB order into the Philips RGB order. (Or, vice versa, I suppose.) 232 | uint16_t LCDShield::swapColors(uint16_t in) { 233 | return ((in & 0x000F)<<8)|(in & 0x00F0)|((in & 0x0F00)>>8); 234 | } 235 | 236 | void LCDShield::setPixel(int color, unsigned char x, unsigned char y) 237 | { 238 | y = (COL_HEIGHT - 1) - y; 239 | x = (ROW_LENGTH - 1) - x; 240 | 241 | if (driver == EPSON) // if it's an epson 242 | { 243 | LCDCommand(PASET); // page start/end ram 244 | LCDData(x); 245 | LCDData(ENDPAGE); 246 | 247 | LCDCommand(CASET); // column start/end ram 248 | LCDData(y); 249 | LCDData(ENDCOL); 250 | 251 | LCDCommand(RAMWR); // write 252 | LCDData((color>>4)&0x00FF); 253 | LCDData(((color&0x0F)<<4)|(color>>8)); 254 | LCDData(color&0x0FF); 255 | } 256 | else if (driver == PHILIPS) // otherwise it's a phillips 257 | { 258 | LCDCommand(PASETP); // page start/end ram 259 | LCDData(x); 260 | LCDData(x); 261 | 262 | LCDCommand(CASETP); // column start/end ram 263 | LCDData(y); 264 | LCDData(y); 265 | 266 | LCDCommand(RAMWRP); // write 267 | 268 | LCDData((unsigned char)((color>>4)&0x00FF)); 269 | LCDData((unsigned char)(((color&0x0F)<<4)|0x00)); 270 | } 271 | } 272 | // 2/18/2013 This Methos added by Tony Contrada in order to create arc segments in varied line thickness, or Filled 273 | void LCDShield::setArc(int x0, int y0, int radius, int arcSegments[], int numSegments, int lineThickness, int color) 274 | { 275 | //Line Thickness (Num Pixels) 276 | if(lineThickness == FILL) lineThickness = radius; 277 | for(int i = 0; i < lineThickness; i++) 278 | { 279 | int f = 1 - radius; 280 | int ddF_x = 0; 281 | int ddF_y = -2 * radius; 282 | int x = 0; 283 | int y = radius; 284 | while(x < y) 285 | { 286 | if(f >= 0) 287 | { 288 | y--; 289 | ddF_y += 2; 290 | f += ddF_y; 291 | } 292 | x++; 293 | ddF_x += 2; 294 | f += ddF_x + 1; 295 | 296 | for(int i = 0; i < numSegments; i++) 297 | { 298 | if(arcSegments[i] == NNE) setPixel(color, x0 - y, y0 + x); //SHOW NNE 299 | if(arcSegments[i] == ENE) setPixel(color, x0 - x, y0 + y); //SHOW ENE 300 | if(arcSegments[i] == ESE) setPixel(color, x0 + x, y0 + y); //SHOW ESE 301 | if(arcSegments[i] == SSE) setPixel(color, x0 + y, y0 + x); //SHOW SSE 302 | if(arcSegments[i] == SSW) setPixel(color, x0 + y, y0 - x); //SHOW SSW 303 | if(arcSegments[i] == WSW) setPixel(color, x0 + x, y0 - y); //SHOW WSW 304 | if(arcSegments[i] == WNW) setPixel(color, x0 - x, y0 - y); //SHOW WNW 305 | if(arcSegments[i] == NNW) setPixel(color, x0 - y, y0 - x); //SHOW NNW 306 | } 307 | 308 | } 309 | radius--; 310 | } 311 | 312 | } 313 | 314 | // 2/22/2013 - Modified by Tony Contrada to include Line Thickness (in pixels) or a Filled Circle 315 | void LCDShield::setCircle (int x0, int y0, int radius, int color, int lineThickness) 316 | { 317 | if(lineThickness == FILL) lineThickness = radius; 318 | 319 | for(int r = 0; r < lineThickness; r++) 320 | { 321 | int f = 1 - radius; 322 | int ddF_x = 0; 323 | int ddF_y = -2 * radius; 324 | int x = 0; 325 | int y = radius; 326 | 327 | setPixel(color, x0, y0 + radius); 328 | setPixel(color, x0, y0 - radius); 329 | setPixel(color, x0 + radius, y0); 330 | setPixel(color, x0 - radius, y0); 331 | 332 | while(x < y) 333 | { 334 | if(f >= 0) 335 | { 336 | y--; 337 | ddF_y += 2; 338 | f += ddF_y; 339 | } 340 | x++; 341 | ddF_x += 2; 342 | f += ddF_x + 1; 343 | 344 | setPixel(color, x0 + x, y0 + y); 345 | setPixel(color, x0 - x, y0 + y); 346 | setPixel(color, x0 + x, y0 - y); 347 | setPixel(color, x0 - x, y0 - y); 348 | setPixel(color, x0 + y, y0 + x); 349 | setPixel(color, x0 - y, y0 + x); 350 | setPixel(color, x0 + y, y0 - x); 351 | setPixel(color, x0 - y, y0 - x); 352 | } 353 | radius--; 354 | } 355 | 356 | } 357 | 358 | void LCDShield::setChar(char c, int x, int y, int fColor, int bColor) 359 | { 360 | y = (COL_HEIGHT - 1) - y; // make display "right" side up 361 | x = (ROW_LENGTH - 2) - x; 362 | 363 | int i,j; 364 | unsigned int nCols; 365 | unsigned int nRows; 366 | unsigned int nBytes; 367 | unsigned char PixelRow; 368 | unsigned char Mask; 369 | unsigned int Word0; 370 | unsigned int Word1; 371 | const unsigned char *pFont; 372 | const unsigned char *pChar; 373 | 374 | // get pointer to the beginning of the selected font table 375 | pFont = (const unsigned char *)FONT8x16; 376 | // get the nColumns, nRows and nBytes 377 | nCols = pgm_read_byte(pFont); 378 | nRows = pgm_read_byte(pFont + 1); 379 | nBytes = pgm_read_byte(pFont + 2); 380 | // get pointer to the last byte of the desired character 381 | pChar = pFont + (nBytes * (c - 0x1F)) + nBytes - 1; 382 | 383 | if (driver) // if it's an epson 384 | { 385 | // Row address set (command 0x2B) 386 | LCDCommand(PASET); 387 | LCDData(x); 388 | LCDData(x + nRows - 1); 389 | // Column address set (command 0x2A) 390 | LCDCommand(CASET); 391 | LCDData(y); 392 | LCDData(y + nCols - 1); 393 | 394 | // WRITE MEMORY 395 | LCDCommand(RAMWR); 396 | // loop on each row, working backwards from the bottom to the top 397 | for (i = nRows - 1; i >= 0; i--) { 398 | // copy pixel row from font table and then decrement row 399 | PixelRow = pgm_read_byte(pChar++); 400 | // loop on each pixel in the row (left to right) 401 | // Note: we do two pixels each loop 402 | Mask = 0x80; 403 | for (j = 0; j < nCols; j += 2) 404 | { 405 | // if pixel bit set, use foreground color; else use the background color 406 | // now get the pixel color for two successive pixels 407 | if ((PixelRow & Mask) == 0) 408 | Word0 = bColor; 409 | else 410 | Word0 = fColor; 411 | Mask = Mask >> 1; 412 | if ((PixelRow & Mask) == 0) 413 | Word1 = bColor; 414 | else 415 | Word1 = fColor; 416 | Mask = Mask >> 1; 417 | // use this information to output three data bytes 418 | LCDData((Word0 >> 4) & 0xFF); 419 | LCDData(((Word0 & 0xF) << 4) | ((Word1 >> 8) & 0xF)); 420 | LCDData(Word1 & 0xFF); 421 | } 422 | } 423 | } 424 | else 425 | { 426 | fColor = swapColors(fColor); 427 | bColor = swapColors(bColor); 428 | 429 | // Row address set (command 0x2B) 430 | LCDCommand(PASETP); 431 | LCDData(x); 432 | LCDData(x + nRows - 1); 433 | // Column address set (command 0x2A) 434 | LCDCommand(CASETP); 435 | LCDData(y); 436 | LCDData(y + nCols - 1); 437 | 438 | // WRITE MEMORY 439 | LCDCommand(RAMWRP); 440 | // loop on each row, working backwards from the bottom to the top 441 | pChar+=nBytes-1; // stick pChar at the end of the row - gonna reverse print on phillips 442 | for (i = nRows - 1; i >= 0; i--) { 443 | // copy pixel row from font table and then decrement row 444 | PixelRow = pgm_read_byte(pChar--); 445 | // loop on each pixel in the row (left to right) 446 | // Note: we do two pixels each loop 447 | Mask = 0x01; // <- opposite of epson 448 | for (j = 0; j < nCols; j += 2) 449 | { 450 | // if pixel bit set, use foreground color; else use the background color 451 | // now get the pixel color for two successive pixels 452 | if ((PixelRow & Mask) == 0) 453 | Word0 = bColor; 454 | else 455 | Word0 = fColor; 456 | Mask = Mask << 1; // <- opposite of epson 457 | if ((PixelRow & Mask) == 0) 458 | Word1 = bColor; 459 | else 460 | Word1 = fColor; 461 | Mask = Mask << 1; // <- opposite of epson 462 | // use this information to output three data bytes 463 | LCDData((Word0 >> 4) & 0xFF); 464 | LCDData(((Word0 & 0xF) << 4) | ((Word1 >> 8) & 0xF)); 465 | LCDData(Word1 & 0xFF); 466 | } 467 | } 468 | } 469 | } 470 | 471 | 472 | void LCDShield::setStr(char *pString, int x, int y, int fColor, int bColor) 473 | { 474 | x = x + 16; 475 | y = y + 8; 476 | int originalY = y; 477 | 478 | // loop until null-terminator is seen 479 | while (*pString != 0x00) { 480 | // draw the character 481 | setChar(*pString++, x, y, fColor, bColor); 482 | // advance the y position 483 | y = y + 8; 484 | // bail out if y exceeds 131 485 | if (y > 131) { 486 | x = x + 16; 487 | y = originalY; 488 | } 489 | if (x > 123) break; 490 | } 491 | } 492 | 493 | void LCDShield::setLine(int x0, int y0, int x1, int y1, int color) 494 | { 495 | int dy = y1 - y0; // Difference between y0 and y1 496 | int dx = x1 - x0; // Difference between x0 and x1 497 | int stepx, stepy; 498 | 499 | if (dy < 0) 500 | { 501 | dy = -dy; 502 | stepy = -1; 503 | } 504 | else 505 | stepy = 1; 506 | 507 | if (dx < 0) 508 | { 509 | dx = -dx; 510 | stepx = -1; 511 | } 512 | else 513 | stepx = 1; 514 | 515 | dy <<= 1; // dy is now 2*dy 516 | dx <<= 1; // dx is now 2*dx 517 | setPixel(color, x0, y0); 518 | 519 | if (dx > dy) 520 | { 521 | int fraction = dy - (dx >> 1); 522 | while (x0 != x1) 523 | { 524 | if (fraction >= 0) 525 | { 526 | y0 += stepy; 527 | fraction -= dx; 528 | } 529 | x0 += stepx; 530 | fraction += dy; 531 | setPixel(color, x0, y0); 532 | } 533 | } 534 | else 535 | { 536 | int fraction = dx - (dy >> 1); 537 | while (y0 != y1) 538 | { 539 | if (fraction >= 0) 540 | { 541 | x0 += stepx; 542 | fraction -= dy; 543 | } 544 | y0 += stepy; 545 | fraction += dx; 546 | setPixel(color, x0, y0); 547 | } 548 | } 549 | } 550 | 551 | void LCDShield::setRect(int x0, int y0, int x1, int y1, unsigned char fill, int color) 552 | { 553 | // check if the rectangle is to be filled 554 | if (fill == 1) 555 | { 556 | int xDiff; 557 | 558 | if(x0 > x1) 559 | xDiff = x0 - x1; //Find the difference between the x vars 560 | else 561 | xDiff = x1 - x0; 562 | 563 | while(xDiff > 0) 564 | { 565 | setLine(x0, y0, x0, y1, color); 566 | 567 | if(x0 > x1) 568 | x0--; 569 | else 570 | x0++; 571 | 572 | xDiff--; 573 | } 574 | 575 | } 576 | else 577 | { 578 | // best way to draw an unfilled rectangle is to draw four lines 579 | setLine(x0, y0, x1, y0, color); 580 | setLine(x0, y1, x1, y1, color); 581 | setLine(x0, y0, x0, y1, color); 582 | setLine(x1, y0, x1, y1, color); 583 | } 584 | } 585 | 586 | void LCDShield::printLogo(void) 587 | { 588 | int x = 4, y = 25, logo_ix = 0, z; 589 | char logo; 590 | 591 | for (logo_ix = 0; logo_ix < 1120; logo_ix++) 592 | { 593 | logo = logo_spark[logo_ix]; 594 | for (z = 0; z < 8; z++) 595 | { 596 | if ((logo & 0x80) == 0x80) setPixel(RED, y, x); 597 | x++; 598 | if (x == 132) 599 | { 600 | x = 4; 601 | y++; 602 | } 603 | logo <<= 1; 604 | } 605 | } 606 | } 607 | 608 | void LCDShield::printBMP(char image_main[2048]){ //prints an image (BMP) 609 | int x = 4, y = 0, image_ix = 0, z; //starts on row 0 610 | char image; 611 | 612 | for (image_ix = 0; image_ix < 2048; image_ix++){ //for all the bits in the image 613 | image = image_main[image_ix]; 614 | 615 | for (z = 0; z <8; z++){ //for each bit in the byte 616 | if ((image & 0x80) == 0x80){ //if the bit is equal to 0, sets to white 617 | setPixel(WHITE, y, x); 618 | } else { 619 | setPixel(BLUE, y, x); //else sets it to black 620 | } 621 | x++; //adds one to x 622 | if (x == 132){ //if the end of the screen is reached 623 | x = 4; //sets x to 4 so not to be missed on edge of screen 624 | y++; //goes down a row 625 | } 626 | image <<= 1; //resets logo 627 | } 628 | } 629 | } 630 | 631 | void LCDShield::off(void) 632 | { 633 | if (driver) // If it's an epson 634 | LCDCommand(DISOFF); 635 | else // otherwise it's a phillips 636 | LCDCommand(DISPOFF); 637 | } 638 | 639 | void LCDShield::on(void) 640 | { 641 | if (driver) // If it's an epson 642 | LCDCommand(DISON); 643 | else // otherwise it's a phillips 644 | LCDCommand(DISPON); 645 | } 646 | 647 | -------------------------------------------------------------------------------- /Libraries/Arduino/src/SparkFunColorLCDShield.h: -------------------------------------------------------------------------------- 1 | /* 2 | ColorLCDShield.h - Arduino Library to control a Nokia 6100 LCD, 3 | specifically that found on SparkFun's Color LCD Shield. 4 | This code should work for both Epson and Phillips display drivers 5 | normally found on the Color LCD Shield. 6 | 7 | License: CC BY-SA 3.0: Creative Commons Share-alike 3.0. Feel free 8 | to use and abuse this code however you'd like. If you find it useful 9 | please attribute, and SHARE-ALIKE! 10 | 11 | This is based on code by Mark Sproul, and Peter Davenport. 12 | */ 13 | 14 | #ifndef SparkFunColorLCDShield_H 15 | #define SparkFunColorLCDShield_H 16 | 17 | #define PHILLIPS 0 18 | #define PHILIPS 0 19 | #define EPSON 1 20 | 21 | //#include 22 | 23 | #include 24 | #include 25 | 26 | //******************************************************* 27 | // Macros 28 | //******************************************************* 29 | #define sbi(var, mask) ((var) |= (uint8_t)(1 << mask)) 30 | #define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask)) 31 | 32 | //******************************************************************** 33 | // 34 | // LCD Dimension Definitions 35 | // 36 | //******************************************************************** 37 | #define ROW_LENGTH 132 38 | #define COL_HEIGHT 132 39 | #define ENDPAGE 132 40 | #define ENDCOL 130 41 | 42 | //******************************************************************** 43 | // 44 | // EPSON Controller Definitions 45 | // 46 | //******************************************************************** 47 | #define DISON 0xAF // Display on 48 | #define DISOFF 0xAE // Display off 49 | #define DISNOR 0xA6 // Normal display 50 | #define DISINV 0xA7 // Inverse display 51 | #define SLPIN 0x95 // Sleep in 52 | #define SLPOUT 0x94 // Sleep out 53 | #define COMSCN 0xBB // Common scan direction 54 | #define DISCTL 0xCA // Display control 55 | #define PASET 0x75 // Page address set 56 | #define CASET 0x15 // Column address set 57 | #define DATCTL 0xBC // Data scan direction, etc. 58 | #define RGBSET8 0xCE // 256-color position set 59 | #define RAMWR 0x5C // Writing to memory 60 | #define RAMRD 0x5D // Reading from memory 61 | #define PTLIN 0xA8 // Partial display in 62 | #define PTLOUT 0xA9 // Partial display out 63 | #define RMWIN 0xE0 // Read and modify write 64 | #define RMWOUT 0xEE // End 65 | #define ASCSET 0xAA // Area scroll set 66 | #define SCSTART 0xAB // Scroll start set 67 | #define OSCON 0xD1 // Internal oscillation on 68 | #define OSCOFF 0xD2 // Internal osciallation off 69 | #define PWRCTR 0x20 // Power control 70 | #define VOLCTR 0x81 // Electronic volume control 71 | #define VOLUP 0xD6 // Increment electronic control by 1 72 | #define VOLDOWN 0xD7 // Decrement electronic control by 1 73 | #define TMPGRD 0x82 // Temperature gradient set 74 | #define EPCTIN 0xCD // Control EEPROM 75 | #define EPCOUT 0xCC // Cancel EEPROM control 76 | #define EPMWR 0xFC // Write into EEPROM 77 | #define EPMRD 0xFD // Read from EEPROM 78 | #define EPSRRD1 0x7C // Read register 1 79 | #define EPSRRD2 0x7D // Read register 2 80 | #define NOP 0x25 // No op 81 | 82 | //******************************************************************** 83 | // 84 | // PHILLIPS Controller Definitions 85 | // 86 | //******************************************************************** 87 | //LCD Commands 88 | #define NOPP 0x00 // No operation 89 | #define BSTRON 0x03 // Booster voltage on 90 | #define SLEEPIN 0x10 // Sleep in 91 | #define SLEEPOUT 0x11 // Sleep out 92 | #define NORON 0x13 // Normal display mode on 93 | #define INVOFF 0x20 // Display inversion off 94 | #define INVON 0x21 // Display inversion on 95 | #define SETCON 0x25 // Set contrast 96 | #define DISPOFF 0x28 // Display off 97 | #define DISPON 0x29 // Display on 98 | #define CASETP 0x2A // Column address set 99 | #define PASETP 0x2B // Page address set 100 | #define RAMWRP 0x2C // Memory write 101 | #define RGBSET 0x2D // Color set 102 | #define MADCTL 0x36 // Memory data access control 103 | #define COLMOD 0x3A // Interface pixel format 104 | #define DISCTR 0xB9 // Super frame inversion 105 | #define EC 0xC0 // Internal or external oscillator 106 | 107 | //******************************************************* 108 | // 12-Bit Color Definitions 109 | //******************************************************* 110 | #define BLACK 0x000 111 | #define NAVY 0x008 112 | #define BLUE 0x00F 113 | #define TEAL 0x088 114 | #define EMERALD 0x0C5 115 | #define GREEN 0x0F0 116 | #define CYAN 0x0FF 117 | #define SLATE 0x244 118 | #define INDIGO 0x408 119 | #define TURQUOISE 0x4ED 120 | #define OLIVE 0x682 121 | #define MAROON 0x800 122 | #define PURPLE 0x808 123 | #define GRAY 0x888 124 | #define SKYBLUE 0x8CE 125 | #define BROWN 0xB22 126 | #define CRIMSON 0xD13 127 | #define ORCHID 0xD7D 128 | #define RED 0xF00 129 | #define MAGENTA 0xF0F 130 | #define ORANGE 0xF40 131 | #define PINK 0xF6A 132 | #define CORAL 0xF75 133 | #define SALMON 0xF87 134 | #define GOLD 0xFD0 135 | #define YELLOW 0xFF0 136 | #define WHITE 0xFFF 137 | 138 | //******************************************************* 139 | // Circle Definitions 140 | //******************************************************* 141 | #define FILL 0 142 | 143 | //****************************************************** 144 | // Arc Definitions 145 | //****************************************************** 146 | #define ESE 1 147 | #define ENE 2 148 | #define WSW 3 149 | #define WNW 4 150 | #define SSE 5 151 | #define NNE 6 152 | #define SSW 7 153 | #define NNW 8 154 | 155 | #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) 156 | //* Arduino Mega 2560 bit numbers 157 | #define LCD_PIN_RES 5 // D8 158 | #define LCD_PIN_CS 6 // D9 159 | #define LCD_PIN_DIO 5 // D11 160 | #define LCD_PIN_SCK 7 // D13 161 | 162 | //* Arduino Mega ports 163 | //* NOTE: See LCDShield::LCDShield() if making changes here 164 | #define LCD_PORT_CS PORTH 165 | #define LCD_PORT_SCK PORTB 166 | #define LCD_PORT_RES PORTH 167 | #define LCD_PORT_DIO PORTB 168 | #elif defined (__AVR_ATmega32U4__) 169 | //* Standard Arduino Leonardo port bits 170 | #define LCD_PIN_RES 4 // D8 171 | #define LCD_PIN_CS 5 // D9 172 | #define LCD_PIN_DIO 7 // D11 173 | #define LCD_PIN_SCK 7 // D13 174 | 175 | //* Arduino Leonardo ports: 176 | #define LCD_PORT_RES PORTB 177 | #define LCD_PORT_CS PORTB 178 | #define LCD_PORT_DIO PORTB 179 | #define LCD_PORT_SCK PORTC 180 | #else 181 | //* Arduino Duemilanove bit numbers 182 | #define LCD_PIN_RES 0 // D8 183 | #define LCD_PIN_CS 1 // D9 184 | #define LCD_PIN_DIO 3 // D11 185 | #define LCD_PIN_SCK 5 // D13 186 | //#define LCD_PORT PORTB 187 | 188 | //* Arduino Duemilanove ports 189 | #define LCD_PORT_CS PORTB 190 | #define LCD_PORT_SCK PORTB 191 | #define LCD_PORT_RES PORTB 192 | #define LCD_PORT_DIO PORTB 193 | #endif 194 | 195 | const unsigned char FONT8x16[97][16] PROGMEM = { 196 | {0x08,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // columns, rows, bytes, ... 197 | {0x08,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // columns, rows, bytes, ... 198 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // ' ' 199 | {0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, // '!' 200 | {0x00,0x63,0x63,0x63,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '"' 201 | {0x00,0x00,0x00,0x36,0x36,0x7F,0x36,0x36,0x36,0x7F,0x36,0x36,0x00,0x00,0x00,0x00}, // '#' 202 | {0x0C,0x0C,0x3E,0x63,0x61,0x60,0x3E,0x03,0x03,0x43,0x63,0x3E,0x0C,0x0C,0x00,0x00}, // '$' 203 | {0x00,0x00,0x00,0x00,0x00,0x61,0x63,0x06,0x0C,0x18,0x33,0x63,0x00,0x00,0x00,0x00}, // '%' 204 | {0x00,0x00,0x00,0x1C,0x36,0x36,0x1C,0x3B,0x6E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, 205 | {0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 206 | {0x00,0x00,0x0C,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0C,0x00,0x00,0x00,0x00}, 207 | {0x00,0x00,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x00,0x00,0x00,0x00}, 208 | {0x00,0x00,0x00,0x00,0x42,0x66,0x3C,0xFF,0x3C,0x66,0x42,0x00,0x00,0x00,0x00,0x00}, 209 | {0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00}, 210 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00}, 211 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 212 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, 213 | {0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00}, 214 | {0x00,0x00,0x3E,0x63,0x63,0x63,0x6B,0x6B,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // '0' 215 | {0x00,0x00,0x0C,0x1C,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3F,0x00,0x00,0x00,0x00}, 216 | {0x00,0x00,0x3E,0x63,0x03,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00}, 217 | {0x00,0x00,0x3E,0x63,0x03,0x03,0x1E,0x03,0x03,0x03,0x63,0x3E,0x00,0x00,0x00,0x00}, 218 | {0x00,0x00,0x06,0x0E,0x1E,0x36,0x66,0x66,0x7F,0x06,0x06,0x0F,0x00,0x00,0x00,0x00}, 219 | {0x00,0x00,0x7F,0x60,0x60,0x60,0x7E,0x03,0x03,0x63,0x73,0x3E,0x00,0x00,0x00,0x00}, // '5' 220 | {0x00,0x00,0x1C,0x30,0x60,0x60,0x7E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, 221 | {0x00,0x00,0x7F,0x63,0x03,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x00,0x00,0x00,0x00}, 222 | {0x00,0x00,0x3E,0x63,0x63,0x63,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, 223 | {0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x3F,0x03,0x03,0x06,0x3C,0x00,0x00,0x00,0x00}, 224 | {0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, // ':' 225 | {0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00}, 226 | {0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00}, 227 | {0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00}, 228 | {0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00}, 229 | {0x00,0x00,0x3E,0x63,0x63,0x06,0x0C,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00}, 230 | {0x00,0x00,0x3E,0x63,0x63,0x6F,0x6B,0x6B,0x6E,0x60,0x60,0x3E,0x00,0x00,0x00,0x00}, 231 | {0x00,0x00,0x08,0x1C,0x36,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // 'A' 232 | {0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x33,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,0x00}, 233 | {0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1E,0x00,0x00,0x00,0x00}, // 'C' 234 | {0x00,0x00,0x7C,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7C,0x00,0x00,0x00,0x00}, 235 | {0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00}, 236 | {0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, 237 | {0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x6F,0x63,0x63,0x37,0x1D,0x00,0x00,0x00,0x00}, 238 | {0x00,0x00,0x63,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // 'H' 239 | {0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}, 240 | {0x00,0x00,0x0F,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00}, 241 | {0x00,0x00,0x73,0x33,0x36,0x36,0x3C,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00}, 242 | {0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00}, 243 | {0x00,0x00,0x63,0x77,0x7F,0x6B,0x63,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, 244 | {0x00,0x00,0x63,0x63,0x73,0x7B,0x7F,0x6F,0x67,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, 245 | {0x00,0x00,0x1C,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00}, 246 | {0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, 247 | {0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x6B,0x6F,0x3E,0x06,0x07,0x00,0x00}, 248 | {0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00}, 249 | {0x00,0x00,0x3E,0x63,0x63,0x30,0x1C,0x06,0x03,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, 250 | {0x00,0x00,0xFF,0xDB,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}, 251 | {0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, 252 | {0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x08,0x00,0x00,0x00,0x00}, 253 | {0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x36,0x00,0x00,0x00,0x00}, 254 | {0x00,0x00,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x3C,0x66,0xC3,0xC3,0x00,0x00,0x00,0x00}, 255 | {0x00,0x00,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}, 256 | {0x00,0x00,0x7F,0x63,0x43,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00}, // 'Z' 257 | {0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00}, 258 | {0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x07,0x03,0x01,0x00,0x00,0x00,0x00}, // '\' 259 | {0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00}, 260 | {0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 261 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00}, // '^' 262 | {0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 263 | {0x00,0x00,0x00,0x00,0x00,0x3C,0x46,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, // '_' 264 | {0x00,0x00,0x70,0x30,0x30,0x3C,0x36,0x33,0x33,0x33,0x33,0x6E,0x00,0x00,0x00,0x00}, // '`' 265 | {0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00,0x00}, // 'a' 266 | {0x00,0x00,0x0E,0x06,0x06,0x1E,0x36,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, 267 | {0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x7E,0x60,0x63,0x3E,0x00,0x00,0x00,0x00}, 268 | {0x00,0x00,0x1C,0x36,0x32,0x30,0x7C,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, 269 | {0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00}, 270 | {0x00,0x00,0x70,0x30,0x30,0x36,0x3B,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00}, 271 | {0x00,0x00,0x0C,0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00}, 272 | {0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00}, 273 | {0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3C,0x36,0x33,0x73,0x00,0x00,0x00,0x00}, 274 | {0x00,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00}, 275 | {0x00,0x00,0x00,0x00,0x00,0x6E,0x7F,0x6B,0x6B,0x6B,0x6B,0x6B,0x00,0x00,0x00,0x00}, 276 | {0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00}, 277 | {0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, 278 | {0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x3E,0x30,0x30,0x78,0x00,0x00}, 279 | {0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x06,0x0F,0x00,0x00}, 280 | {0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, 281 | {0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x38,0x0E,0x03,0x63,0x3E,0x00,0x00,0x00,0x00}, 282 | {0x00,0x00,0x08,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x1B,0x0E,0x00,0x00,0x00,0x00}, // 't' 283 | {0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, 284 | {0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x36,0x1C,0x1C,0x08,0x00,0x00,0x00,0x00}, 285 | {0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x00,0x00,0x00,0x00}, 286 | {0x00,0x00,0x00,0x00,0x00,0x63,0x36,0x1C,0x1C,0x1C,0x36,0x63,0x00,0x00,0x00,0x00}, 287 | {0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x3F,0x03,0x06,0x3C,0x00,0x00}, 288 | {0x00,0x00,0x00,0x00,0x00,0x7F,0x66,0x0C,0x18,0x30,0x63,0x7F,0x00,0x00,0x00,0x00}, // 'z' 289 | {0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00}, // '{' 290 | {0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00}, // '|' 291 | {0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00}, // '}' 292 | {0x00,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // '~' 293 | }; 294 | 295 | static char logo_spark[1120] = { 296 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 297 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 298 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 299 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 300 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 301 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 302 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 303 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 304 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x3f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, 305 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x3f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, 306 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, 307 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 308 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 309 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 310 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 311 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 312 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 313 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 314 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 315 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 316 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 317 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 318 | 0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x20,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 319 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 320 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 321 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 322 | 0x0f,0xe0,0x9f,0x01,0xfc,0x09,0x9e,0x1e,0x7f,0x70,0x73,0x9f,0x00,0x00,0x00,0x00, 323 | 0x3f,0xf1,0xff,0x87,0xfe,0x3f,0xde,0x3d,0xff,0x78,0xf3,0xff,0x80,0x00,0x00,0x00, 324 | 0x3c,0xf9,0xff,0xc7,0xdf,0x3f,0xde,0x79,0xff,0x78,0xf3,0xff,0xc0,0x00,0x00,0x00, 325 | 0x78,0x79,0xc3,0xcf,0x0f,0x3f,0x1c,0xf0,0x3c,0x78,0xf3,0xe3,0xc0,0x00,0x00,0x00, 326 | 0x7c,0x01,0xc1,0xe0,0x0f,0x3e,0x1f,0xe0,0x3c,0x78,0xf3,0xc3,0xc0,0x00,0x00,0x00, 327 | 0x3f,0xc1,0x81,0xe0,0x3f,0x3c,0x1f,0xe0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 328 | 0x1f,0xf1,0x81,0xe3,0xff,0x3c,0x1f,0xe0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 329 | 0x07,0xf9,0x81,0xe7,0xef,0x3c,0x1f,0xf0,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 330 | 0x00,0xf9,0x81,0xef,0x07,0x3c,0x1e,0xf8,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 331 | 0x78,0x79,0xc1,0xef,0x0f,0x3c,0x1e,0x78,0x3c,0x78,0xf3,0xc1,0xc0,0x00,0x00,0x00, 332 | 0x78,0x79,0xe3,0xcf,0x0f,0x3c,0x1e,0x3c,0x3c,0x7c,0xf3,0xc1,0xc0,0x00,0x00,0x00, 333 | 0x3f,0xf9,0xff,0xcf,0xff,0x3c,0x1e,0x3e,0x3c,0x7f,0xf3,0xc1,0xcf,0x00,0x00,0x00, 334 | 0x1f,0xf1,0xff,0x87,0xff,0x3c,0x1e,0x1e,0x3c,0x3f,0xf3,0xc1,0xc7,0x00,0x00,0x00, 335 | 0x07,0xc1,0x9e,0x03,0xe0,0x00,0x00,0x02,0x00,0x0e,0x20,0x00,0x00,0x00,0x00,0x00, 336 | 0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 337 | 0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 338 | 0x00,0x03,0x80,0x00,0x00,0x00,0xc0,0x00,0x00,0x18,0x00,0x00,0x08,0x08,0x00,0x00, 339 | 0x00,0x01,0x87,0xc3,0x03,0xe0,0xe1,0xf0,0xf8,0x3e,0x33,0x08,0x3e,0x1e,0x00,0x00, 340 | 0x00,0x01,0x86,0x03,0x03,0x01,0xb0,0xe0,0xdc,0x66,0x3b,0x08,0x66,0x32,0x00,0x00, 341 | 0x00,0x00,0x87,0xc3,0x03,0xe1,0x80,0x40,0xd8,0x63,0x3b,0x08,0x60,0x3c,0x00,0x00, 342 | 0x00,0x00,0x87,0x83,0x03,0xc1,0x80,0x40,0xf8,0x63,0x3f,0x08,0x60,0x0e,0x00,0x00, 343 | 0x00,0x00,0x06,0x03,0x03,0x01,0xb0,0x40,0xd8,0x66,0x37,0x08,0x66,0x32,0x00,0x00, 344 | 0x00,0x00,0x07,0xc3,0xe3,0xe0,0xe0,0x40,0xc8,0x3e,0x33,0x08,0x3e,0x3e,0x00,0x00, 345 | 0x00,0x00,0x07,0xc3,0xe3,0xe0,0xe0,0x40,0x88,0x3c,0x33,0x08,0x3c,0x1e,0x00,0x00, 346 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 347 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 348 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 349 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 350 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 351 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 352 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; 353 | 354 | 355 | class LCDShield 356 | { 357 | private: 358 | void LCDCommand(unsigned char data); 359 | void LCDData(unsigned char data); 360 | uint8_t driver; 361 | uint16_t swapColors(uint16_t in); 362 | public: 363 | LCDShield(); 364 | 365 | void init(int type, bool colorSwap = 0); 366 | void clear(int color); 367 | void contrast(char setting); 368 | 369 | void setPixel(int color, unsigned char x, unsigned char y); 370 | void setCircle (int x0, int y0, int radius, int color, int lineThickness = 1); 371 | void setArc(int x0, int y0, int radius, int segments[], int numSegments, int lineThickness, int color); 372 | 373 | void setChar(char c, int x, int y, int fColor, int bColor); 374 | void setStr(char *pString, int x, int y, int fColor, int bColor); 375 | 376 | 377 | void setLine(int x0, int y0, int x1, int y1, int color); 378 | void setRect(int x0, int y0, int x1, int y1, unsigned char fill, int color); 379 | 380 | void printBMP(char image_main[2048]); 381 | 382 | void printLogo(void); 383 | 384 | void on(void); 385 | void off(void); 386 | }; 387 | 388 | #endif // SparkFunColorLCDShield_H 389 | -------------------------------------------------------------------------------- /Libraries/README.md: -------------------------------------------------------------------------------- 1 | SparkFun Color LCD Shield Libraries 2 | ================================= 3 | 4 | Libraries for use in different environments. 5 | 6 | 7 | Directory Contents 8 | ------------------- 9 | * **/Arduino** - [Arduino IDE](http://www.arduino.cc/en/Main/Software) library. Currently version 1.0.1 10 | 11 | 12 | 13 | Update Library Instructions: 14 | ---------------------------- 15 | If you would like the most up-to-date version of the library, you must use the following commands on the command line. 16 | 17 | $git subtree add -P Libraries/Arduino --squash git@github.com:sparkfun/SparkFun_Color_LCD_Shield_Arduino_Library.git master 18 | 19 | $git subtree pull -P Libraries/Arduino --squash git@github.com:sparkfun/SparkFun_Color_LCD_Shield_Arduino_Library.git master 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **NOTE:** *This product has been retired from our catalog. If you are looking for more up-to-date info, please check out some of these resources to see how other users are still hacking and improving on this product.* 2 | * *[SparkFun Forum](https://forum.sparkfun.com/)* 3 | * *[Comments Here on GitHub](https://github.com/sparkfun/ColorLCDShield/issues)* 4 | * *[IRC Channel](https://www.sparkfun.com/news/263)* 5 | 6 | SparkFun Color LCD Shield 7 | ========================== 8 | 9 | [![SparkFun Color LCD Shield](https://dlnmh9ip6v2uc.cloudfront.net/images/products/9/3/6/3/09363-01b_i_ma.jpg) 10 | *Color LCD Shield (LCD-09363)*](https://www.sparkfun.com/products/9363) 11 | 12 | The Color LCD Shield interfaces your Arduino with a knock-off [132x132 Nokia 6100 LCD](https://www.sparkfun.com/products/569). The LCD is available with one of two controlling drivers - a [Philips PCF8833](https://dlnmh9ip6v2uc.cloudfront.net/datasheets/LCD/Color/PCF8833_1.pdf) or an Epson [S1D15G10](https://dlnmh9ip6v2uc.cloudfront.net/datasheets/LCD/Color/S1D15G10D08BE_TM_MF1493_03.pdf). 13 | 14 | A really great resource for working with both the Epson and Philips controllers is Jim Lynch's [Display Driver tutorial](http://www.sparkfun.com/tutorial/Nokia%206100%20LCD%20Display%20Driver.pdf). Much of this example code stems from that document. 15 | 16 | Documentation 17 | -------------- 18 | * **[Library](https://github.com/sparkfun/SparkFun_Color_LCD_Shield_Arduino_Library)** - Arduino library for the color LCD shield. 19 | * **[Hookup Guide](https://www.sparkfun.com/tutorials/286)** - Basic hookup guide for the SparkFun Color LCD Shield. 20 | 21 | Repository Contents 22 | ------------------- 23 | 24 | * **/hardware** - Hardware design files for the Color LCD Shield PCB. These files were designed in Eagle CAD. 25 | * **/Libraries** - Arduino library for use with the SparkFun Color LCD Shield. 26 | 27 | License Information 28 | ---------------- 29 | 30 | The hardware and example firmware are released under [Creative Commons Share-alike 3.0](http://creativecommons.org/licenses/by-sa/3.0/). 31 | -------------------------------------------------------------------------------- /hardware/Color-LCD-Shield.brd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sparkfun/ColorLCDShield/d91e5bb9a7f7cb1989065af73299011ec15419ab/hardware/Color-LCD-Shield.brd -------------------------------------------------------------------------------- /hardware/Color-LCD-Shield.sch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sparkfun/ColorLCDShield/d91e5bb9a7f7cb1989065af73299011ec15419ab/hardware/Color-LCD-Shield.sch --------------------------------------------------------------------------------