Skip to content
Browse files

Tidying up Repo.

Just a bit of house keeping to remove several old versions of the
library. Version 3.5 is still the latest version. Version 2.5 is there
only for programs which were written prior to V3.x
  • Loading branch information...
1 parent 1e578de commit 7cb718fc08df4533e95e33fe8cc13790af0f1c00 @TCWORLD committed Aug 8, 2013
Showing with 0 additions and 8,538 deletions.
  1. BIN Downloads/gLCD v3_0.zip
  2. BIN Downloads/gLCD v3_2.zip
  3. BIN Downloads/gLCD v3_3.zip
  4. BIN Downloads/gLCD v3_4.zip
  5. 0 Upgrading to 3_0 from 2_x.txt → Upgrading to 3_x from 2_x.txt
  6. 0 {Version 2_5 → Version 2_5 (depreciated)}/examples/BasicFunctions/BasicFunctions.pde
  7. 0 {Version 2_5 → Version 2_5 (depreciated)}/examples/TestPattern/TestPattern.pde
  8. 0 {Version 2_5 → Version 2_5 (depreciated)}/gLCD.cpp
  9. 0 {Version 2_5 → Version 2_5 (depreciated)}/gLCD.h
  10. 0 {Version 2_5 → Version 2_5 (depreciated)}/keywords.txt
  11. +0 −239 Version 3_0/examples/BasicFunctions/BasicFunctions.pde
  12. +0 −105 Version 3_0/examples/TestPattern/TestPattern.pde
  13. +0 −1,244 Version 3_0/gLCD.cpp
  14. +0 −346 Version 3_0/gLCD.h
  15. +0 −39 Version 3_0/keywords.txt
  16. +0 −250 Version 3_2/examples/BasicFunctions/BasicFunctions.pde
  17. +0 −111 Version 3_2/examples/TestPattern/TestPattern.pde
  18. +0 −1,152 Version 3_2/gLCD.cpp
  19. +0 −450 Version 3_2/gLCD.h
  20. +0 −63 Version 3_2/keywords.txt
  21. +0 −304 Version 3_3/examples/BasicFunctions/BasicFunctions.pde
  22. +0 −111 Version 3_3/examples/TestPattern/TestPattern.pde
  23. +0 −1,206 Version 3_3/gLCD.cpp
  24. +0 −473 Version 3_3/gLCD.h
  25. +0 −67 Version 3_3/keywords.txt
  26. +0 −304 Version 3_4/examples/BasicFunctions/BasicFunctions.pde
  27. +0 −176 Version 3_4/examples/ImageRotation/ImageRotation.pde
  28. +0 −111 Version 3_4/examples/TestPattern/TestPattern.pde
  29. +0 −1,207 Version 3_4/gLCD.cpp
  30. +0 −508 Version 3_4/gLCD.h
  31. +0 −72 Version 3_4/keywords.txt
  32. 0 {Version 3_5 → Version 3_5 (current)}/examples/BasicFunctions/BasicFunctions.pde
  33. 0 {Version 3_5 → Version 3_5 (current)}/examples/ImageRotation/ImageRotation.pde
  34. 0 {Version 3_5 → Version 3_5 (current)}/examples/TestPattern/TestPattern.pde
  35. 0 {Version 3_5 → Version 3_5 (current)}/gLCD.cpp
  36. 0 {Version 3_5 → Version 3_5 (current)}/gLCD.h
  37. 0 {Version 3_5 → Version 3_5 (current)}/keywords.txt
View
BIN Downloads/gLCD v3_0.zip
Binary file not shown.
View
BIN Downloads/gLCD v3_2.zip
Binary file not shown.
View
BIN Downloads/gLCD v3_3.zip
Binary file not shown.
View
BIN Downloads/gLCD v3_4.zip
Binary file not shown.
View
0 Upgrading to 3_0 from 2_x.txt → Upgrading to 3_x from 2_x.txt
File renamed without changes.
View
0 ...xamples/BasicFunctions/BasicFunctions.pde → ...xamples/BasicFunctions/BasicFunctions.pde
File renamed without changes.
View
0 ... 2_5/examples/TestPattern/TestPattern.pde → ...ted)/examples/TestPattern/TestPattern.pde
File renamed without changes.
View
0 Version 2_5/gLCD.cpp → Version 2_5 (depreciated)/gLCD.cpp
File renamed without changes.
View
0 Version 2_5/gLCD.h → Version 2_5 (depreciated)/gLCD.h
File renamed without changes.
View
0 Version 2_5/keywords.txt → Version 2_5 (depreciated)/keywords.txt
File renamed without changes.
View
239 Version 3_0/examples/BasicFunctions/BasicFunctions.pde
@@ -1,239 +0,0 @@
-/*
- gLCD Library Example 1:
-
- This example shows how to use the basic functions: Line, Plot, Box, Circle, Print, SetForeColour, and SetBackColour.
-
- gLCD should work for all Nokia Clone 128x128 screens which have the
- Epson or Phillips controller chip.
-*/
-
-#include <gLCD.h>
-
-//You can use these variables to set the pin numbers
-const char RST = 8;
-const char CS = 9;
-const char Clk = 13;
-const char Data = 11;
-
-/*Create an instance of the display. Lets call it 'graphic'.
- There are four variables,
- which define which pins the LCD is connected too.
- these are:
- Reset, Chip Select, Clock, Data.
-
- A fifth variable 'speed' can be included as 0 or 1, which controls whether to enter high speed mode (see below).
- If the fifth variable is omitted (i.e. only the first four are given), normal speed mode is implied.
-
- gLCD graphic(RST,CS,Clk,Data [,speed]);
-
- Note, it is also possible to enable a high speed mode which increases the speed of the display
- by a factor of >5. This is done through the library bypassing the digitalWrite function and
- directly addressing port registers.
-
- Please note that while this doesn't affect how you use the library (it is all handled internally),
- it is possible that it may run too fast for your display and thus the display will appear to not work.
- This is UNLIKELY to happen, and I have checked with several displays which all worked fine.
-
- As of version 2.4 nothing special needs to be done to use this high speed mode, so I am now mentioning
- it is the example file.
-
-*/
-//For normal speed, use:
-gLCD graphic(RST,CS,Clk,Data,NORMAL_SPEED); //Normal speed
-
-//For high speed, use:
-// gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed
-
-
-void setup() {
- /*Display needs to be initialised. You only need to do this once,
- You may have to press the Arduino reset button after uploading
- your code as the screen may fail to startup otherwise
-
- The first two variables in the begin() call specify where on the screen
- (0,0) is. On some screens the first one or two rows/cols of
- pixels aren't visible, so begin(X,Y,,) allows all X and Y co-ords
- to be shifted slightly. (0,2) works well for both my screens.
-
- The third variable specifies whether the colours are inverted.
- If the White background is Black on your screen, set this to a 1
- Else leave it as a zero
-
- The fourth variable is the driver to use you can choose from:
- EPSON
- PHILLIPS_0
- PHILLIPS_1
- PHILLIPS_2
- PHILLIPS_3
-
- For an Epson Screen:
- */
-
- graphic.begin(0,2,0,EPSON);
-
- //For a Phillips Screen:
- //This
- //graphic.begin(0,2,0,PHILLIPS_0); //Normal X direction
- //or
- //graphic.begin(0,2,0,PHILLIPS_1); //Revesed X direction.
- //or
- //graphic.begin(0,2,0,PHILLIPS_2); //Normal X direction, Mirrored.
- //or
- //graphic.begin(0,2,0,PHILLIPS_3); //Revesed X direction, Mirrored.
-
-
-
- /*If you can't see the colours properly, then uncomment the
- graphic.Contrast() function.
- If the Screen is too dark, or you cant see anything send a value >0x2B (>0x30 for Phillips). If you cant see all
- the different colours distinctly on the test pattern, send a value <0x2B (<0x30 for Phillips). The default values
- should work for many screens, so you may not have to use this at all.
-
- Range for phillips: -0x3F to 0x3F
- Range for EPSON: 0x00 to 0x3F
- */
-
- //graphic.Contrast(0x2B);
-}
-void loop() {
- /*Lets draw a box...
-
- First we set the background colour and foreground colour
- We use the SetBackColour function to do this.
- The function takes three bytes, which are: Red, Green, Blue.
- Each of these is a 4 bit number where 0 = off, 15 = fully on.
- */
-
- //We want a white background, so that would be 15 for each variable
- graphic.setBackColour(15,15,15);
-
- //We want a red foreground, so red will be 15 and the others 0
- graphic.setForeColour(15,0,0);
-
- /*Now We draw our box. Lets use the Box() function.
- Box( X1, Y1, X2, Y2, format) takes 5 variables.
-
- The first two are: X1, Y1. These are bytes which represent the (x,y) co-ord where the box will start
-
- The second two are: X2, Y2. These bytes represent the (x,y) co-ord where the box will end. NOTE: This coodinate will also be included in the box
-
- The final one is: format. This controls how the box will look (b7..b3 are ignored)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 1 | x | Draws a box with just a border of colour BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 1 | x | Draws a box with just a border of colour ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 0 | Draws a box with border in BackColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 0 | Draws a box with border in ForeColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 1 | Draws a box with border in BackColour and fill inside it with ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 1 | Draws a box with border in ForeColour and fill inside it with ForeColour
-
- Lets draw a box which starts from (10,10) and is 100 pixes square. So, X1 = 10,
- Y1 = 10,
- X2 = 10 + 99, <- Because X2,Y2 will be part of the box
- Y2 = 10 + 99
- It will have a border coloured Red, and be filled with the background colour. So, 'format' = 4
- */
- graphic.Box(10,10,109,109,4);
-
- //Inside is another box filled in the foreground colour
- graphic.Box(20,20,99,99,5);
-
- /* Next we will write Hello in the centre. For this we need to use the print() function. This behaves exactly like Serial.print() only it prints to the screen not the
- serial port.
-
- First though we need to setup the text. There are two functions to do this.
- setCoordinate(X,Y);
- and
- setFont(Font);
-
- In setCoordinate(X,Y), we set the co-ordinates of where the text will be placed on the screen - (X,Y) pixels denotes the top left corner.
- NOTE: Currently there is no text wrap so strings that dont fit on the screen will be clipped.
- However you can use a '\n' character to print the characters following it on a new line directly below.
-
- Then, in setFont(Font), we set the Font. This controls the vertical and horizontal scaling of the text, and also whether it has a solid or transparent background.
- Font bits have the following meaning: (b7..b3 are ignored - maybe future use)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+---------------------------------------
- 0 | x | x | Text has transparent background
- ----+----+----+---------------------------------------
- 1 | x | x | Text has solid background
- ----+----+----+---------------------------------------
- x | 0 | 0 | Text normal. (6 x 8 pixels)
- ----+----+----+---------------------------------------
- x | 0 | 1 | Text Wide. (12 x 8 pixels)
- ----+----+----+---------------------------------------
- x | 1 | 0 | Text Tall. (6 x 16 pixels)
- ----+----+----+---------------------------------------
- x | 1 | 1 | Text Tall and Wide. (12 x 16 pixels)
- We then finally call the print function with our text or variable, e.g.
- graphic.print("Some Text");
- See print() in the Arduino Reference for more detains.
- */
- graphic.setForeColour(0,0,15); //Text is coloured Blue
- graphic.setFont(0);
- graphic.setCoordinate(40,40);
- graphic.print("Hello\nWorld"); //Normal sized text, no background. Hello and World will be printed on seperate lines
-
- /* Now lets double underline the text twice. Each normal character takes up 6 x 8 pixels, so we need to draw a line 8+9 pixels below the top of the text as there are two lines.
- The line is 6*5 = 30px long. And a second of the same length which is 11 pixels below the top of the text.
-
- For this we can use the Line() Function.
- Line(X1,X2,Y1,Y2,Colour) takes five variables
-
- Firstly X1 and Y1 are both unsigned chars which are where the line starts.
-
- The second two are: X2,Y2. These are the last point on the line.
-
- Lastly: Colour. This defines whether the line should be in Foreground colour (Colour = 1) or Background colour (Colour = 0)
- */
- graphic.Line(40,57,69,57,4); // The lines will be Blue as that was the last foreground colour that was set.
- graphic.Line(40,59,69,59,4);
-
- /* The next function is Circle().
- Circle(X1,Y1,Radius,Format) takes four variables
-
- The first two are: X1, Y1. These are bytes which represent the (x,y) co-ord of the centre of the circle.
-
- The next is: Radius. This is the radius of the circle in pixels.
-
- The final one is: Format. This controls how the Circle will look (b7..b3 are ignored)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 1 | x | Draws a Circle with just a border of colour BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 1 | x | Draws a Circle with just a border of colour ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 0 | Draws a Circle with border in BackColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 0 | Draws a Circle with border in ForeColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 1 | Draws a Circle with border in BackColour and fill inside it with ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 1 | Draws a Circle with border in ForeColour and fill inside it with ForeColour
-
- */
- graphic.Circle(66,74,15,4); //Draw circle of radius 10px, filled with the background colour
-
- /* The last basic function is Plot(). This simply sets the colour of the pixel at (x,y) to the current foreground colour.
- Plot(X,Y) takes three variables.
-
- X and Y are the co-odinate where the dot is drawn.
-
- Colour defines whether the line should be in Foreground colour (Colour = 3) or Background colour (Colour = 0)
- */
- for (int i = 15;i < 19;i++){
- for (int j = 17;j < 21;j++){
- graphic.Plot((i*4), (j*4),3); //Draw a grid of 16 dots.
- }
- }
-
- while(1); //Finished
-}
View
105 Version 3_0/examples/TestPattern/TestPattern.pde
@@ -1,105 +0,0 @@
-/*
- gLCD Library Example 1:
-
- This example shows you how to create an instance of the display,
- connect it to the correct pins, and then display the built in
- Test Pattern.
-
- gLCD should work for all Nokia Clone 128x128 screens which have the
- Epson controller chip.
-*/
-
-#include <gLCD.h>
-
-//You can use these variables to set the pin numbers
-const char RST = 8;
-const char CS = 9;
-const char Clk = 13;
-const char Data = 11;
-
-
-/*Create an instance of the display. Lets call it 'graphic'.
- There are four variables,
- which define which pins the LCD is connected too.
- these are:
- Reset, Chip Select, Clock, Data.
-
- A fifth variable 'speed' can be included as 0 or 1, which controls whether to enter high speed mode (see below).
- If the fifth variable is omitted (i.e. only the first four are given), normal speed mode is implied.
-
- gLCD graphic(RST,CS,Clk,Data [,speed]);
-
- Note, it is also possible to enable a high speed mode which increases the speed of the display
- by a factor of ~5. This is done through the library bypassing the digitalWrite function and
- directly addressing port registers.
-
- Please note that while this doesn't affect how you use the library (it is all handled internally),
- it is possible that it may run too fast for your display and thus the display will appear to not work.
- This is UNLIKELY to happen, and I have checked with several displays which all worked fine.
-
- As of version 2.4 nothing special needs to be done to use this high speed mode, so I am now mentioning
- it is the example file.
-
-*/
-//For normal speed, use:
-gLCD graphic(RST,CS,Clk,Data,NORMAL_SPEED); //Normal speed
-
-//For high speed, use:
-// gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed
-
-
-void setup() {
- /*Display needs to be initialised. You only need to do this once,
- You may have to press the Arduino reset button after uploading
- your code as the screen may fail to startup otherwise
-
- The first two variables in the begin() call specify where on the screen
- (0,0) is. On some screens the first one or two rows/cols of
- pixels aren't visible, so begin(X,Y,,) allows all X and Y co-ords
- to be shifted slightly. (0,2) works well for both my screens.
-
- The third variable specifies whether the colours are inverted.
- If the White background is Black on your screen, set this to a 1
- Else leave it as a zero
-
- The fourth variable is the driver to use you can choose from:
- EPSON
- PHILLIPS_0
- PHILLIPS_1
- PHILLIPS_2
- PHILLIPS_3
-
- For an Epson Screen:
- */
-
- graphic.begin(0,2,0,EPSON);
-
- //For a Phillips Screen:
- //This
- //graphic.begin(0,2,0,PHILLIPS_0); //Normal X direction
- //or
- //graphic.begin(0,2,0,PHILLIPS_1); //Revesed X direction.
- //or
- //graphic.begin(0,2,0,PHILLIPS_2); //Normal X direction, Mirrored.
- //or
- //graphic.begin(0,2,0,PHILLIPS_3); //Revesed X direction, Mirrored.
-
-
- /*If you can't see the colours properly, then uncomment the
- graphic.Contrast() function.
- If the Screen is too dark, or you cant see anything send a value >0x2B (>0x30 for Phillips). If you cant see all
- the different colours distinctly on the test pattern, send a value <0x2B (<0x30 for Phillips). The default values
- should work for many screens, so you may not have to use this at all.
-
- Range for phillips: -0x3F to 0x3F
- Range for EPSON: 0x00 to 0x3F
- */
-
- //graphic.Contrast(0x2B);
-
-}
-void loop() {
- //Print out the test pattern.
- graphic.testPattern();
- while(1); //Finished
-}
View
1,244 Version 3_0/gLCD.cpp
@@ -1,1244 +0,0 @@
-/*
- Sparkfun Nokia knockoff screen 128x128 controller. Should work with (all) screens.
-
- Code written by Thomas Carpenter (2011)
-
- See header file for function descriptions and ChangeLog
-
-*/
-#if ARDUINO >= 100
- #include "Arduino.h"
-#else
- #include "WProgram.h"
-#endif
-#include "gLCD.h"
-#include <avr/pgmspace.h>
-
-//Character Database store
-
-//This is how many custom characters you have added to the end of the map. There are no more than 128 allowed.
-#define numberOfCustomCharacters 9
-byte charData[96 + numberOfCustomCharacters][5] PROGMEM = {
- {0x00 , 0x00 , 0x00 , 0x00 , 0x00 }, // 32 = <space>
- {0x00 , 0x06 , 0x5F , 0x06 , 0x00 }, // 33 = !
- {0x07 , 0x03 , 0x00 , 0x07 , 0x03 }, // 34 = "
- {0x24 , 0x7E , 0x24 , 0x7E , 0x24 }, // 35 = #
- {0x24 , 0x2B , 0x6A , 0x12 , 0x00 }, // 36 = $
- {0x63 , 0x13 , 0x08 , 0x64 , 0x63 }, // 37 = %
- {0x36 , 0x49 , 0x56 , 0x20 , 0x50 }, // 38 = &
- {0x00 , 0x07 , 0x03 , 0x00 , 0x00 }, // 39 = '
- {0x00 , 0x3E , 0x41 , 0x00 , 0x00 }, // 40 = (
- {0x00 , 0x41 , 0x3E , 0x00 , 0x00 }, // 41 = )
- {0x08 , 0x3E , 0x1C , 0x3E , 0x08 }, // 42 = *
- {0x08 , 0x08 , 0x3E , 0x08 , 0x08 }, // 43 = +
- {0x00 , 0xE0 , 0x60 , 0x00 , 0x00 }, // 44 = ,
- {0x08 , 0x08 , 0x08 , 0x08 , 0x08 }, // 45 = -
- {0x00 , 0x60 , 0x60 , 0x00 , 0x00 }, // 46 = .
- {0x20 , 0x10 , 0x08 , 0x04 , 0x02 }, // 47 = /
- {0x3E , 0x51 , 0x49 , 0x45 , 0x3E }, // 48 = 0
- {0x00 , 0x42 , 0x7F , 0x40 , 0x00 }, // 49 = 1
- {0x62 , 0x51 , 0x49 , 0x49 , 0x46 }, // 50 = 2
- {0x22 , 0x49 , 0x49 , 0x49 , 0x36 }, // 51 = 3
- {0x18 , 0x14 , 0x12 , 0x7F , 0x10 }, // 52 = 4
- {0x2F , 0x49 , 0x49 , 0x49 , 0x31 }, // 53 = 5
- {0x3C , 0x4A , 0x49 , 0x49 , 0x30 }, // 54 = 6
- {0x01 , 0x71 , 0x09 , 0x05 , 0x03 }, // 55 = 7
- {0x36 , 0x49 , 0x49 , 0x49 , 0x36 }, // 56 = 8
- {0x06 , 0x49 , 0x49 , 0x29 , 0x1E }, // 57 = 9
- {0x00 , 0x6C , 0x6C , 0x00 , 0x00 }, // 58 = :
- {0x00 , 0xEC , 0x6C , 0x00 , 0x00 }, // 59 = ;
- {0x08 , 0x14 , 0x22 , 0x41 , 0x00 }, // 60 = <
- {0x24 , 0x24 , 0x24 , 0x24 , 0x24 }, // 61 = =
- {0x00 , 0x41 , 0x22 , 0x14 , 0x08 }, // 62 = >
- {0x02 , 0x01 , 0x59 , 0x09 , 0x06 }, // 63 = ?
- {0x3E , 0x41 , 0x5D , 0x55 , 0x1E }, // 64 = @
- {0x7E , 0x09 , 0x09 , 0x09 , 0x7E }, // 65 = A
- {0x7F , 0x49 , 0x49 , 0x49 , 0x36 }, // 66 = B
- {0x3E , 0x41 , 0x41 , 0x41 , 0x22 }, // 67 = C
- {0x7F , 0x41 , 0x41 , 0x41 , 0x3E }, // 68 = D
- {0x7F , 0x49 , 0x49 , 0x49 , 0x41 }, // 69 = E
- {0x7F , 0x09 , 0x09 , 0x09 , 0x01 }, // 70 = F
- {0x3E , 0x41 , 0x49 , 0x49 , 0x7A }, // 71 = G
- {0x7F , 0x08 , 0x08 , 0x08 , 0x7F }, // 72 = H
- {0x00 , 0x41 , 0x7F , 0x41 , 0x00 }, // 73 = I
- {0x30 , 0x40 , 0x40 , 0x40 , 0x3F }, // 74 = J
- {0x7F , 0x08 , 0x14 , 0x22 , 0x41 }, // 75 = K
- {0x7F , 0x40 , 0x40 , 0x40 , 0x40 }, // 76 = L
- {0x7F , 0x02 , 0x04 , 0x02 , 0x7F }, // 77 = M
- {0x7F , 0x02 , 0x04 , 0x08 , 0x7F }, // 78 = N
- {0x3E , 0x41 , 0x41 , 0x41 , 0x3E }, // 79 = O
- {0x7F , 0x09 , 0x09 , 0x09 , 0x06 }, // 80 = P
- {0x3E , 0x41 , 0x51 , 0x21 , 0x5E }, // 81 = Q
- {0x7F , 0x09 , 0x09 , 0x19 , 0x66 }, // 82 = R
- {0x26 , 0x49 , 0x49 , 0x49 , 0x32 }, // 83 = S
- {0x01 , 0x01 , 0x7F , 0x01 , 0x01 }, // 84 = T
- {0x3F , 0x40 , 0x40 , 0x40 , 0x3F }, // 85 = U
- {0x1F , 0x20 , 0x40 , 0x20 , 0x1F }, // 86 = V
- {0x3F , 0x40 , 0x3C , 0x40 , 0x3F }, // 87 = W
- {0x63 , 0x14 , 0x08 , 0x14 , 0x63 }, // 88 = X
- {0x07 , 0x08 , 0x70 , 0x08 , 0x07 }, // 89 = Y
- {0x71 , 0x49 , 0x45 , 0x43 , 0x00 }, // 90 = Z
- {0x00 , 0x7F , 0x41 , 0x41 , 0x00 }, // 91 = [
- {0x02 , 0x04 , 0x08 , 0x10 , 0x20 }, // 92 = <backslash>
- {0x00 , 0x41 , 0x41 , 0x7F , 0x00 }, // 93 = ]
- {0x04 , 0x02 , 0x01 , 0x02 , 0x04 }, // 94 = ^
- {0x80 , 0x80 , 0x80 , 0x80 , 0x80 }, // 95 = _
- {0x00 , 0x03 , 0x07 , 0x00 , 0x00 }, // 96 = `
- {0x20 , 0x54 , 0x54 , 0x54 , 0x78 }, // 97 = a
- {0x7F , 0x44 , 0x44 , 0x44 , 0x38 }, // 98 = b
- {0x38 , 0x44 , 0x44 , 0x44 , 0x28 }, // 99 = c
- {0x38 , 0x44 , 0x44 , 0x44 , 0x7F }, // 100 = d
- {0x38 , 0x54 , 0x54 , 0x54 , 0x18 }, // 101 = e
- {0x08 , 0x7E , 0x09 , 0x09 , 0x00 }, // 102 = f
- {0x18 , 0xA4 , 0xA4 , 0xA4 , 0x7C }, // 103 = g
- {0x7F , 0x04 , 0x04 , 0x78 , 0x00 }, // 104 = h
- {0x00 , 0x00 , 0x7D , 0x00 , 0x00 }, // 105 = i
- {0x40 , 0x80 , 0x84 , 0x7D , 0x00 }, // 106 = j
- {0x7F , 0x10 , 0x28 , 0x44 , 0x00 }, // 107 = k
- {0x00 , 0x00 , 0x7F , 0x40 , 0x00 }, // 108 = l
- {0x7C , 0x04 , 0x18 , 0x04 , 0x78 }, // 109 = m
- {0x7C , 0x04 , 0x04 , 0x78 , 0x00 }, // 110 = n
- {0x38 , 0x44 , 0x44 , 0x44 , 0x38 }, // 111 = o
- {0xFC , 0x44 , 0x44 , 0x44 , 0x38 }, // 112 = p
- {0x38 , 0x44 , 0x44 , 0x44 , 0xFC }, // 113 = q
- {0x44 , 0x78 , 0x44 , 0x04 , 0x08 }, // 114 = r
- {0x08 , 0x54 , 0x54 , 0x54 , 0x20 }, // 115 = s
- {0x04 , 0x3E , 0x44 , 0x24 , 0x00 }, // 116 = t
- {0x3C , 0x40 , 0x20 , 0x7C , 0x00 }, // 117 = u
- {0x1C , 0x20 , 0x40 , 0x20 , 0x1C }, // 118 = v
- {0x3C , 0x60 , 0x30 , 0x60 , 0x3C }, // 119 = w
- {0x6C , 0x10 , 0x10 , 0x6C , 0x00 }, // 120 = x
- {0x9C , 0xA0 , 0x60 , 0x3C , 0x00 }, // 121 = y
- {0x64 , 0x54 , 0x54 , 0x4C , 0x00 }, // 122 = z
- {0x08 , 0x3E , 0x41 , 0x41 , 0x00 }, // 123 = {
- {0x00 , 0x00 , 0x7F , 0x00 , 0x00 }, // 124 = |
- {0x00 , 0x41 , 0x41 , 0x3E , 0x08 }, // 125 = }
- {0x02 , 0x01 , 0x02 , 0x01 , 0x00 }, // 126 = ~
-
- //Custom Non-ASCII charaters
- //Add more lines at the end to generate custom characters.
-
- {0x02 , 0x6F , 0x1A , 0x30 , 0x6E }, // 127 = Shuffle
- {0x3C , 0x62 , 0x47 , 0x62 , 0x38 }, // -128 = Repeat
- {0x3E , 0x3E , 0x3E , 0x3E , 0x3E }, // -127 = Stop
- {0x00 , 0x7F , 0x3E , 0x1C , 0x08 }, // -126 = Play
- {0x3E , 0x3E , 0x00 , 0x3E , 0x3E }, // -125 = Pause
- {0x7F , 0x3E , 0x1C , 0x08 , 0x7F }, // -124 = Skip
- {0x1C , 0x3E , 0x7F , 0x00 , 0x1C }, // -123 = Volume
- {0x1C , 0x3E , 0x7F , 0x00 , 0x00 }, // -122 = Mute
- {0x3C , 0x60 , 0x4F , 0x60 , 0x3C }, // -121 = Power
-};
-
-gLCD::gLCD(byte RS, byte CS, byte SCLK, byte SDATA, boolean speed){
- _fast = speed;
-
- pinMode(RS, OUTPUT);
- _RS = RS;
- pinMode(CS, OUTPUT);
- _CS = CS;
- pinMode(SCLK, OUTPUT);
- _SCLK = SCLK;
- pinMode(SDATA, OUTPUT);
- _SDATA = SDATA;
-
- if(speed){
- byte RSport = digitalPinToPort(RS);
- byte CSport = digitalPinToPort(CS);
- byte SCLKport = digitalPinToPort(SCLK);
- byte SDATAport = digitalPinToPort(SDATA);
-
- if (( RSport == NOT_A_PIN) ||
- ( CSport == NOT_A_PIN) ||
- ( SCLKport == NOT_A_PIN) ||
- (SDATAport == NOT_A_PIN) )
- {
- _fast = 0; //Not a correct register, so use digitalWrite
- } else {
- _RS_PORT = portOutputRegister(RSport);
- _CS_PORT = portOutputRegister(CSport);
- _SCLK_PORT = portOutputRegister(SCLKport);
- _SDATA_PORT = portOutputRegister(SDATAport);
- _RS_HIGH = digitalPinToBitMask(RS);
- _RS_LOW = ~_RS_HIGH;
- _CS_HIGH = digitalPinToBitMask(CS);
- _CS_LOW = ~_CS_HIGH;
- _SCLK_HIGH = digitalPinToBitMask(SCLK);
- _SCLK_LOW = ~_SCLK_HIGH;
- _SDATA_HIGH = digitalPinToBitMask(SDATA);
- _SDATA_LOW = ~_SDATA_HIGH;
- }
- }
-
- _parameter = 1;
- _command = 0;
-
- _contrast = 126; //In otherwords, use default unless told otherwise
-
- //_LCDwidth = 132;
- //_LCDheight = 132;
-}
-
-void gLCD::setForeColour(char Red, char Green, char Blue){
- _ForeRed = Red & 0x0F;
- _ForeGreen = Green & 0x0F;
- _ForeBlue = Blue & 0x0F;
-}
-
-void gLCD::setBackColour(char Red, char Green, char Blue){
- _BackRed = Red & 0x0F;
- _BackGreen = Green & 0x0F;
- _BackBlue = Blue & 0x0F;
-}
-
-void gLCD::setForeColour(unsigned long colour){
- _ForeRed = (colour >> 16) & 0x0F;
- _ForeGreen = (colour >> 8) & 0x0F;
- _ForeBlue = colour & 0x0F;
-}
-
-void gLCD::setBackColour(unsigned long colour){
- _BackRed = (colour >> 16) & 0x0F;
- _BackGreen = (colour >> 8) & 0x0F;
- _BackBlue = colour & 0x0F;
-}
-
-void gLCD::twoPixels(byte SendR1, byte SendG1, byte SendB1, byte SendR2, byte SendG2, byte SendB2){
- byte SendR1G1 = (SendR1 << 4) | (SendG1);
- byte SendB1R2 = (SendB1 << 4) | (SendR2);
- byte SendG2B2 = (SendG2 << 4) | (SendB2);
-
- twoPixels(SendR1G1, SendB1R2, SendG2B2);
-}
-
-void gLCD::twoPixels(byte SendR1G1, byte SendB1R2, byte SendG2B2){
- //Add both pixels to the window
- SendByte(_parameter, SendR1G1);
- SendByte(_parameter, SendB1R2);
- SendByte(_parameter, SendG2B2);
-}
-
-
-void gLCD::setSendColour(char Colour){
- //Get type for each pixel
- int pixelOne = Colour & 1;
- int pixelTwo = (Colour >> 1) & 1;
-
- //Pixel data is in the format: RRRRGGGG BBBBRRRR GGGGBBBB, where this is two pixels worth of data
-
- //Is pixel one foreground or background
- if (pixelOne){
- _SendRG = _ForeRed << 4;
- _SendRG |= _ForeGreen;
- _SendBR = _ForeBlue << 4;
- } else {
- _SendRG = _BackRed << 4;
- _SendRG |= _BackGreen;
- _SendBR = _BackBlue << 4;
- }
- //Is pixel two foreground or background
- if (pixelTwo){
- _SendBR |= _ForeRed;
- _SendGB = _ForeGreen << 4;
- _SendGB |= _ForeBlue;
- } else {
- _SendBR |= _BackRed;
- _SendGB = _BackGreen << 4;
- _SendGB |= _BackBlue;
- }
-}
-
-void gLCD::twoPixels(char Colour){
- setSendColour(Colour);
- //Add both pixels to the window
- twoPixels();
-}
-
-void gLCD::twoPixels(){
- //Add both pixels to the window (use the old colour data)
- SendByte(_parameter, _SendRG);
- SendByte(_parameter, _SendBR);
- SendByte(_parameter, _SendGB);
-}
-
-void gLCD::Window(){
- Window(X1,X2,Y1,Y2); //Use the global coordinates to call the window
-}
-
-void gLCD::Window(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- _X1 = _X1 + _Xzero; //Apply offset to window
- _Y1 = _Y1 + _Yzero;
- _X2 = _X2 + _Xzero;
- _Y2 = _Y2 + _Yzero;
-
- if (_Phillips){
- SendByte(_command, 0x2A); //Column adress
- SendByte(_parameter, _Y1); //y-Position upper left corner
- SendByte(_parameter, _Y2); //y-Position of lower right corner
- SendByte(_command, 0x2B); //Page adressing
- SendByte(_parameter, _X1); //X-Position upper left corner
- SendByte(_parameter, _X2); //x-Position of lower right corner
- SendByte(_command, 0x2C); //RAMWR - Ram Write
-
- } else {
- SendByte(_command, 0x15); //Column adress
- SendByte(_parameter, _X1); //X-Position upper left corner
- SendByte(_parameter, _X2); //x-Position of lower right corner
- SendByte(_command, 0x75); //Page adressing
- SendByte(_parameter, _Y1); //y-Position upper left corner
- SendByte(_parameter, _Y2); //y-Position of lower right corner
- SendByte(_command, 0x5C); //RAMWR - Ram Write
- }
-}
-
-
-void gLCD::SendByte(boolean Command, unsigned char data){
-
- char i;
- if (_fast){
- *_RS_PORT |= _RS_HIGH;; //Startup LCD Communication
- *_CS_PORT &= _CS_LOW; //start of sequence
-
- //Send Command or parameter
- *_SCLK_PORT &= _SCLK_LOW; //Clock 0
- if(Command){//Send a bit
- *_SDATA_PORT |= _SDATA_HIGH;
- } else {
- *_SDATA_PORT &= _SDATA_LOW;
- }
- *_SCLK_PORT |= _SCLK_HIGH; //Clock 1
-
- //Send data
- for (byte i = 0;i < 8; i++){
- *_SCLK_PORT &= _SCLK_LOW; //Clock 0
- if(data & 0x80){ //isolate and send a data bit
- *_SDATA_PORT |= _SDATA_HIGH;
- } else {
- *_SDATA_PORT &= _SDATA_LOW;
- }
- data <<= 1; //shift the data up
- *_SCLK_PORT |= _SCLK_HIGH; //Clock 1
- }
-
- *_CS_PORT |= _CS_HIGH;
- } else {
- digitalWrite(_RS, 1); //Startup LCD Communication
- digitalWrite(_CS, 0); //start of sequence
-
- //Send Command or parameter
- digitalWrite(_SCLK, 0); //Clock 0
- digitalWrite(_SDATA, Command); //Send a bit
- digitalWrite(_SCLK, 1); //Clock 1
-
- //Send data
- byte mask = 0x80;
- for (i = 7;i >= 0; i--){
- digitalWrite(_SCLK, 0); //Clock 0
- digitalWrite(_SDATA, data & mask); //Send a bit
- mask >>= 1;
- digitalWrite(_SCLK, 1); //Clock 1
- }
-
- digitalWrite(_CS, 1); //end of sequence
- }
-}
-
-void gLCD::Contrast(signed char contrast){
- _contrast = contrast;
- if (_Phillips){
- if (_contrast > 63){
- _contrast = 63;
- }
- if (_contrast < -63){
- _contrast = -63;
- }
- SendByte(_command, 0x25); //Contrast Control
- SendByte(_parameter, _contrast); //User defined contrast.
- } else {
- if (_contrast > 63){
- _contrast = 63;
- }
- if (_contrast < 0){
- _contrast = 0;
- }
- SendByte(_command, 0x81); //Contrast Control
- SendByte(_parameter, _contrast); //User defined contrast.
- SendByte(_parameter, 0x02); //Resistor Ratio - 0x02 should be fine for most screens
- }
-}
-
-void gLCD::Configure(boolean normal){
- if (_Phillips){
- SendByte(_command, 0x36); //Configure Display
- if(normal){
- SendByte(_parameter, _normalScan); //RGB order, mirror display x or y.
- } else {
- SendByte(_parameter, _inverseScan);
- }
- } else {
- SendByte(_command, 0xBC); //Display Control
- if (normal){
- SendByte(_parameter, _normalScan); //Scan direction
- } else {
- SendByte(_parameter, _inverseScan);
- }
- SendByte(_parameter, 0x00); //RGB colour order
- SendByte(_parameter, 0x02); //colour mode - 4096 colours
- }
-}
-/*
-void gLCD::Init(char Xzero, char Yzero, boolean InvertColour){
-
- _Yzero = Yzero;
- _Xzero = Xzero;
-
- _Phillips = 0;
-
- digitalWrite(_RS,0); //Reset LCD
-
- delay(10);
-
- digitalWrite(_CS,1); //Select LCD
- digitalWrite(_SDATA,1); //Set Data Pin High
- digitalWrite(_SCLK,1); //Set Clock Pin High
- digitalWrite(_RS,1); //Startup LCD
-
- delay(10); //Wait after Reset
-
- SendByte(_command, 0xCA); //Configure Display
- SendByte(_parameter, 0x00); //2 divisions, switching period=8 (default)
- SendByte(_parameter, 0x20); //nlines/4 - 1 = 132/4 - 1 = 32)
- SendByte(_parameter, 0x00); //no inversely highlighted lines
-
- SendByte(_command, 0xBB); //Common Output Scan (avoid split display)...
- SendByte(_parameter, 0x01); //...Scan 1->69, 69->132
-
- SendByte(_command, 0xD1); //Enable Oscillators
-
- SendByte(_command, 0x94); //Sleep Out
-
- SendByte(_command, 0x20); //Voltage Regulators On
- SendByte(_parameter, 0x0F); //Ref voltage, then circuit voltage, then booster
-
- if (InvertColour){
- SendByte(_command, 0xA7); //Invert Display Colour
- }
-
- SendByte(_command, 0xBC); //Display Control
- _normalScan = 0x04;
- _inverseScan = 0x01;
- SendByte(_parameter, _normalScan); //Scan direction (left-->right or right-->left)
- SendByte(_parameter, 0x00); //RGB colour order
- SendByte(_parameter, 0x02); //colour mode - 4096 colours
-
- SendByte(_command, 0x81); //Contrast Control
- SendByte(_parameter, 0x2B); //0 to 63: sets contrast - 0x2B is default.
- SendByte(_parameter, 0x02); //Resistor Ratio - 0x02 should be fine for most screens
-
- delay(100); //Allow Power to stablise
-
- SendByte(_command, 0xAF); //Display On
- delay(40);
-
- setForeColour(0x0F,0x0F,0x0F); //Display is White foreground and Blue background
- setBackColour(0x00,0x00,0x0F);
-
- Clear();
-}
-
-void gLCD::Init(char Xzero, char Yzero, boolean InvertColour, boolean Phillips, byte xReverse){
-
- _Yzero = Yzero;
- _Xzero = Xzero;
-
- _Phillips = 1;
-
- digitalWrite(_RS,0); //Reset LCD
-
- delay(30);
-
- digitalWrite(_CS,1); //Select LCD
- digitalWrite(_SDATA,1); //Set Data Pin High
- digitalWrite(_SCLK,1); //Set Clock Pin High
- digitalWrite(_RS,1); //Startup LCD
-
- delay(30); //Wait after Reset
-
- SendByte(_command, 0x11); //Wake up from sleep mode
-
- if (InvertColour){
- SendByte(_command, 0x20); //Invert Display Colour
- }
-
- SendByte(_command, 0x3A); //Colour Control
- SendByte(_parameter, 0x03); //colour mode - 4096 colours
-
- SendByte(_command, 0x36); //Configure Display
- if (xReverse & 1){ //When xReverse is on, then the value of this parameter is ajusted so that x is mirrored from normal.
- _normalScan = 0x60 - ((xReverse & 2)<<4);
- _inverseScan = 0xC0 + ((xReverse & 2)<<4);
- SendByte(_parameter, _normalScan); //RGB order, mirror display x or y. 0x60 = RGB, no mirroring
- // 0x68 = BGR, no mirroring
- // 0xA0 = RGB, mirror X and Y
- // 0xA8 = BGR, mirror X and Y
- } else {
- _normalScan = 0x20 - ((xReverse & 2)<<4);
- _inverseScan = 0x80 + ((xReverse & 2)<<4);
- SendByte(_parameter, _normalScan); //RGB order, mirror display x or y. 0x20 = RGB, no mirroring
- // 0x28 = BGR, no mirroring
- // 0xE0 = RGB, mirror X and Y
- // 0xE8 = BGR, mirror X and Y
- }
- SendByte(_command, 0x25); //Contrast Control
- SendByte(_parameter, 0x30); //-63 to 63: sets contrast - 0x30 is default.
-
- delay(2);
-
- SendByte(_command, 0x29); //Display On
-
- delay(40);
-
- setForeColour(0x0F,0x0F,0x0F); //Display is White foreground and Blue background
- setBackColour(0x00,0x00,0x0F);
-
- Clear();
-}
-*/
-
-//These are depreciated and will be removed in version 3.1
-void gLCD::Init(char Xzero, char Yzero, boolean InvertColour){
- begin(Xzero,Yzero,InvertColour,EPSON);
-}
-
-void gLCD::Init(char Xzero, char Yzero, boolean InvertColour, boolean Phillips, byte xReverse){
- begin(Xzero,Yzero,InvertColour,xReverse);
-}
-
-void gLCD::begin(char Xzero, char Yzero, boolean InvertColour, byte driver){
-
- _Phillips = (driver & 0x04) ? 0 : 1;
- _Yzero = Yzero;
- _Xzero = Xzero;
-
- digitalWrite(_RS,0); //Reset LCD
-
- delay(30);
-
- digitalWrite(_CS,1); //Select LCD
- digitalWrite(_SDATA,1); //Set Data Pin High
- digitalWrite(_SCLK,1); //Set Clock Pin High
- digitalWrite(_RS,1); //Startup LCD
-
- delay(30); //Wait after Reset
-
- if(_Phillips){
- SendByte(_command, 0x11); //Wake up from sleep mode
- } else {
- SendByte(_command, 0xCA); //Configure Display
- SendByte(_parameter, 0x00); //2 divisions, switching period=8 (default)
- SendByte(_parameter, 0x20); //nlines/4 - 1 = 132/4 - 1 = 32)
- SendByte(_parameter, 0x00); //no inversely highlighted lines
-
- SendByte(_command, 0xBB); //Common Output Scan (avoid split display)...
- SendByte(_parameter, 0x01); //...Scan 1->69, 69->132
-
- SendByte(_command, 0xD1); //Enable Oscillators
-
- SendByte(_command, 0x94); //Sleep Out
-
- SendByte(_command, 0x20); //Voltage Regulators On
- SendByte(_parameter, 0x0F); //Ref voltage, then circuit voltage, then booster
- }
-
- if (InvertColour){
- SendByte(_command, _Phillips ? 0x20 : 0xA7); //Invert Display Colour
- }
-
- if(_Phillips){
- SendByte(_command, 0x3A); //Colour Control
- SendByte(_parameter, 0x03); //colour mode - 4096 colours
-
- SendByte(_command, 0x36); //Configure Display
- if (driver & 1){ //When driver bit 1 is on, then the value of this parameter is ajusted so that x is mirrored from normal.
- _normalScan = 0x60 - ((driver & 2)<<4);
- _inverseScan = 0xC0 + ((driver & 2)<<4);
- SendByte(_parameter, _normalScan); //RGB order, mirror display x or y. 0x60 = RGB, no mirroring
- // 0x68 = BGR, no mirroring
- // 0xA0 = RGB, mirror X and Y
- // 0xA8 = BGR, mirror X and Y
- } else {
- _normalScan = 0x20 - ((driver & 2)<<4);
- _inverseScan = 0x80 + ((driver & 2)<<4);
- SendByte(_parameter, _normalScan); //RGB order, mirror display x or y. 0x20 = RGB, no mirroring
- // 0x28 = BGR, no mirroring
- // 0xE0 = RGB, mirror X and Y
- // 0xE8 = BGR, mirror X and Y
- }
- SendByte(_command, 0x25); //Contrast Control
- SendByte(_parameter, 0x30); //-63 to 63: sets contrast - 0x30 is default.
- } else {
- SendByte(_command, 0xBC); //Display Control
- _normalScan = 0x04;
- _inverseScan = 0x01;
- SendByte(_parameter, _normalScan); //Scan direction (left-->right or right-->left)
- SendByte(_parameter, 0x00); //RGB colour order
- SendByte(_parameter, 0x02); //colour mode - 4096 colours
-
- SendByte(_command, 0x81); //Contrast Control
- SendByte(_parameter, 0x2B); //0 to 63: sets contrast - 0x2B is default.
- SendByte(_parameter, 0x02); //Resistor Ratio - 0x02 should be fine for most screens
- }
-
- delay(100); //Allow Power to stablise
-
- SendByte(_command, _Phillips?0x29:0xAF); //Display On
-
- delay(40);
-
- setForeColour(0x0F,0x0F,0x0F); //Display is White foreground and Blue background
- setBackColour(0x00,0x00,0x0F);
-
- Clear();
-}
-
-void gLCD::displayOff(){
- if(_Phillips){
- //DISPOFF
- SendByte(_command, 0x28);
- } else {
- //DISOFF
- SendByte(_command, 0xAE);
- }
-}
-
-void gLCD::displayOn(){
- if(_Phillips){
- //DISPON
- SendByte(_command, 0x29);
- } else {
- //DISON
- SendByte(_command, 0xAF);
- }
-}
-void gLCD::Clear(){
- //int i,j;
-
- Window(0,0,131,131); //Create a window the size of the screen
- setSendColour(0);//All pixels are the same colour, so do the calculation only once
- for (int i = 0;i < 8844;i++){
- twoPixels(); //send the rest using the existing colours
- }
-}
-
-#if ARDUINO >= 100
-size_t gLCD::write(const uint8_t character){
- char temp[2] = {0};
- temp[0] = character;
- return write((uint8_t *)temp,1);
-}
-#else
-void gLCD::write(const uint8_t character){
- char temp[2] = {0};
- temp[0] = character;
- write(temp,1);
-}
-#endif
-
-#if ARDUINO >= 100
-size_t gLCD::write(const uint8_t *buffer, size_t size){
-#else
-void gLCD::write(const uint8_t *buffer, size_t size){
-#endif
- size_t returnSize = size;
- int j,k, xcnt, ycnt;
-
- char width = (Font & 1) + 1; //Double width (BOLD)
- char height = ((Font >> 1) & 1) + 1; //Double height (Large text when used with fontwidth)
- boolean background = ((Font >> 2) & 1); //Whether the text has a background
-
- int X = X1;
- unsigned char _X1 = X1;
- int startX = X1;
- int Y = Y1;
- unsigned char _Y1 = Y1;
- int startY = Y1;
-
- char char2print;
- byte data;
- unsigned char databit;
- char max = 126 + numberOfCustomCharacters;
- while (size--){ //Start at beginning of string and work along
- //Finds the character to print, and adjusts it to a position in the ASCII array
- char2print = *buffer;
- buffer++; //increment pointer for next time.
- if (char2print == 13){
- //Skip a carraige return
- } if (char2print == 10){
- //If it is a line feed, move to the next line.
- _X1 = startX;
- X = _X1;
- startY += (8*height);
- _Y1 = startY;
- Y = _Y1;
- continue; //Move on to next character in string
- } else if ((char2print < 32)&&(char2print > max)&&(max < 0)){ //The > max allows for the 'numberOfCustomCharacters' custom characters to be used
- //If it is not a printable character, print a space instead.
- char2print = 0;
- } else if (((char2print < 32)||(char2print > max))&&(max > 0)){ //The > max allows for the 'numberOfCustomCharacters' custom characters to be used
- //If it is not a printable character, print a space instead.
- char2print = 0;
- } else {
- char2print -= 32;
- }
-
- byte character = (byte)char2print;
-
- if(background){
- //Print the character
- Window(_X1,_Y1,_X1+(6*width)-1,_Y1+(8*height)-1); //Create a window the size of one character, then fill it with the background colour
- for (xcnt = 0;xcnt < 5;xcnt++){
- for (j = 0;j < width;j++){
- if (height == 2){
- //If double height, each pair of pixels will be the same, and there will be 8 pairs of them.
- for (ycnt = 0;ycnt < 8;ycnt++){
- data = pgm_read_byte(&(charData[character][xcnt]));
- databit = (data >> ycnt) & 1;
- databit |= databit << 1;
- twoPixels(databit);
- }
- } else {
- //If not height, each pair of pixels will be two distinct pixels, so we need to set the colour for each correctly.
- for (ycnt = 0;ycnt < 7;ycnt += 2){
- data = pgm_read_byte(&(charData[character][xcnt]));
- databit = (data >> ycnt) & 3;
- twoPixels(databit);
- }
- }
- }
- }
- //Fill in the character seperator pixels
- setSendColour(0);
- for (j = 0;j < ((4*height)*width);j++){
- twoPixels();
- }
- } else {
- //Print the character
- for (xcnt = 0;xcnt < 5;xcnt++){
- //Do this once or twice depending on width format
- for (j = 0;j < width;j++){
- for (ycnt = 0;ycnt <8;ycnt++){
- data = pgm_read_byte(&(charData[character][xcnt]));
- databit = (data >> ycnt) & 1; //isolate the data bit
-
- //Do this once or twice depending on height format
- for (k = 0;k < height;k++){
- if(databit){
- systemPlot(X,Y,3);
- }
- Y++;//increase Y offset
- }
- }
- X++; //increase X offset
- Y = _Y1; //Y back to zero offset
- }
- }
- }
- _X1 += (6*width); // Move X position so that next character knows where to be placed
- X = _X1; //X back to zero offset
- }
-#if ARDUINO >= 100
- return returnSize;
-}
-#else
-}
-#endif
-
-/*
-void gLCD::Print(String text, unsigned char X1, unsigned char Y1, byte Font){
-
- int i,j,k, xcnt, ycnt;
-
-
- char width = (Font & 1) + 1; //Double width (BOLD)
- char height = ((Font >> 1) & 1) + 1; //Double height (Large text when used with fontwidth)
- boolean background = ((Font >> 2) & 1); //Whether the text has a background
-
- int X = X1;
- int startX = X1;
- int Y = Y1;
- int startY = Y1;
-
- int length = text.length(); //Length of the string to be printed
-
- char char2print;
- byte data;
- unsigned char databit;
- char max = 126 + numberOfCustomCharacters;
-
- for (i=0;i<length;i++){ //Start at beginning of string and work along
-
- //Finds the character to print, and adjusts it to a position in the ASCII array
- char2print = text.charAt(i);
- if (char2print == 13){
- //If it is a carriage return, move to the next line.
- X1 = startX;
- X = X1;
- startY += (8*height);
- Y1 = startY;
- Y = Y1;
- continue; //Move on to next character in string
- } else if ((char2print < 32)&&(char2print > max)&&(max < 0)){ //The > max allows for the 'numberOfCustomCharacters' custom characters to be used
- //If it is not a printable character, print a space instead.
- char2print = 0;
- } else if (((char2print < 32)||(char2print > max))&&(max > 0)){ //The > max allows for the 'numberOfCustomCharacters' custom characters to be used
- //If it is not a printable character, print a space instead.
- char2print = 0;
- } else {
- char2print -= 32;
- }
-
- if(background){
- //Print the character
- Window(X1,Y1,X1+(6*width)-1,Y1+(8*height)-1); //Create a window the size of one character, then fill it with the background colour
- for (xcnt = 0;xcnt < 5;xcnt++){
- for (j = 0;j < width;j++){
- if (height == 2){
- //If double height, each pair of pixels will be the same, and there will be 8 pairs of them.
- for (ycnt = 0;ycnt < 8;ycnt++){
- data = pgm_read_byte(&(charData[char2print][xcnt]));
- databit = (data >> ycnt) & 1;
- databit |= databit << 1;
- twoPixels(databit);
- }
- } else {
- //If not height, each pair of pixels will be two distinct pixels, so we need to set the colour for each correctly.
- for (ycnt = 0;ycnt < 7;ycnt += 2){
- data = pgm_read_byte(&(charData[char2print][xcnt]));
- databit = (data >> ycnt) & 3;
- twoPixels(databit);
- }
- }
- }
- }
- //Fill in the character seperator pixels
- for (j = 0;j < (4*height)*width;j++){
- twoPixels(0);
- }
- } else {
- //Print the character
- for (xcnt = 0;xcnt < 5;xcnt++){
- //Do this once or twice depending on width format
- for (j = 0;j < width;j++){
- for (ycnt = 0;ycnt <8;ycnt++){
- data = pgm_read_byte(&(charData[char2print][xcnt]));
- databit = (data >> ycnt) & 1; //isolate the data bit
-
- //Do this once or twice depending on height format
- for (k = 0;k < height;k++){
- if(databit){
- systemPlot(X,Y,3);
- }
- Y++;//increase Y offset
- }
- }
- X++; //increase X offset
- Y = Y1; //Y back to zero offset
- }
- }
- }
- X1 += (6*width); // Move X position so that next character knows where to be placed
- X = X1; //X back to zero offset
- }
-}
-*/
-void gLCD::systemPlot(unsigned char _X1, unsigned char _Y1, unsigned char Colour){
- //The systemPlot function does not set the global coordinate as it may be being used as a reference by an internal function.
- Window(_X1,_Y1,_X1,_Y1); //Creates a window of 1 pixel
- Colour |= Colour << 1;
- twoPixels(Colour);
-}
-
-void gLCD::systemPlot(unsigned char _X1, unsigned char _Y1){
- //The systemPlot function does not set the global coordinate as it may be being used as a reference by an internal function.
- Window(_X1,_Y1,_X1,_Y1); //Creates a window of 1 pixel
- twoPixels();
-}
-
-void gLCD::Plot(unsigned char _X1, unsigned char _Y1, unsigned char Colour){
- setCoordinate(_X1,_Y1);
- systemPlot(X1,Y1,Colour); //Call the system plot function
-}
-
-void gLCD::Plot(unsigned char _X1, unsigned char _Y1){
- Plot(_X1,_Y1,format >> 2); //Use the format variable instead
-}
-
-void gLCD::Plot(unsigned char Colour){
- systemPlot(X1,Y1,Colour);
-}
-
-void gLCD::Plot(){
- Plot(format >> 2); //Use the format variable instead
-}
-
-void gLCD::setFormat(unsigned char _format){
- format = _format;
-}
-
-void gLCD::setFont(byte _Font) {
- Font = _Font;
-}
-
-void gLCD::setCoordinate(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- setCoordinate(_X1,_Y1);
- setCoordinate(_X2,_Y2,2);
-}
-
-void gLCD::setCoordinate(unsigned char X, unsigned char Y, byte pair){
- if(pair == 1){
- X1 = X;
- Y1 = Y;
- } else {
- X2 = X;
- Y2 = Y;
- }
-}
-
-void gLCD::Circle(unsigned char _X1, unsigned char _Y1, unsigned char Radius){
- setCoordinate(_X1,_Y1);
- Circle(Radius);
-}
-
-void gLCD::Circle(unsigned char Radius, unsigned char _format){
- setFormat(_format);
- Circle(Radius);
-}
-
-void gLCD::Circle(unsigned char _X1, unsigned char _Y1, unsigned char Radius, unsigned char _format){
- setFormat(_format);
- Circle(_X1,_Y1,Radius);
- /*
- Implimentation of Bresenham's Circle Algorithm
- */
-}
-
-void gLCD::Circle(unsigned char Radius){
- char fillColour = format & 1;
- char nofill = (format >> 1) & 1;
- char borderColour = (format >> 2) & 1;
-
- fillColour |= fillColour << 1;
- borderColour |= borderColour << 1;
-
- unsigned char X = Radius;
- unsigned char Y = 0;
- signed int error = 0;
- signed int dx = 1 - (Radius << 1);
- signed int dy = 1;
-
- //Have to do it twice if it is filled in unfortunately
-
- if (!nofill){
- setSendColour(fillColour);
- while (X >= Y){
- CircleFill(X,Y,X1,Y1);
- Y++;
- error += dy;
- dy += 2;
- if ((dx + (error<<1)) > 0){
- X--;
- error += dx;
- dx += 2;
- }
- }
- }
-
- X = Radius;
- Y = 0;
- error = 0;
- dx = 1 - (Radius << 1);
- dy = 1;
- setSendColour(borderColour);
- while (X >= Y){
- CirclePlot(X,Y,X1,Y1);
- Y++;
- error += dy;
- dy += 2;
- if ((dx + (error<<1)) > 0){
- X--;
- error += dx;
- dx += 2;
- }
- }
-}
-
-void gLCD::CircleFill(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
-
- int i;
- Window(_X2-_X1,_Y2+_Y1,_X2+_X1,_Y2+_Y1);
- for(i = 0; i < _X1; i++){
- twoPixels();
- }
- Window(_X2-_X1,_Y2-_Y1,_X2+_X1,_Y2-_Y1);
- for(i = 0; i < _X1; i++){
- twoPixels();
- }
- Window(_X2-_Y1,_Y2+_X1,_X2+_Y1,_Y2+_X1);
- for(i = 0; i < _Y1; i++){
- twoPixels();
- }
- Window(_X2-_Y1,_Y2-_X1,_X2+_Y1,_Y2-_X1);
- for(i = 0; i < _Y1; i++){
- twoPixels();
- }
-}
-
-void gLCD::CirclePlot(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- //Circle is Symmetrical, so we can plot the whole thing having only calculated an octant
- systemPlot(_X2+_X1,_Y2+_Y1); //Octant 1
- systemPlot(_X2-_X1,_Y2+_Y1); //Octant 4
- systemPlot(_X2+_X1,_Y2-_Y1); //Octant 8
- systemPlot(_X2-_X1,_Y2-_Y1); //Octant 5
- systemPlot(_X2+_Y1,_Y2+_X1); //Octant 2
- systemPlot(_X2-_Y1,_Y2+_X1); //Octant 3
- systemPlot(_X2+_Y1,_Y2-_X1); //Octant 7
- systemPlot(_X2-_Y1,_Y2-_X1); //Octant 6
-}
-
-void gLCD::Line(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2, unsigned char _format){
- setCoordinate(_X1,_Y1,_X2,_Y2);
- Line(_format);
-}
-
-void gLCD::Line(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- setCoordinate(_X1,_Y1,_X2,_Y2);
- Line();
-}
-
-void gLCD::Line(unsigned char _format){
- setFormat(_format);
- Line();
-}
-
-void gLCD::Line(){
- signed char xdir = 1; //Amount by which X changes
- signed char ydir = 1; //Amount by which Y changes
- signed int error;
- unsigned char i;
- unsigned char X = X1;
- unsigned char Y = Y1;
-
- byte Colour = format >> 2;
- Colour |= Colour << 1;
- setSendColour(Colour);
- /*
- Implimentation of Bresenham's Line Algorithm
- */
-
- //The algorithm works for only one octant. By reversing the direction, the algorithm can work for 4 of the octants
-
- signed int dx = X2 - X; //Change in X
- signed int dy = Y2 - Y; //Change in Y
-
- if (dx < 0){
- xdir = -1;
- dx = 0 - dx;
- }
- if (dy < 0){
- ydir = -1;
- dy = 0 - dy;
- }
-
- signed int dy2 = dy << 1; //Change in Y with twice the precision
- signed int dx2 = dx << 1; //Change in X with twice the precision
-
-
- //By choosing the major axis, one that experiances greatest change, the algorithm will work for all octants
- if (dx > dy){
- //The X axis see's the largest change, so with each new pixel, X always changes by 1
- error = dy2 - dx;
- for (i = 0; i <= dx; i++){
- systemPlot(X,Y); //Print the pixel
- X += xdir; //move to next x value
- if (error > 0){
- //Error is above the midpoint. So, we move up one
- error += (dy2 - dx2);
- Y += ydir;
- } else {
- //Error is below midpoint, so we keep the same y value
- error += dy2;
- }
- }
- } else {
- //The Y axis see's the largest change, so with each new pixel, Y always changes by 1
- error = dx2 - dy;
- for (i = 0; i <= dy; i++){
- systemPlot(X,Y); //Print the pixel
- Y += ydir; //move to next y value
- if (error > 0){
- //Error is above the midpoint. So, we move right one
- error += (dx2 - dy2);
- X += xdir;
- } else {
- //Error is below midpoint, so we keep the same x value
- error += dx2;
- }
- }
- }
-}
-
-void gLCD::Box(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2, unsigned char _format){
- setCoordinate(_X1,_Y1,_X2,_Y2);
- Box(_format);
-}
-
-void gLCD::Box(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- setCoordinate(_X1,_Y1,_X2,_Y2);
- Box();
-}
-
-void gLCD::Box(unsigned char _format){
- setFormat(_format);
- Box();
-}
-
-void gLCD::Box(){
- char fillColour = format & 1;
- char noFill = format & 2;
- char borderColour = (format >> 2) & 1;
-
- unsigned char dx = (X2 - X1) >> 1;
- unsigned char dy = (Y2 - Y1) >> 1;
-
- fillColour |= fillColour << 1;
- borderColour |= borderColour << 1;
-
- if(!noFill){
- setSendColour(fillColour);
- Window(X1,Y1,X2,Y2); //Create a window for the box
- for (char Y = Y1;Y <= Y2;Y++){
- for (char X = X1;X <= X2;X++){
- twoPixels();
- }
- }
- }
-
- //draw border
- setSendColour(borderColour);
- Window(X1, Y1, X2, Y1);
- for(int i = 0; i <= dx; i++){
- twoPixels();
- }
- Window(X2, Y1, X2, Y2);
- for(int i = 0; i <= dy; i++){
- twoPixels();
- }
- Window(X1, Y2, X2, Y2);
- for(int i = 0; i <= dx; i++){
- twoPixels();
- }
- Window(X1, Y1, X1, Y2);
- for(int i = 0; i <= dy; i++){
- twoPixels();
- }
-}
-
-void gLCD::RedGreen(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- int dy = (_Y2 - _Y1) >> 4; //Y2 - Y1 should be a multiple of eight when invoking this, otherwise it wont work
- int dx = (_X2 - _X1) >> 5; //X2 - X1 should be a multiple of sixteen when invoking this, otherwise it wont work
-
- Window(_X1,_Y1,_X2-1,_Y2-1);
- for (int i = 0;i < 16;i++){
- for (int k = 0;k < dy;k++){
- for (int j = 0;j < 16;j++){
- setForeColour(i,j,0);
- setSendColour(3);
- for (int l = 0;l < dx;l++){
- twoPixels();
- }
- }
- }
- }
-}
-
-void gLCD::GreenBlue(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- int dy = (_Y2 - _Y1) >> 4; //Y2 - Y1 should be a multiple of eight when invoking this, otherwise it wont work
- int dx = (_X2 - _X1) >> 5; //X2 - X1 should be a multiple of sixteen when invoking this, otherwise it wont work
-
- Window(_X1,_Y1,_X2-1,_Y2-1);
- for (int i = 0;i < 16;i++){
- for (int k = 0;k < dy;k++){
- for (int j = 0;j < 16;j++){
- setForeColour(0,i,j);
- setSendColour(3);
- for (int l = 0;l < dx;l++){
- twoPixels();
- }
- }
- }
- }
-}
-
-void gLCD::BlueRed(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
- int dy = (_Y2 - _Y1) >> 4; //Y2 - Y1 should be a multiple of eight when invoking this, otherwise it wont work
- int dx = (_X2 - _X1) >> 5; //X2 - X1 should be a multiple of sixteen when invoking this, otherwise it wont work
-
- Window(_X1,_Y1,_X2-1,_Y2-1);
- for (int i = 0;i < 16;i++){
- for (int k = 0;k < dy;k++){
- for (int j = 0;j < 16;j++){
- setForeColour(j,0,i);
- setSendColour(3);
- for (int l = 0;l < dx;l++){
- twoPixels();
- }
- }
- }
- }
-}
-
-void gLCD::ColourBars(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2){
-
- int dy = _Y2 - _Y1;
- int dx = (_X2 - _X1) >> 4;
-
- char colour[6][3] = {
- {15,0,0},
- {15,15,0},
- {0,15,0},
- {0,15,15},
- {0,0,15},
- {15,0,15}
- };
-
- Window(_X1,_Y1,_X2-1,_Y2-1);
- for (int i = 0;i < 6;i++){
- setForeColour(colour[i][0],colour[i][1],colour[i][2]);
- setSendColour(3);
- for (int k = 0;k < dx;k++){
- for (int j = 0;j < dy;j++){
- twoPixels();
- }
- }
- }
- dx = dx << 2;
- dy = dy >> 5;
-
- for (int k = 0;k < dx;k++){
- for (int j = 0;j < 16;j++){
- setForeColour(j,j,j);
- setSendColour(3);
- for (int l = 0;l < dy;l++){
- twoPixels();
- }
- }
- }
-}
-
-void gLCD::testPattern(){
- setBackColour(15,15,15);
- Clear();
- RedGreen(1,1,65,65);
- GreenBlue(1,65,65,129);
- BlueRed(65,1,129,65);
- ColourBars(65,65,129,129);
-}
View
346 Version 3_0/gLCD.h
@@ -1,346 +0,0 @@
-/*
- Sparkfun Nokia knockoff screen 128x128 controller.
-
- Written by Thomas Carpenter (2011)
-
- ==================================================================================================
- Current Library Version: 3.0
-
- Date | Version | Changes
- -----------+---------+-----------------------------------------------------------------------------
- 03/12/2011 | 3.0 | - The library has been converted to use the Arduino Print class allowing more familiar
- | | calls such as print() and println() to be used, rather than the original Print(String,x,y,font).
- | | The original function now gives an error message explaining the changes.
- | |
- | | - There are now global X1, Y1, X2 and Y2 variables, along with a global Font and Format. This
- | | allows consecutive calls to the display functions without having to repeatedly specify these
- | | variables.
- | |
- | | - Fixed the printing function so that the '\n' character moves to a new line on the screen.
- | |
- | | - Change the Init() function to be named begin() to more closely match the arduino style. The
- | | function is also now more common between the two displays (no extra variables), making it
- | | easier to follow.
- | |
- |---------|
- | |
- 17/07/2012 | 2.5 | - Added the ability to have many custom characters.
- | |
- 01/06/2012 | 2.4 | - Constructor method [gLCD(,,,)] uses built in port decoding from Arduino.h which means
- | | that the correct port is automatically determined, and #defines have thus been removed.
- | | This also improves compatibility with other boards including Teensy and Pro.
- | |
- 18/01/2012 | 2.3 | - Update Phillips Init() call to also work with screens that would scan
- | | top to bottom before, and thus display fonts wrong (thanks github member: mumps)
- | |
- 05/01/2012 | 2.2 | - Corrected printing of Wide fonts (thanks Sparkfun Member #8577)
- | |
- 22/12/2011 | 2.1 | - updated twoPixels() to take 6 values (R1,G1,B1,R2,G2,B2) aswell as still being able
- | | to take the 3 it did before (R1G1,B1R2,G2B2)
- | |
- 03/12/2011 | 2.0 | - Contrast macro can now be called at any point in the program (as long as it is
- | | AFTER the init() call). This means that the contrast can now be changed as many
- | | times as you like during the program, without the need to reinitialise the screen.
- | |
- | | - Library now supports Ardiuno 1.0
- | |
- |---------|
- | |
- 06/11/2011 | 1.4 | - Corrected the drawing of borders when the Box function is called, where before
- | | it used to get the length of the x and y axis lines switched
- | | - Added two new functions: displayOff(), which turns the display off to save power,
- | | and displayOn(), which turns it back on again.
- | |
- 22/10/2011 | 1.3 | - Added ability to invert phillips display
- | |
- 14/10/2011 | 1.2 | - Written a faster digital write set of functions. This speeds up the display by a factor of 10
- | |
- 09/10/2011 | 1.1 | - Character data array is now stored in PROGMEM to free up 480Bytes of SRAM
- | 1.0 | - Major rewrite of printing to screen which has massively increased performance.
- | |
- | | - Circles are now filled MUCH faster.
- | | - Test pattern renders even faster.
- | | - More control over colour of circles and boxes.
- | |
- |---------|
- | |
- 08/10/2011 | 0.8 | - Fixed Issue with Window() macro and the Epson controller - First pixel was drawn in wrong place.
- | | This required changing the scan direction of the Epson screen, and of the Phillips screen so that
- | | both render the same image in the same orientation.
- | | - testPattern() now more efficient and renders much faster.
- | 0.7 | - Contrast depends heavily on the type of screen, so new function to set contrast has been added.
- | | - Added support for Phillips displays, and displays whose colour is inverted (i.e White = Black)
- | 0.6 | - Fixed Lines not drawing correctly if Y1 > Y2
- | 0.5 | - Added Examples to show how to use functions
- | | - Added Circle drawing algorithm
- | | - Can now select colour of the Line() and Plot() as foreground or background colour
- | 0.4 | - Added co-ordinate offset. (On some displays, (0,0) is not visible)
- | | Window() function has had the offset built in, as all functions use
- | | it to draw anything on the screen.
- | | Offset is specified when calling Init();
- | |
- 07/10/2011 | 0.3 | - Added testPattern Function.
- | 0.2 | - Fixed functions not working correctly if X or Y were greater than 126.
- | | - Increased speed of software SPI
- | | - Added Version history
- | | - Simplified Box formatting
- | |
- 06/10/2011 | 0.1 | - Initial library created with some basic functions
- | |
-
- ===================================================================================================
-
- Wishlist/To Do:
- - Detect which controller the screen has
-
- - Draw Triangles (Filled and Unfilled)
-
- ===================================================================================================
-
- Functions:
- gLCD(RS,CS,SCLK,SDATA)
- gLCD(RS,CS,SCLK,SDATA,speed) - Connect screen pins. Reset, !Chip Select, Clock, and Data. Speed is optional and may be omitted
- If speed is given (and is 1), then the FAST digital write will be used.
-
- begin(Xzero, Yzero, InvertColour, EPSON) - Initialise the display. This may need changing for certain screens.
- Xzero and Yzero are (0,0) offset. Invert colour can be used if White
- appears as black, which it does on some displays.(1 = Invert, 0 = Normal)
- EPSON specifies that an Epson display is being used
-
- begin(Xzero, Yzero, InvertColour, PHILLIPS_x) - the last byte controls how the phillips display will behave, and requires
- some trial and error to get right.
- First, try setting it to PHILLIPS_0 and observe which way the screen prints
- the image onto the screen.
- -If it builds up the image from the LEFT(connector end is the top):
- PHILLIPS_0 is correct.
- -If it builds up from the RIGTH:
- set it to PHILLIPS_1 (it should now scan from the LEFT)
- -If it builds up from the BOTTOM:
- set it to PHILLIPS_2 (it should now scan from the LEFT, else try PHILLIPS_3)
- -If it builds up from the TOP:
- set it to PHILLIPS_3 (it should now scan from the LEFT, else try PHILLIPS_2)
-
- displayOff() - Turns the display off.
- displayOn() - Turns it back on again.
-
- testPattern() - Prints a colour table to check that all colours working properly.
-
- Contrast(contrast) - 'contrast' is a value between 0 and 63 (EPSON) or -63 and 63 (Phillips).
- If the Screen is too dark, or you cant see anything send a value >0x2B (<0x00 for Phillips). If you cant see all
- the different colours distinctly on the test pattern, send a value <0x2B (<0x30 (but >0x00) for Phillips). The default values
- should work for many screens, so you may not have to use this at all.
-
- Contrast() should be called BEFORE Init(). It is only needed if the display doesn't look right with just Init() alone.
-
- NOTE: after Init() has been called, Contrast will do nothing.
-
-
- Plot(X,Y,Colour) - Places a dot on the screen at (X,Y). If colour = 3, then it is in ForeColour. If colour = 0, then in BackColour
-
- Line(X1,Y1,X2,Y2,Colour) - Draws a line between (X1,Y1) and (X2,Y2) inclusive, in forground colour (Colour = 1) or background colour (Colour = 0)
-
- Box(X1,Y1,X2,Y2,format) - Draws a box from (X1,Y1) to (X2,Y2) inclusive.
- format controls how the box will look (b7..b3 are ignored)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 1 | x | Draws a box with just a border of colour BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 1 | x | Draws a box with just a border of colour ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 0 | Draws a box with border in BackColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 0 | Draws a box with border in ForeColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 1 | Draws a box with border in BackColour and fill inside it with ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 1 | Draws a box with border in ForeColour and fill inside it with ForeColour
-
- Circle(X1,Y1,Radius,format) - Draws a Circle from (X1,Y1) with radius 'Radius'.
- format controls how the box will look (b7..b3 are ignored)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 1 | x | Draws a circle with just a border of colour BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 1 | x | Draws a circle with just a border of colour ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 0 | Draws a circle with border in BackColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 0 | Draws a circle with border in ForeColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 1 | Draws a circle with border in BackColour and fill inside it with ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 1 | Draws a circle with border in ForeColour and fill inside it with ForeColour
-
- setFont(Font) - Sets the global font. Font is byte with each bit having a meaning.
- These are as follows (b7..b3 are ignored)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+---------------------------------------
- 0 | x | x | Text has transparent background
- ----+----+----+---------------------------------------
- 1 | x | x | Text has solid background
- ----+----+----+---------------------------------------
- x | 0 | 0 | Text normal. (6 x 8 pixels)
- ----+----+----+---------------------------------------
- x | 0 | 1 | Text Wide. (12 x 8 pixels)
- ----+----+----+---------------------------------------
- x | 1 | 0 | Text Tall. (6 x 16 pixels)
- ----+----+----+---------------------------------------
- x | 1 | 1 | Text Tall and Wide. (12 x 16 pixels)
-
- Clear() - Blanks everything on display. All pixels go to background colour
-
- setBackColour(R,G,B) - Sets the global RGB background colour. Doesn't affect anything already onscreen. R, G and B are 4bit long
-
- setForeColour(R,G,B) - Sets the global RGB foreground colour. Doesn't affect anything already onscreen. R, G and B are 4bit long
-*/
-
-#ifndef gLCD_h
-#define gLCD_h
- #if ARDUINO >= 100
- #include "Arduino.h"
- #else
- #include "WProgram.h"
- #endif
-
- #define GLCD_WHITE 0x0F0F0F
- #define GLCD_BLACK 0x000000
- #define GLCD_GREEN 0x000F00
- #define GLCD_LIME 0x080F00
- #define GLCD_BLUE 0x00000F
- #define GLCD_RED 0x0F0000
- #define GLCD_GREY 0x080808
- #define GLCD_ORANGE 0x0F0800
- #define GLCD_CYAN 0x000F0F
- #define GLCD_YELLOW 0x0F0F00
- #define GLCD_LEMON 0x0F0F08
- #define GLCD_MAGENTA 0x0F000F
- #define GLCD_PINK 0x0F0808
-
- #define EPSON 4
- #define PHILLIPS_3 3
- #define PHILLIPS_2 2
- #define PHILLIPS_1 1
- #define PHILLIPS_0 0
- #define HIGH_SPEED true
- #define NORMAL_SPEED false
-
- class gLCD : public Print{
- public:
- gLCD(byte RS, byte CS, byte SCLK, byte SDATA, boolean speed = NORMAL_SPEED); //Constructor. 'speed' can be omitted in call.
- //function declarations
- #if ARDUINO >= 100
- virtual size_t write(const uint8_t *buffer, size_t size);//
- virtual size_t write(const uint8_t character);//
- #else
- virtual void write(const uint8_t *buffer, size_t size);//
- virtual void write(const uint8_t character);//
- #endif
- //These are kept for ease of upgrade to version 3.0. They will vanish is 3.1+
- void Init(char Xzero, char Yzero, boolean InvertColour) __attribute__ ((deprecated));
- void Init(char Xzero, char Yzero, boolean InvertColour, boolean Phillips, byte xReverse) __attribute__ ((deprecated));
- //------------------
- void begin(char Xzero, char Yzero, boolean InvertColour, byte driver);//
- void Contrast(signed char contrast);//
- void setForeColour(char Red, char Green, char Blue);//
- void setForeColour(unsigned long colour);
- void setBackColour(char Red, char Green, char Blue);//
- void setBackColour(unsigned long colour);
- void Clear();//
- void setFont(byte _Font);//
- void setFormat(unsigned char _format);//
- void setCoordinate(unsigned char X, unsigned char Y, byte pair = 1); //setCoordinate(X1,Y1), setCoordinate(X1,Y1,1), setCoordinate(X2,Y2,2)
- void setCoordinate(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);//
- void Plot(unsigned char _X1, unsigned char _Y1, unsigned char Colour);//
- void Plot(unsigned char _X1, unsigned char _Y1);//
- void Plot(unsigned char Colour);//
- void Plot();//
- void Line(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2, unsigned char _format);//
- void Line(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);//
- void Line(unsigned char _format);//
- void Line();//
- void Box(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2, unsigned char _format);//
- void Box(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);//
- void Box(unsigned char _format);//
- void Box();//
- void Circle(unsigned char _X1, unsigned char _Y1, unsigned char Radius, unsigned char _format);//
- void Circle(unsigned char _X1, unsigned char _Y1, unsigned char Radius);//
- void Circle(unsigned char Radius, unsigned char _format);//
- void Circle(unsigned char Radius);//
- void displayOn();//
- void displayOff();//
- void testPattern();//
-
- //This allows direct window writes, for example bitmap creation
- void twoPixels(byte SendR1G1, byte SendB1R2, byte SendG2B2);//
- void twoPixels(byte SendR1, byte SendG1, byte SendB1, byte SendR2, byte SendG2, byte SendB2);//
- void Window(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);//
- void Window();//
- void Configure(boolean normal); //1 = Normal, 0 = Bitmap (BMP files work best with this, though still a little buggy)
- private:
- void SendByte(boolean Command, unsigned char data);
- void setSendColour(char Colour);
- void twoPixels(char Colour);
- void twoPixels();
- void RedGreen(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);
- void GreenBlue(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);
- void BlueRed(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);
- void ColourBars(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);
- void CirclePlot(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);
- void CircleFill(unsigned char _X1, unsigned char _Y1, unsigned char _X2, unsigned char _Y2);
- void systemPlot(unsigned char _X1, unsigned char _Y1, unsigned char Colour);//
- void systemPlot(unsigned char _X1, unsigned char _Y1);
-
- //Variables
- byte _RS;
- byte _CS;
- byte _SCLK;
- byte _SDATA;
- volatile uint8_t* _RS_PORT;
- volatile uint8_t* _CS_PORT;
- volatile uint8_t* _SCLK_PORT;
- volatile uint8_t* _SDATA_PORT;
- byte _RS_HIGH;
- byte _CS_HIGH;
- byte _SCLK_HIGH;
- byte _SDATA_HIGH;
- byte _RS_LOW;
- byte _CS_LOW;
- byte _SCLK_LOW;
- byte _SDATA_LOW;
- boolean _fast;
- byte _normalScan;
- byte _inverseScan;
-
- char _SendRG;
- char _SendBR;
- char _SendGB;
-
- char _ForeRed;
- char _ForeGreen;
- char _ForeBlue;
- char _BackRed;
- char _BackGreen;
- char _BackBlue;
-
- char _parameter;
- char _command;
-
- char _Yzero;
- char _Xzero;
-
- byte Font;
- unsigned char format;
- unsigned char X1;
- unsigned char Y1;
- unsigned char X2;
- unsigned char Y2;
-
- signed char _contrast;
- public:
- char _Phillips;
- };
-
-#endif
View
39 Version 3_0/keywords.txt
@@ -1,39 +0,0 @@
-gLCD KEYWORD1
-setForeColour KEYWORD2
-setBackColour KEYWORD2
-setCoordinate KEYWORD2
-setFont KEYWORD2
-setFormat KEYWORD2
-Clear KEYWORD2
-Plot KEYWORD2
-Line KEYWORD2
-Box KEYWORD2
-Circle KEYWORD2
-Init KEYWORD2
-displayOn KEYWORD2
-displayOff KEYWORD2
-testPattern KEYWORD2
-Contrast KEYWORD2
-Window KEYWORD2
-twoPixels KEYWORD2
-Configure KEYWORD2
-GLCD_WHITE LITERAL1
-GLCD_BLACK LITERAL1
-GLCD_LIME LITERAL1
-GLCD_GREEN LITERAL1
-GLCD_BLUE LITERAL1
-GLCD_RED LITERAL1
-GLCD_GREY LITERAL1
-GLCD_ORANGE LITERAL1
-GLCD_CYAN LITERAL1
-GLCD_LEMON LITERAL1
-GLCD_YELLOW LITERAL1
-GLCD_MAGENTA LITERAL1
-GLCD_PINK LITERAL1
-EPSON LITERAL1
-PHILLIPS_3 LITERAL1
-PHILLIPS_2 LITERAL1
-PHILLIPS_1 LITERAL1
-PHILLIPS_0 LITERAL1
-HIGH_SPEED LITERAL1
-NORMAL_SPEED LITERAL1
View
250 Version 3_2/examples/BasicFunctions/BasicFunctions.pde
@@ -1,250 +0,0 @@
-/*
- gLCD Library Example 1:
-
- This example shows how to use the basic functions: Line, Plot, Box, Circle, Print, SetForeColour, and SetBackColour.
-
- gLCD should work for all Nokia Clone 128x128 screens which have the
- Epson or Phillips controller chip.
-*/
-
-#include <gLCD.h>
-
-//You can use these variables to set the pin numbers
-const char RST = 8;
-const char CS = 9;
-const char Clk = 13;
-const char Data = 11;
-
-/*Create an instance of the display. Lets call it 'graphic'.
- There are four variables,
- which define which pins the LCD is connected too.
- these are:
- Reset, Chip Select, Clock, Data.
-
- A fifth variable 'speed' can be included as 0 or 1, which controls whether to enter high speed mode (see below).
- If the fifth variable is omitted (i.e. only the first four are given), normal speed mode is implied.
-
- gLCD graphic(RST,CS,Clk,Data [,speed]);
-
- Note, it is also possible to enable a high speed mode which increases the speed of the display
- by a factor of >5. This is done through the library bypassing the digitalWrite function and
- directly addressing port registers.
- For the Due, High speed mode increases speed to such an extent that this example completes before you can blink.
-
- Please note that while this doesn't affect how you use the library (it is all handled internally),
- it is possible that it may run too fast for your display and thus the display will appear to not work.
- This is UNLIKELY to happen, and I have checked with several displays which all worked fine.
-
- As of version 2.4 nothing special needs to be done to use this high speed mode, so I am now mentioning
- it is the example file.
-
-*/
-//For normal speed, use:
-gLCD graphic(RST,CS,Clk,Data,NORMAL_SPEED); //Normal speed
-
-//For high speed, use:
-// gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed
-
-
-void setup() {
- /*Display needs to be initialised. You only need to do this once,
- You may have to press the Arduino reset button after uploading
- your code as the screen may fail to startup otherwise
-
- The first two variables in the begin() call specify where on the screen
- origin is. On some screens the first one or two rows/cols of
- pixels aren't visible, so begin(X,Y,,) allows all X and Y co-ords
- to be shifted slightly. (0,2) works well for both my screens.
-
- The third variable specifies whether the colours are inverted.
- If the White background is Black on your screen, set this to a 1
- Else leave it as a zero
-
- The fourth variable is the driver to use you can choose from. There are 6 drivers:
- EPSON (or) EPSON_4 (both are the same)
- EPSON_5
- PHILLIPS_0
- PHILLIPS_1
- PHILLIPS_2
- PHILLIPS_3
-
- For an Epson Screen:
- */
-
- //This
- graphic.begin(0,0,0,EPSON); //Normal Epson
- //or
- //graphic.begin(0,0,0,EPSON_4); //Normal Epson
- //or
- //graphic.begin(0,0,0,EPSON_5); //16bit mode Epson - suits some rare screens.
-
- //For a Phillips Screen:
- //This
- //graphic.begin(0,0,0,PHILLIPS_0); //Normal X direction
- //or
- //graphic.begin(0,0,0,PHILLIPS_1); //Revesed X direction.
- //or
- //graphic.begin(0,0,0,PHILLIPS_2); //Normal X direction, Mirrored.
- //or
- //graphic.begin(0,0,0,PHILLIPS_3); //Revesed X direction, Mirrored.
-
-
-
- /*If you can't see the colours properly, then uncomment the
- graphic.Contrast() function.
- If the Screen is too dark, or you cant see anything send a value >0x2B (>0x30 for Phillips). If you cant see all
- the different colours distinctly on the test pattern, send a value <0x2B (<0x30 for Phillips). The default values
- should work for many screens, so you may not have to use this at all.
-
- Range for phillips: -0x3F to 0x3F
- Range for EPSON: 0x00 to 0x3F
- */
-
- //graphic.Contrast(0x2B);
-}
-void loop() {
- /*Lets draw a box...
-
- First we set the background colour and foreground colour
- We use the SetBackColour function to do this.
- The function takes three bytes, which are: Red, Green, Blue.
- Each of these is a 4 bit number where 0 = off, 15 = fully on.
- */
-
- //We want a white background, so that would be 15 for each variable
- graphic.setBackColour(15,15,15);
-
- //We want a red foreground, so red will be 15 and the others 0
- graphic.setForeColour(15,0,0);
-
- /*Now We draw our box. Lets use the Box() function.
- Box( X1, Y1, X2, Y2, format) takes 5 variables.
-
- The first two are: X1, Y1. These are bytes which represent the (x,y) co-ord where the box will start
-
- The second two are: X2, Y2. These bytes represent the (x,y) co-ord where the box will end. NOTE: This coodinate will also be included in the box
-
- The final one is: format. This controls how the box will look (b7..b3 are ignored)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 1 | x | Draws a box with just a border of colour BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 1 | x | Draws a box with just a border of colour ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 0 | Draws a box with border in BackColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 0 | Draws a box with border in ForeColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 1 | Draws a box with border in BackColour and fill inside it with ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 1 | Draws a box with border in ForeColour and fill inside it with ForeColour
-
- Lets draw a box which starts from (10,10) and is 100 pixes square. So, X1 = 10,
- Y1 = 10,
- X2 = 10 + 99, <- Because X2,Y2 will be part of the box
- Y2 = 10 + 99
- It will have a border coloured Red, and be filled with the background colour. So, 'format' = 4
- */
- graphic.Box(10,10,109,109,4);
-
- //Inside is another box filled in the foreground colour
- graphic.Box(20,20,99,99,5);
-
- /* Next we will write Hello in the centre. For this we need to use the print() function. This behaves exactly like Serial.print() only it prints to the screen not the
- serial port.
-
- First though we need to setup the text. There are two functions to do this.
- setCoordinate(X,Y);
- and
- setFont(Font);
-
- In setCoordinate(X,Y), we set the co-ordinates of where the text will be placed on the screen - (X,Y) pixels denotes the top left corner.
- NOTE: Currently there is no text wrap so strings that dont fit on the screen will be clipped.
- However you can use a '\n' character to print the characters following it on a new line directly below.
-
- Then, in setFont(Font), we set the Font. This controls the vertical and horizontal scaling of the text, and also whether it has a solid or transparent background.
- Font bits have the following meaning: (b7..b3 are ignored - maybe future use)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+---------------------------------------
- 0 | x | x | Text has transparent background
- ----+----+----+---------------------------------------
- 1 | x | x | Text has solid background
- ----+----+----+---------------------------------------
- x | 0 | 0 | Text normal. (6 x 8 pixels)
- ----+----+----+---------------------------------------
- x | 0 | 1 | Text Wide. (12 x 8 pixels)
- ----+----+----+---------------------------------------
- x | 1 | 0 | Text Tall. (6 x 16 pixels)
- ----+----+----+---------------------------------------
- x | 1 | 1 | Text Tall and Wide. (12 x 16 pixels)
- We then finally call the print function with our text or variable, e.g.
- graphic.print("Some Text");
- See print() in the Arduino Reference for more detains.
- */
- graphic.setForeColour(0,0,15); //Text is coloured Blue
- graphic.setFont(Normal_SolidBG); //normal size text, solid background.
- graphic.setCoordinate(40,40);
- graphic.print("Hello\nWorld"); //Hello and World will be printed on seperate lines as governed by the newline character '\n'
-
- graphic.setFont(Normal_SolidBG_Wrap); //normal size text, solid background. Wrap string to new line if needed
- graphic.setCoordinate(0,112);
- graphic.print("This string is too long for a single line"); //The string is too long for a single line, but by selecting one of the '_Wrap' fonts, it will be automatically split onto new lines.
-
- /* Now lets double underline the text twice. Each normal character takes up 6 x 8 pixels, so we need to draw a line 8+9 pixels below the top of the text as there are two lines.
- The line is 6*5 = 30px long. And a second of the same length which is 11 pixels below the top of the text.
-
- For this we can use the Line() Function.
- Line(X1,X2,Y1,Y2,Colour) takes five variables
-
- Firstly X1 and Y1 are both unsigned chars which are where the line starts.
-
- The second two are: X2,Y2. These are the last point on the line.
-
- Lastly: Colour. This defines whether the line should be in Foreground colour (Colour = 1) or Background colour (Colour = 0)
- */
- graphic.Line(40,57,69,57,4); // The lines will be Blue as that was the last foreground colour that was set.
- graphic.Line(40,59,69,59,4);
-
- /* The next function is Circle().
- Circle(X1,Y1,Radius,Format) takes four variables
-
- The first two are: X1, Y1. These are bytes which represent the (x,y) co-ord of the centre of the circle.
-
- The next is: Radius. This is the radius of the circle in pixels.
-
- The final one is: Format. This controls how the Circle will look (b7..b3 are ignored)
-
- b2 | b1 | b0 | Meaning
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 1 | x | Draws a Circle with just a border of colour BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 1 | x | Draws a Circle with just a border of colour ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 0 | Draws a Circle with border in BackColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 0 | Draws a Circle with border in ForeColour and fill inside it with BackColour
- ----+----+----+-----------------------------------------------------------------------------
- 0 | 0 | 1 | Draws a Circle with border in BackColour and fill inside it with ForeColour
- ----+----+----+-----------------------------------------------------------------------------
- 1 | 0 | 1 | Draws a Circle with border in ForeColour and fill inside it with ForeColour
-
- */
- graphic.Circle(66,74,15,4); //Draw circle of radius 10px, filled with the background colour
-
- /* The last basic function is Plot(). This simply sets the colour of the pixel at (x,y) to the current foreground colour.
- Plot(X,Y) takes three variables.
-
- X and Y are the co-odinate where the dot is drawn.
-
- Colour defines whether the line should be in Foreground colour (Colour = 3) or Background colour (Colour = 0)
- */
- for (int i = 15;i < 19;i++){
- for (int j = 17;j < 21;j++){
- graphic.Plot((i*4), (j*4),3); //Draw a grid of 16 dots.
- }
- }
-
- while(1); //Finished
-}
View
111 Version 3_2/examples/TestPattern/TestPattern.pde
@@ -1,111 +0,0 @@
-/*
- gLCD Library Example 2:
-
- This example shows you how to create an instance of the display,
- connect it to the correct pins, and then display the built in
- Test Pattern.
-
- gLCD should work for all Nokia Clone 128x128 screens which have the
- Epson controller chip.
-*/
-
-#include <gLCD.h>
-
-//You can use these variables to set the pin numbers
-const char RST = 8;
-const char CS = 9;
-const char Clk = 13;
-const char Data = 11;
-
-/*Create an instance of the display. Lets call it 'graphic'.
- There are four variables,
- which define which pins the LCD is connected too.
- these are:
- Reset, Chip Select, Clock, Data.
-
- A fifth variable 'speed' can be included as 0 or 1, which controls whether to enter high speed mode (see below).
- If the fifth variable is omitted (i.e. only the first four are given), normal speed mode is implied.
-
- gLCD graphic(RST,CS,Clk,Data [,speed]);
-
- Note, it is also possible to enable a high speed mode which increases the speed of the display
- by a factor of >5. This is done through the library bypassing the digitalWrite function and
- directly addressing port registers.
- For the Due, High speed mode increases speed to such an extent that this example completes before you can blink.
-
- Please note that while this doesn't affect how you use the library (it is all handled internally),
- it is possible that it may run too fast for your display and thus the display will appear to not work.
- This is UNLIKELY to happen, and I have checked with several displays which all worked fine.
-
- As of version 2.4 nothing special needs to be done to use this high speed mode, so I am now mentioning
- it is the example file.
-
-*/
-//For normal speed, use:
-gLCD graphic(RST,CS,Clk,Data,NORMAL_SPEED); //Normal speed
-
-//For high speed, use:
-// gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed
-
-
-void setup() {
- /*Display needs to be initialised. You only need to do this once,
- You may have to press the Arduino reset button after uploading
- your code as the screen may fail to startup otherwise
-
- The first two variables in the begin() call specify where on the screen
- origin is. On some screens the first one or two rows/cols of
- pixels aren't visible, so begin(X,Y,,) allows all X and Y co-ords
- to be shifted slightly. (0,2) works well for both my screens.
-
- The third variable specifies whether the colours are inverted.
- If the White background is Black on your screen, set this to a 1
- Else leave it as a zero
-
- The fourth variable is the driver to use you can choose from. There are 6 drivers:
- EPSON (or) EPSON_4 (both are the same)
- EPSON_5
- PHILLIPS_0
- PHILLIPS_1
- PHILLIPS_2
- PHILLIPS_3
-
- For an Epson Screen:
- */
-
- //This
- graphic.begin(0,0,0,EPSON); //Normal Epson
- //or
- //graphic.begin(0,0,0,EPSON_4); //Normal Epson
- //or
- //graphic.begin(0,0,0,EPSON_5); //16bit mode Epson - suits some rare screens.
-
- //For a Phillips Screen:
- //This
- //graphic.begin(0,0,0,PHILLIPS_0); //Normal X direction
- //or
- //graphic.begin(0,0,0,PHILLIPS_1); //Revesed X direction.
- //or
- //graphic.begin(0,0,0,PHILLIPS_2); //Normal X direction, Mirrored.
- //or
- //graphic.begin(0,0,0,PHILLIPS_3); //Revesed X direction, Mirrored.
-
-
-
- /*If you can't see the colours properly, then uncomment the
- graphic.Contrast() function.
- If the Screen is too dark, or you cant see anything send a value >0x2B (>0x30 for Phillips). If you cant see all
- the different colours distinctly on the test pattern, send a value <0x2B (<0x30 for Phillips). The default values
- should work for many screens, so you may not have to use this at all.
-
- Range for phillips: -0x3F to 0x3F
- Range for EPSON: 0x00 to 0x3F
- */
-
- //graphic.Contrast(0x2B);
-}
-void loop() {
- //Print out the test pattern.
- graphic.testPattern();
- while(1); //Finished
-}
View
1,152 Version 3_2/gLCD.cpp
@@ -1,1152 +0,0 @@
-/*
- Sparkfun Nokia knockoff screen 128x128 controller. Should work with (all) screens.
-
- Code written by Thomas Carpenter (2011)
-
- ==================================================================================================
- Current Library Version: 3.2b
-
- See header file for function descriptions and ChangeLog
-
-*/
-#if ARDUINO >= 100
- #include "Arduino.h"
-#else
- #include "WProgram.h"
-#endif
-#include "gLCD.h"
-#ifndef _LIB_SAM_
-#define PGMSPACE PROGMEM
-#include <avr/pgmspace.h>
-#else
-#define PGMSPACE const
-#endif
-//Character Database store
-
-//This is how many custom characters you have added to the end of the map. There are no more than 128 allowed.
-#define numberOfCustomCharacters 9
-PGMSPACE DEFAULT_DATA_TYPE charData[96 + numberOfCustomCharacters][5] = {
- {0x00 , 0x00 , 0x00 , 0x00 , 0x00 }, // 32 = <space>
- {0x00 , 0x06 , 0x5F , 0x06 , 0x00 }, // 33 = !
- {0x07 , 0x03 , 0x00 , 0x07 , 0x03 }, // 34 = "
- {0x24 , 0x7E , 0x24 , 0x7E , 0x24 }, // 35 = #
- {0x24 , 0x2B , 0x6A , 0x12 , 0x00 }, // 36 = $
- {0x63 , 0x13 , 0x08 , 0x64 , 0x63 }, // 37 = %
- {0x36 , 0x49 , 0x56 , 0x20 , 0x50 }, // 38 = &
- {0x00 , 0x07 , 0x03 , 0x00 , 0x00 }, // 39 = '
- {0x00 , 0x3E , 0x41 , 0x00 , 0x00 }, // 40 = (
- {0x00 , 0x41 , 0x3E , 0x00 , 0x00 }, // 41 = )
- {0x08 , 0x3E , 0x1C , 0x3E , 0x08 }, // 42 = *
- {0x08 , 0x08 , 0x3E , 0x08 , 0x08 }, // 43 = +
- {0x00 , 0xE0 , 0x60 , 0x00 , 0x00 }, // 44 = ,
- {0x08 , 0x08 , 0x08 , 0x08 , 0x08 }, // 45 = -
- {0x00 , 0x60 , 0x60 , 0x00 , 0x00 }, // 46 = .
- {0x20 , 0x10 , 0x08 , 0x04 , 0x02 }, // 47 = /
- {0x3E , 0x51 , 0x49 , 0x45 , 0x3E }, // 48 = 0
- {0x00 , 0x42 , 0x7F , 0x40 , 0x00 }, // 49 = 1
- {0x62 , 0x51 , 0x49 , 0x49 , 0x46 }, // 50 = 2
- {0x22 , 0x49 , 0x49 , 0x49 , 0x36 }, // 51 = 3
- {0x18 , 0x14 , 0x12 , 0x7F , 0x10 }, // 52 = 4
- {0x2F , 0x49 , 0x49 , 0x49 , 0x31 }, // 53 = 5
- {0x3C , 0x4A , 0x49 , 0x49 , 0x30 }, // 54 = 6
- {0x01 , 0x71 , 0x09 , 0x05 , 0x03 }, // 55 = 7
- {0x36 , 0x49 , 0x49 , 0x49 , 0x36 }, // 56 = 8
- {0x06 , 0x49 , 0x49 , 0x29 , 0x1E }, // 57 = 9
- {0x00 , 0x6C , 0x6C , 0x00 , 0x00 }, // 58 = :
- {0x00 , 0xEC , 0x6C , 0x00 , 0x00 }, // 59 = ;
- {0x08 , 0x14 , 0x22 , 0x41 , 0x00 }, // 60 = <
- {0x24 , 0x24 , 0x24 , 0x24 , 0x24 }, // 61 = =
- {0x00 , 0x41 , 0x22 , 0x14 , 0x08 }, // 62 = >
- {0x02 , 0x01 , 0x59 , 0x09 , 0x06 }, // 63 = ?
- {0x3E , 0x41 , 0x5D , 0x55 , 0x1E }, // 64 = @
- {0x7E , 0x09 , 0x09 , 0x09 , 0x7E }, // 65 = A
- {0x7F , 0x49 , 0x49 , 0x49 , 0x36 }, // 66 = B
- {0x3E , 0x41 , 0x41 , 0x41 , 0x22 }, // 67 = C
- {0x7F , 0x41 , 0x41 , 0x41 , 0x3E }, // 68 = D
- {0x7F , 0x49 , 0x49 , 0x49 , 0x41 }, // 69 = E
- {0x7F , 0x09 , 0x09 , 0x09 , 0x01 }, // 70 = F
- {0x3E , 0x41 , 0x49 , 0x49 , 0x7A }, // 71 = G
- {0x7F , 0x08 , 0x08 , 0x08 , 0x7F }, // 72 = H
- {0x00 , 0x41 , 0x7F , 0x41 , 0x00 }, // 73 = I