/*

* S65juras.c Compiled with AVRStudio v.5 // http://www.atmel.com

* Project based on Juras-Projects 2011 http://www.juras-projects.org/eng/lcd.php

* Created: 22. 12. 2011 8:23:54

* Author: Joyc 2012; web site http://empetri.unas.cz

*

* Processor: ATMega328P (or ATMega644)

* This driver take approximately 8kB space of memory on ATMega328P.

* It can be reduced.

* Schematics: S65schematics.pdf

LCD orientation - horizontal

(131) ^-------------------------------+ (175,131)

y | |

| |

|_ __ _text |

y1 | | |

| | |

| | |

(0,0) +------------------------------->(175)

x1 x

TEXT orientation - horizontal and vertical (LCD orientation is NOT changed)

*

*January 2011

* ADDED: -functions "ls020_put_string8" and "ls020_put_string8_vertical" supports 4 types of characters, transparent and with background (two types is with diacritics)

* -put string from PROGRAM memory "ls020_put_string8_P". (horizontal and vertical for 4 types of characters)

* -put char and string. (horizontal and vertical)

* -Shapes like pixel8, pixel16, line, cyrcle, rectangles ...

* -Show bitmap on LCD "s65_load_picture16" function

* -Pictures rotation (90 degree - vertical)

* -delay reduction (I thing the driver is faster)

* -Deactivate and Activate the screen

* -Inversion mode of LCD

* -Functions description

* -LCD backlight PWM control-brightness can be set

*

* PLANNING: -loading the pictures from SD card and show transparent picture for selected color

* -Colored rectangles (from dark to light, color crossing, with transition on frame)

* -Awaiting for your improve too :-)

*

* Known BUGS: -Impossible to program AVR when display is connected

* - sorry for my bad English :-)

*/

#include <avr/io.h>

#include <stdlib.h>

#include <stdint.h>

#include <stdio.h>

#include <stdbool.h>

#include <string.h>

#include <avr/pgmspace.h>

#ifndef F_CPU

/* prevent compiler error by supplying a default */

//# warning "F_CPU not defined for <util/delay.h>"

#define F_CPU 16000000UL //16MHz

#endif

#include <util/delay.h>

#define USE_PICTURE 1 //Yes=1, NO=0

#if USE_PICTURE == 1

#include "logo_color.h" // take big space in program memory

//#include "ba.h"

#endif

//--global variables------------------

uint8_t S65_WIDTH=176;//x max

uint8_t S65_HEIGHT=132;//y max

 

//---LCD PIN definitions------------------------------------------------------------------

#define RS PB0

#define RST PB1

#define CS PB2

//clk SCK -PB5

//data MOSI -PB3

//PWM PD6 - can be changed in function "LCD_brightness_ON"

//-------------------------------------------------------------------------------------------

 

//--------source of color palette: http://www.w3schools.com/tags/ref_color_tryit.asp and http://www.juras-projects.org/eng/lcd.php

#define CL8_RED 0xE0

#define CL8_RED_DARK 0x80

#define CL8_ORANGE 0xEC

#define CL8_PURPLE 0xE2

#define CL8_PURPLE_DARK 0xA2

#define CL8_GREEN 0x1C

#define CL8_GREEN_DARK 0x0C

#define CL8_BLUE 0x03

#define CL8_BLUE_DARK 0x02

#define CL8_BLUE_LIGHT 0x97//12

#define CL8_TEAL 0x2F

#define CL8_YELLOW 0xFC

#define CL8_YELLOW_DARK 0xF4

#define CL8_BROWN 0x88

#define CL8_WHITE 0xFF

#define CL8_GRAY 0x92//96

#define CL8_BLACK 0x00

#define CL8_COLOR_RGB(r, g, b) ( (r & 0xE0) | ((g & 0xE0) >> 3) | ((b & 0xC0) >> 6)) //get color from R G B

//#define CL8_GRAY CL8_COLOR_RGB(128, 128, 128)

//#define CL8_BROWN CL8_COLOR_RGB(139,69,19) //139,69,19 Brown

//#define CL8_ORANGE CL8_COLOR_RGB(255,140,0) //Orange

//#define CL8_TEAL CL8_COLOR_RGB(0,128,128 ) //Teal tyrkysova

//#define CL8_PURPLE CL8_COLOR_RGB(163,0,163) //Dark violet=Dark Purple , tmavo fialova

//#define CL8_DARK_GREEN CL8_COLOR_RGB(0,100,0 ) ////Dark green 0,100,0

//CL8_COLOR_RGB( 255, 239, 0)

 

 

//--------------init sequences-----------------------------------------------------------

const unsigned char init0[20] PROGMEM ={

0xEF, 0x00, 0xEE, 0x04, 0x1B, 0x04, 0xFE, 0xFE, 0xFE, 0xFE, 0xEF, 0x90, 0x4A, 0x04, 0x7F, 0x3F, 0xEE, 0x04, 0x43, 0x06};

const unsigned char init1[46] PROGMEM = {

0xEF, 0x90, 0x09, 0x83, 0x08, 0x00, 0x0B, 0xAF,

0x0A, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00,

0xEF, 0x00, 0xEE, 0x0C, 0xEF, 0x90, 0x00, 0x80,

0xEF, 0xB0, 0x49, 0x02, 0xEF, 0x00, 0x7F, 0x01,

0xE1, 0x81, 0xE2, 0x02, 0xE2, 0x76, 0xE1, 0x83,

0x80, 0x01, 0xEF, 0x90, 0x00, 0x00};

/* FONTS ---------------------------------------------------------------------------------

* Character lookup table code was taken from the work of Sylvain Bissonette

* This table defines the standard ASCII characters in a 5x7 dot format. 223 characters(From 32 to 255).

* Can be changed.

* EXAMPLE:

* 0 1 2 3 4

* 0 |--|--|--|--|--|

* 1 |--|--|--|--|--|

* 2 |--|X |X |X |--|

* 3 |X |--|--|--|--|

* 4 |--|X |X |X |--|

* 5 |--|--|--|--|X |

* 6 |X |X |X |X |--|

* 7 |--|--|--|--|--|

*

* 0x48,0x54,0x54,0x54,0x20, // s ( 83) //each number cover one column- 8bit in binary mode (0-7)

*/

const unsigned char font5x7[] PROGMEM = {

// Basic Characters

0x00,0x00,0x00,0x00,0x00, // space //32

0x00,0x00,0x4F,0x00,0x00, // ( 1) ! - 0x0021 Exclamation Mark

0x00,0x07,0x00,0x07,0x00, // ( 2) " - 0x0022 Quotation Mark

0x14,0x7F,0x14,0x7F,0x14, // ( 3) # - 0x0023 Number Sign

0x24,0x2A,0x7F,0x2A,0x12, // ( 4) $ - 0x0024 Dollar Sign

0x23,0x13,0x08,0x64,0x62, // ( 5) % - 0x0025 Percent Sign

0x36,0x49,0x55,0x22,0x50, // ( 6) & - 0x0026 Ampersand

0x00,0x05,0x03,0x00,0x00, // ( 7) ' - 0x0027 Apostrophe

0x00,0x1C,0x22,0x41,0x00, // ( 8) ( - 0x0028 Left Parenthesis

0x00,0x41,0x22,0x1C,0x00, // ( 9) ) - 0x0029 Right Parenthesis

0x14,0x08,0x3E,0x08,0x14, // ( 10) * - 0x002A Asterisk

0x08,0x08,0x3E,0x08,0x08, // ( 11) + - 0x002B Plus Sign

0x00,0x50,0x30,0x00,0x00, // ( 12) , - 0x002C Comma

0x08,0x08,0x08,0x08,0x08, // ( 13) - - 0x002D Hyphen-Minus

0x00,0x60,0x60,0x00,0x00, // ( 14) . - 0x002E Full Stop

0x20,0x10,0x08,0x04,0x02, // ( 15) / - 0x002F Solidus

0x3E,0x51,0x49,0x45,0x3E, // ( 16) 0 - 0x0030 Digit Zero

0x00,0x42,0x7F,0x40,0x00, // ( 17) 1 - 0x0031 Digit One

0x42,0x61,0x51,0x49,0x46, // ( 18) 2 - 0x0032 Digit Two

0x21,0x41,0x45,0x4B,0x31, // ( 19) 3 - 0x0033 Digit Three

0x18,0x14,0x12,0x7F,0x10, // ( 20) 4 - 0x0034 Digit Four

0x27,0x45,0x45,0x45,0x39, // ( 21) 5 - 0x0035 Digit Five

0x3C,0x4A,0x49,0x49,0x30, // ( 22) 6 - 0x0036 Digit Six

0x01,0x71,0x09,0x05,0x03, // ( 23) 7 - 0x0037 Digit Seven

0x36,0x49,0x49,0x49,0x36, // ( 24) 8 - 0x0038 Digit Eight

0x06,0x49,0x49,0x29,0x1E, // ( 25) 9 - 0x0039 Dight Nine

0x00,0x36,0x36,0x00,0x00, // ( 26) : - 0x003A Colon

0x00,0x56,0x36,0x00,0x00, // ( 27) ; - 0x003B Semicolon

0x08,0x14,0x22,0x41,0x00, // ( 28) < - 0x003C Less-Than Sign

0x14,0x14,0x14,0x14,0x14, // ( 29) = - 0x003D Equals Sign

0x00,0x41,0x22,0x14,0x08, // ( 30) > - 0x003E Greater-Than Sign

0x02,0x01,0x51,0x09,0x06, // ( 31) ? - 0x003F Question Mark

0x32,0x49,0x79,0x41,0x3E, // ( 32) @ - 0x0040 Commercial At

0x7E,0x11,0x11,0x11,0x7E, // ( 33) A - 0x0041 Latin Capital Letter A

0x7F,0x49,0x49,0x49,0x36, // ( 34) B - 0x0042 Latin Capital Letter B

0x3E,0x41,0x41,0x41,0x22, // ( 35) C - 0x0043 Latin Capital Letter C

0x7F,0x41,0x41,0x22,0x1C, // ( 36) D - 0x0044 Latin Capital Letter D

0x7F,0x49,0x49,0x49,0x41, // ( 37) E - 0x0045 Latin Capital Letter E

0x7F,0x09,0x09,0x09,0x01, // ( 38) F - 0x0046 Latin Capital Letter F

0x3E,0x41,0x49,0x49,0x7A, // ( 39) G - 0x0047 Latin Capital Letter G

0x7F,0x08,0x08,0x08,0x7F, // ( 40) H - 0x0048 Latin Capital Letter H

0x00,0x41,0x7F,0x41,0x00, // ( 41) I - 0x0049 Latin Capital Letter I

0x20,0x40,0x41,0x3F,0x01, // ( 42) J - 0x004A Latin Capital Letter J

0x7F,0x08,0x14,0x22,0x41, // ( 43) K - 0x004B Latin Capital Letter K

0x7F,0x40,0x40,0x40,0x40, // ( 44) L - 0x004C Latin Capital Letter L

0x7F,0x02,0x0C,0x02,0x7F, // ( 45) M - 0x004D Latin Capital Letter M

0x7F,0x04,0x08,0x10,0x7F, // ( 46) N - 0x004E Latin Capital Letter N

0x3E,0x41,0x41,0x41,0x3E, // ( 47) O - 0x004F Latin Capital Letter O

0x7F,0x09,0x09,0x09,0x06, // ( 48) P - 0x0050 Latin Capital Letter P

0x3E,0x41,0x51,0x21,0x5E, // ( 49) Q - 0x0051 Latin Capital Letter Q

0x7F,0x09,0x19,0x29,0x46, // ( 50) R - 0x0052 Latin Capital Letter R

0x46,0x49,0x49,0x49,0x31, // ( 51) S - 0x0053 Latin Capital Letter S

0x01,0x01,0x7F,0x01,0x01, // ( 52) T - 0x0054 Latin Capital Letter T

0x3F,0x40,0x40,0x40,0x3F, // ( 53) U - 0x0055 Latin Capital Letter U

0x1F,0x20,0x40,0x20,0x1F, // ( 54) V - 0x0056 Latin Capital Letter V

0x3F,0x40,0x38,0x40,0x3F, // ( 55) W - 0x0057 Latin Capital Letter W

0x63,0x14,0x08,0x14,0x63, // ( 56) X - 0x0058 Latin Capital Letter X

0x07,0x08,0x70,0x08,0x07, // ( 57) Y - 0x0059 Latin Capital Letter Y

0x61,0x51,0x49,0x45,0x43, // ( 58) Z - 0x005A Latin Capital Letter Z

0x00,0x7F,0x41,0x41,0x00, // ( 59) [ - 0x005B Left Square Bracket

0x02,0x04,0x08,0x10,0x20, // ( 60) \ - 0x005C Reverse Solidus

0x00,0x41,0x41,0x7F,0x00, // ( 61) ] - 0x005D Right Square Bracket

0x04,0x02,0x01,0x02,0x04, // ( 62) ^ - 0x005E Circumflex Accent

0x40,0x40,0x40,0x40,0x40, // ( 63) _ - 0x005F Low Line

0x01,0x02,0x04,0x00,0x00, // ( 64) ` - 0x0060 Grave Accent

0x20,0x54,0x54,0x54,0x78, // ( 65) a - 0x0061 Latin Small Letter A

0x7F,0x48,0x44,0x44,0x38, // ( 66) b - 0x0062 Latin Small Letter B

0x38,0x44,0x44,0x44,0x20, // ( 67) c - 0x0063 Latin Small Letter C

0x38,0x44,0x44,0x48,0x7F, // ( 68) d - 0x0064 Latin Small Letter D

0x38,0x54,0x54,0x54,0x18, // ( 69) e - 0x0065 Latin Small Letter E

0x08,0x7E,0x09,0x01,0x02, // ( 70) f - 0x0066 Latin Small Letter F

0x18,0xA4,0xA4,0xA4,0x7C, // ( 71) g - 0x0067 Latin Small Letter G

0x7F,0x08,0x04,0x04,0x78, // ( 72) h - 0x0068 Latin Small Letter H

0x00,0x44,0x7D,0x40,0x00, // ( 73) i - 0x0069 Latin Small Letter I

0x20,0x40,0x44,0x3D,0x00, // ( 74) j - 0x006A Latin Small Letter J

0x7F,0x10,0x28,0x44,0x00, // ( 75) k - 0x006B Latin Small Letter K

0x00,0x41,0x7F,0x40,0x00, // ( 76) l - 0x006C Latin Small Letter L

0x7C,0x04,0x18,0x04,0x7C, // ( 77) m - 0x006D Latin Small Letter M

0x7C,0x08,0x04,0x04,0x78, // ( 78) n - 0x006E Latin Small Letter N

0x38,0x44,0x44,0x44,0x38, // ( 79) o - 0x006F Latin Small Letter O

0x7C,0x14,0x14,0x14,0x08, // ( 80) p - 0x0070 Latin Small Letter P

0x08,0x14,0x14,0x18,0x7C, // ( 81) q - 0x0071 Latin Small Letter Q

0x7C,0x08,0x04,0x04,0x08, // ( 82) r - 0x0072 Latin Small Letter R

0x48,0x54,0x54,0x54,0x20, // ( 83) s - 0x0073 Latin Small Letter S

0x04,0x3F,0x44,0x40,0x20, // ( 84) t - 0x0074 Latin Small Letter T

0x3C,0x40,0x40,0x20,0x7C, // ( 85) u - 0x0075 Latin Small Letter U

0x1C,0x20,0x40,0x20,0x1C, // ( 86) v - 0x0076 Latin Small Letter V

0x3C,0x40,0x30,0x40,0x3C, // ( 87) w - 0x0077 Latin Small Letter W

0x44,0x28,0x10,0x28,0x44, // ( 88) x - 0x0078 Latin Small Letter X

0x0C,0x50,0x50,0x50,0x3C, // ( 89) y - 0x0079 Latin Small Letter Y

0x44,0x64,0x54,0x4C,0x44, // ( 90) z - 0x007A Latin Small Letter Z

0x00,0x08,0x36,0x41,0x00, // ( 91) { - 0x007B Left Curly Bracket

0x00,0x00,0x7F,0x00,0x00, // ( 92) | - 0x007C Vertical Line

0x00,0x41,0x36,0x08,0x00, // ( 93) } - 0x007D Right Curly Bracket

0x02,0x01,0x02,0x04,0x02, // ( 94) ~ - 0x007E Tilde

//special char add joyc

0x7F,0x7F,0x7F,0x7F,0x7F, // char 127 tu je: black rect. ( 95) C - 0x0080 <Control>

0x3E,0x55,0x55,0x41,0x22, // EURO OK ( 96) - 0x00A0 No-Break Space

0x00,0x00,0x10,0x60,0x00, // , ( 97) ! - 0x00A1 Inverted Exclamation Mark

0x00,0x00,0x60,0x60,0x00, // . ( 98) c - 0x00A2 Cent Sign

0x08,0x7E,0x09,0x01,0x02, // f ( 99) L - 0x00A3 Pound Sign

0x00,0x60,0x00,0x60,0x00, // " dole OK (100) o - 0x00A4 Currency Sign

0x40,0x00,0x40,0x00,0x40, // ... (101) Y - 0x00A5 Yen Sign

0x08,0x08,0x7E,0x08,0x08, // + križ (102) | - 0x00A6 Broken Bar

0x10,0x38,0x10,0x38,0x10, // ++ OK (103) - 0x00A7 Section Sign

0x04,0x02,0x01,0x02,0x04, // ^ OK (104) " - 0x00A8 Diaeresis

0x24,0x10,0x28,0x04,0x22, // promile (105) - 0x00AA Feminine Ordinal Indicator

0x48,0x55,0x56,0x55,0x20, // Š OK (106) << - 0x00AB Left-Pointing Double Angle Quotation Mark

0x44,0x4A,0x4A,0x51,0x51, // < OK (107) - 0x00AC Not Sign

0x3E,0x41,0x7F,0x49,0x49, // OE (108) - - 0x00AD Soft Hyphen

0x04,0x05,0x7E,0x05,0x04, // Ť OK (109) - 0x00AF Macron

0x44,0x65,0x56,0x4D,0x44, // Ž OK (110) - 0x00B0 Degree Sign

0x10,0x10,0x10,0x00,0x00, // ciara v strede (111) +- - 0x00B1 Plus-Minus Sign

0x10,0x10,0x10,0x00,0x00, // ciara v strede (112) ` - 0x00B4 Acute Accent

0x00,0x00,0x04,0x02,0x01, // dlzen opacny (113) u - 0x00B5 Micro Sign

0x00,0x00,0x04,0x02,0x01, // dlzen (114) - 0x00B6 Pilcrow Sign

0x00,0x01,0x00,0x01,0x00, // " (115) . - 0x00B7 Middle Dot

0x00,0x01,0x00,0x01,0x00, // " (116) - 0x00B8 Cedilla

0x00,0x18,0x18,0x00,0x00, // . v strede (117) - 0x00BA Masculine Ordinal Indicator

0x01,0x01,0x01,0x01,0x01, // macron (118) >> - 0x00BB Right-Pointing Double Angle Quotation Mark

0x00,0x08,0x08,0x08,0x00, // -- OK (119) /4 - 0x00BC Vulgar Fraction One Quarter

0x02,0x01,0x02,0x04,0x02, // ~ (120) /2 - 0x00BD Vulgar Fraction One Half

0x75,0x27,0x25,0x25,0x25, // TM (121) ? - 0x00BF Inverted Question Mark

0x48,0x55,0x56,0x55,0x20, // š 0x20,0x49,0x56,0x55,0x20, OK (122) `A - 0x00C0 Latin Capital Letter A with Grave

0x51,0x51,0x4A,0x4A,0x44, // > OK (123) 'A - 0x00C1 Latin Capital Letter A with Acute

0x48,0x54,0x56,0x55,0x20, // ś 0x20,0x48,0x56,0x55,0x20, //oe-0x38,0x44,0x38,0x54,0x58, OK (124) ^A - 0x00C2 Latin Capital Letter A with Circumflex

0x08,0x3C,0x49,0x22,0x01, // ť OK (125) ~A - 0x00C3 Latin Capital Letter A with Tilde

0x48,0x69,0x5A,0x49,0x00, // ž OK (126) "A - 0x00C4 Latin Capital Letter A with Diaeresis

0x07,0x08,0x70,0x08,0x07, // Y (127) A - 0x00C5 Latin Capital Letter A with Ring Above

0x00,0x00,0x00,0x00,0x00, // space (128) AE - 0x00C6 Latin Capital Letter Ae

0x00,0x00,0x79,0x00,0x00, // ! opacny OK (129) C - 0x00C7 Latin Capital Letter C with Cedilla

0x18,0x24,0x74,0x2E,0x24, // c preciarknute OK (130) `E - 0x00C8 Latin Capital Letter E with Grave

0x48,0x7E,0x49,0x42,0x40, // pound L OK (131) 'E - 0x00C9 Latin Capital Letter E with Acute

0x5D,0x22,0x22,0x22,0x5D, // "o" Currency Sign (132) ^E - 0x00CA Latin Capital Letter E with Circumflex

0x0C,0x11,0x60,0x11,0x0C, // "Y (133) "E - 0x00CB Latin Capital Letter E with Diaeresis

0x00,0x00,0x7F,0x00,0x00, // | OK (134) `I - 0x00CC Latin Capital Letter I with Grave

0x0A,0x55,0x55,0x55,0x28, // § OK (135) 'I - 0x00CD Latin Capital Letter I with Acute

0x00,0x01,0x00,0x01,0x00, // " OK (136) ^I - 0x00CE Latin Capital Letter I with Circumflex

0x00,0x0A,0x0D,0x0A,0x04, // c copyright OK (137) "I - 0x00CF Latin Capital Letter I with Diaeresis

0x20,0x54,0x54,0x54,0x78, // a (138) D - 0x00D0 Latin Capital Letter Eth

0x08,0x14,0x2A,0x14,0x22, // << (139) ~N - 0x00D1 Latin Capital Letter N with Tilde

0x04,0x04,0x04,0x04,0x1C, // NOT OK (140) `O - 0x00D2 Latin Capital Letter O with Grave

0x00,0x08,0x08,0x08,0x00, // NOT (141) 'O - 0x00D3 Latin Capital Letter O with Acute

0x01,0x01,0x01,0x01,0x01, // R v kruzku macron OK (142) ^O - 0x00D4 Latin Capital Letter O with Circumflex

0x00,0x08,0x08,0x08,0x00, // -- (143) ~O - 0x00D5 Latin Capital Letter O with Tilde

0x00,0x02,0x05,0x02,0x00, // ° OK stupen (144) "O - 0x00D6 Latin Capital Letter O with Diaeresis

0x44,0x44,0x5F,0x44,0x44, // +- OK (145) x - 0x00D7 Multiplcation Sign

0x00,0x00,0x1D,0x15,0x17, // 'index 2 (146) O - 0x00D8 Latin Capital Letter O with Stroke

0x00,0x00,0x15,0x15,0x1F, // 'index 3 (147) `U - 0x00D9 Latin Capital Letter U with Grave

0x00,0x00,0x04,0x02,0x01, // ' OK (148) 'U - 0x00DA Latin Capital Letter U with Acute

0x7E,0x20,0x20,0x10,0x3E, // u-micro OK (149) ^U - 0x00DB Latin Capital Letter U with Circumflex

0x06,0x0F,0x7F,0x00,0x7F, // P (150) "U - 0x00DC Latin Capital Letter U with Diaeresis

0x00,0x18,0x18,0x00,0x00, // middle dot (151) `Y - 0x00DD Latin Capital Letter Y with Acute

0x00,0x40,0x50,0x20,0x00, // cedilla (152) P - 0x00DE Latin Capital Letter Thom

0x00,0x00,0x00,0x02,0x1F, // ' index 1 (153) B - 0x00DF Latin Capital Letter Sharp S

0x00,0x00,0x06,0x09,0x06, // ° big (154) `a - 0x00E0 Latin Small Letter A with Grave

0x22,0x14,0x2A,0x14,0x08, // >> (155) 'a - 0x00E1 Latin Small Letter A with Acute

0x7f,0x40,0x41,0x42,0x41, // Ľ OK (156) ^a - 0x00E2 Latin Small Letter A with Circumflex

0x42,0x7e,0x40,0x02,0x01, // ĺ (157) ~a - 0x00E3 Latin Small Letter A with Tilde

0x42,0x7e,0x41,0x02,0x01, // ľ OK (158) "a - 0x00E4 Latin Small Letter A with Diaeresis

0x30,0x48,0x45,0x40,0x20, // ? inverted (159) a - 0x00E5 Latin Small Letter A with Ring Above

0x70,0x29,0x26,0x28,0x70, // `A (160) ae - 0x00E6 Latin Small Letter Ae

0x70,0x28,0x26,0x29,0x70, // Á OK (161) c - 0x00E7 Latin Small Letter c with Cedilla

0x70,0x2A,0x25,0x2A,0x70, // ^A (162) `e - 0x00E8 Latin Small Letter E with Grave

0x72,0x29,0x26,0x29,0x70, // ~A (163) 'e - 0x00E9 Latin Small Letter E with Acute

0x70,0x29,0x24,0x29,0x70, // "A (164) ^e - 0x00EA Latin Small Letter E with Circumflex

0x70,0x2A,0x2D,0x2A,0x70, // A (165) "e - 0x00EB Latin Small Letter E with Diaeresis

0x7E,0x11,0x7F,0x49,0x49, // AE (166) `i - 0x00EC Latin Small Letter I with Grave

0x0E,0x51,0x51,0x71,0x11, // C with cedilla (167) 'i - 0x00ED Latin Small Letter I with Acute

0x38,0x45,0x46,0x45,0x20, // Č OK (168) ^i - 0x00EE Latin Small Letter I with Circumflex

0x7C,0x55,0x56,0x54,0x44, // É OK (169) "i - 0x00EF Latin Small Letter I with Diaeresis

0x7C,0x56,0x55,0x56,0x44, // ^E (170) - 0x00F0 Latin Small Letter Eth

0x7C,0x55,0x54,0x55,0x44, // "E (171) ~n - 0x00F1 Latin Small Letter N with Tilde

0x00,0x45,0x7E,0x44,0x00, // `I (172) `o - 0x00F2 Latin Small Letter O with Grave

0x00,0x44,0x7E,0x45,0x00, // Í OK (173) 'o - 0x00F3 Latin Small Letter O with Acute

0x00,0x46,0x7D,0x46,0x00, // ^I (174) ^o - 0x00F4 Latin Small Letter O with Circumflex

0x7C,0x45,0x46,0x45,0x38, // Ď OK (175) ~o - 0x00F5 Latin Small Letter O with Tilde

0x7F,0x49,0x41,0x22,0x1C, // D preciarknute (176) "o - 0x00F6 Latin Small Letter O with Diaeresis

0x7C,0x0A,0x11,0x22,0x7D, // ~N (177) + - 0x00F7 Division Sign

0x38,0x45,0x46,0x44,0x38, // `O (178) o - 0x00F8 Latin Small Letter O with Stroke

0x38,0x44,0x46,0x45,0x38, // Ó OK (179) `u - 0x00F9 Latin Small Letter U with Grave

0x38,0x46,0x45,0x46,0x38, // ^O (180) 'u - 0x00FA Latin Small Letter U with Acute

0x38,0x46,0x45,0x46,0x39, // ~O (181) ^u - 0x00FB Latin Small Letter U with Circumflex

0x38,0x45,0x44,0x45,0x38, // "O (182) "u - 0x00FC Latin Small Letter U with Diaeresis

0x22,0x14,0x08,0x14,0x22, // x (183) 'y - 0x00FD Latin Small Letter Y with Acute

0x2E,0x51,0x49,0x45,0x3A, // O (184) p - 0x00FE Latin Small Letter Thom

0x3C,0x41,0x42,0x40,0x3C, // `U (185) "y - 0x00FF Latin Small Letter Y with Diaeresis

0x3C,0x40,0x42,0x41,0x3C, // Ú OK (186) A - 0x0104 Latin Capital Letter A with Ogonek

0x3C,0x42,0x41,0x42,0x3C, // ^U (187) a - 0x0105 Latin Small Letter A with Ogonek

0x3C,0x41,0x40,0x41,0x3C, // "U (188) 'C - 0x0106 Latin Capital Letter C with Acute

0x0C,0x10,0x62,0x11,0x0C, // Ý OK (189) 'c - 0x0107 Latin Small Letter C with Acute

0x7F,0x12,0x12,0x12,0x0C, // P thom (190) C - 0x010C Latin Capital Letter C with Caron

0x40,0x3E,0x01,0x49,0x36, // beta (191) c - 0x010D Latin Small Letter C with Caron

0x78,0x10,0x0a,0x09,0x10, // ŕ //`a 0x20,0x55,0x56,0x54,0x78} (192) D - 0x010E Latin Capital Letter D with Caron

0x20,0x54,0x56,0x55,0x78, // á OK (193) d' - 0x010F Latin Small Letter D with Caron

0x20,0x56,0x55,0x56,0x78, // ^a (194) E - 0x0118 Latin Capital Letter E with Ogonek

0x20,0x55,0x56,0x55,0x78, // ~a (195) e - 0x0119 Latin Small Letter E with Ogonek

0x20,0x55,0x54,0x55,0x78, // "a (196) E - 0x011A Latin Capital Letter E with Caron

0x42,0x7e,0x40,0x02,0x01, // ĺ OK //a with rong above (197) e - 0x011B Latin Small Letter E with Caron

0x24,0x54,0x78,0x54,0x58, // ae (198) i - 0x0131 Latin Small Letter Dotless I

0x0C,0x52,0x52,0x72,0x13, // c with cedilla (199) L - 0x0141 Latin Capital Letter L with Stroke

0x30,0x49,0x4A,0x49,0x20, // č OK (200) l - 0x0142 Latin Small Letter L with Stroke

0x38,0x54,0x56,0x55,0x18, // é OK (201) 'N - 0x0143 Latin Capital Letter N with Acute

0x38,0x56,0x55,0x56,0x18, // ^e (202) 'n - 0x0144 Latin Small Letter N with Acute

0x38,0x55,0x54,0x55,0x18, // "e (203) N - 0x0147 Latin Capital Letter N with Caron

0x38,0x55,0x56,0x55,0x18, // ě OK (204) n - 0x0148 Latin Small Letter N with Caron

0x00,0x48,0x7A,0x41,0x00, // í OK (205) "O - 0x0150 Latin Capital Letter O with Double Acute

0x00,0x4A,0x79,0x42,0x00, // ^i (206) "o - 0x0151 Latin Small Letter O with Double Acute

0x20,0x50,0x50,0x7C,0x03, // ď OK (207) OE - 0x0152 Latin Capital Ligature Oe

0x31,0x4A,0x4E,0x4A,0x30, // eth (208) oe - 0x0153 Latin Small Ligature Oe

0x7A,0x11,0x0A,0x09,0x70, // ~n (209) R - 0x0158 Latin Capital Letter R with Caron

0x78,0x11,0x0A,0x09,0x70, // ň OK (210) r - 0x0159 Latin Small Letter R with Caron

0x30,0x48,0x4A,0x49,0x30, // ó OK (211) 'S - 0x015A Latin Capital Letter S with Acute Š

0x30,0x4A,0x49,0x4A,0x30, // ô OK (212) 's - 0x015B Latin Small Letter S with Acute š

0x30,0x4A,0x49,0x4A,0x31, // ~o (213) S - 0x0160 Latin Capital Letter S with Caron

0x30,0x4A,0x48,0x4A,0x30, // "o (214) s - 0x0161 Latin Small Letter S with Caron

0x08,0x08,0x2A,0x08,0x08, // -:- (215) T - 0x0164 Latin Capital Letter T with Caron

0x78,0x11,0x0a,0x09,0x10, // ř //o with stroke (216) t' - 0x0165 Latin Small Letter T with Caron

0x38,0x42,0x45,0x22,0x78, // ů OK //`u 0x38,0x41,0x42,0x20,0x78} (217) U - 0x016E Latin Capital Letter U with Ring Above

0x3C,0x40,0x42,0x21,0x7C, // ú OK (218) u - 0x016F Latin Small Letter U with Ring Above

0x38,0x42,0x41,0x22,0x78, // ^u (219) "U - 0x0170 Latin Capital Letter U with Double Acute

0x38,0x42,0x40,0x22,0x78, // "u (220) "u - 0x0171 Latin Small Letter U with Double Acute

0x0C,0x50,0x52,0x51,0x3C, // ý OK (221) "Y - 0x0178 Latin Capital Letter Y with Diaeresis

0x7E,0x14,0x14,0x14,0x08, // p thom (222) 'Z - 0x0179 Latin Capital Letter Z with Acute

0x0C,0x51,0x50,0x51,0x3C, // "y //znak:\n// (223) 'z - 0x017A Latin Small Letter Z with Acute

0x1E,0x09,0x09,0x29,0x5E, // Ao (224) Z - 0x017B Latin Capital Letter Z with Dot Above

0x08,0x15,0x15,0x35,0x4E, // ao (225) z - 0x017C Latin Small Letter Z with Dot Above

0x38,0x44,0x46,0x45,0x20, // 'C (226) Z - 0x017D Latin Capital Letter Z with Caron

0x30,0x48,0x4A,0x49,0x20, // 'c (227) z - 0x017E Latin Small Letter Z with Caron

0x00,0x02,0x01,0x02,0x00, // (228) ^ - 0x02C6 Modifier Letter Circumflex Accent

0x00,0x01,0x02,0x01,0x00, // (229) - 0x02C7 Caron

0x00,0x01,0x01,0x01,0x00, // (230) - 0x02C9 Modifier Letter Macron

0x01,0x02,0x02,0x01,0x00, // (231) - 0x02D8 Breve

0x00,0x00,0x01,0x00,0x00, // (232) - 0x02D9 Dot Above

0x00,0x02,0x05,0x02,0x00, // (233) - 0x02DA Ring Above

0x02,0x01,0x02,0x01,0x00, // (234) ~ - 0x02DC Small Tilde

0x7F,0x05,0x15,0x3A,0x50, // (235) Pt - 0x20A7 Peseta Sign

0x3E,0x55,0x55,0x41,0x22, // (236) C - 0x20AC Euro Sign

0x18,0x14,0x08,0x14,0x0C, // (237) - 0x221E Infinity

0x44,0x4A,0x4A,0x51,0x51, // (238) < - 0x2264 Less-Than or Equal to

0x51,0x51,0x4A,0x4A,0x44, // (239) > - 0x2265 Greater-Than or Equal to

0x74,0x42,0x41,0x42,0x74, // (240) - 0x2302 House

0x55,0x2A,0x55,0x2A,0x55 //255 "Yen"

} ;

 

// ascii table 2, starting with character blank (32)

// size is 8x14

const unsigned char font8x14[] PROGMEM ={

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // space (32)

0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, //!

0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //"

0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, //#

0x00, 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, //$

0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x66, 0xc6, 0x00, 0x00, // %

0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0x76, 0x00, 0x00, // &

0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // '

0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, // (

0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, // )

0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, // *

0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, // +

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, // ´

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // -

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, // .

0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, // /

0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, // 0 (48-32)

0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x1e, 0x00, 0x00,

0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00,

0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00,

0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00,

0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00,

0x00, 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00,

0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00,

0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0xf0, 0x00, 0x00,

0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0x66, 0x3a, 0x00, 0x00,

0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00, 0x00,

0x00, 0x00, 0x00, 0xe6, 0x66, 0x6c, 0x6c, 0x78, 0x6c, 0x6c, 0x66, 0xe6, 0x00, 0x00,

0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00,

0x00, 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00,

0x00, 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0e, 0x00,

0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00,

0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00,

0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x6c, 0x00, 0x00,

0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x7c, 0xc6, 0xc6, 0xc6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00,

0x00, 0x00, 0x00, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00,

0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00,

0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00,

0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,

0x00, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00, 0x00,

0x00, 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x1c, 0x36, 0x32, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78,

0x00, 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c,

0x00, 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0xf0, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x70, 0x1c, 0xc6, 0x7c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x66, 0xfe, 0x00, 0x00,

0x00, 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00,

0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,

0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00,

0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00,

};

 

void ls020_wrcmd8(char cmd)

{

PORTB|=(1<<RS); //Set RS

PORTB&=~(1<<CS); // select LCD

SPDR=cmd;

while (!(SPSR & (1 << SPIF))); //right solution instead of using delay

//_delay_us(1);

PORTB|=(1<<CS); // deselect LCD

}

void ls020_wrcmd16(uint16_t cmd16)

{

ls020_wrcmd8(cmd16>>8);

ls020_wrcmd8(cmd16);

}

void ls020_wrdata8(char data)

{

PORTB&=~(1<<RS); // Clear RS

PORTB&=~(1<<CS); // select LCD

SPDR=data;

while (!(SPSR & (1 << SPIF))); //right solution instead of using delay

//_delay_us(1);

PORTB|=(1<<CS); // deselect LCD

}

void ls020_wrdata16(uint16_t data)

{

PORTB&=~(1<<RS); //Clear RS

PORTB&=~(1<<CS); // select LCD

SPDR=(data>>8); // (data>>8) & 0xff;

while (!(SPSR & (1 << SPIF))); //right solution instead of using delay

//_delay_us(1);

// PORTB|=(1<<CS); // deselect LCD

// PORTB&=~(1<<CS); // select LCD

SPDR=data; //data & 0xff;

while (!(SPSR & (1 << SPIF))); //right solution instead of using delay

//_delay_us(1);

PORTB|=(1<<CS); // deselect LCD

}

/*------LCD MODE--------------------------------------**************************************-*/

//---ls020_8bit_mode(0); is OK -----How this work????????

void ls020_8bit_mode(char BGR)// BGR=0 - disabled, BGR=1 - enabled.

{

//ls020_wrcmd16(0xEF90);

ls020_wrcmd16(0xE800+(BGR&0x01)*0x40); //

}

void ls020_8_color_mode(void)

{

//ls020_wrcmd16(0xEF90);

ls020_wrcmd16(0x0401);

ls020_wrcmd16(0x0000);

}

void ls020_16bit_mode(void)

{

//ls020_wrcmd16(0xEF90);

ls020_wrcmd16(0xE80F);

}

void ls020_65k_color_mode(void) //65k color mode ?? what is this??? because 16bit has 65536 colors

{

//ls020_wrcmd16(0xEF90);

ls020_wrcmd16(0x0400);

ls020_wrcmd16(0x0000);

}

//-****************************************????????????????*****************************************

//-- how to put all modes to one function?????? (unite) ????

// void ls020_bit_mode(uint8_t mode)// mode-1=8color, next mode-8,16,65 bit

// {

// ls020_wrcmd16(0xEF90);// why you not use this before set mode according to manual???

// if (mode == 1){

// ls020_wrcmd16(0x0401);//8 color mode

// ls020_wrcmd16(0x0000);}

// if (mode == 8)

// ls020_wrcmd16(0xE801);//8 bit mode

// else if (mode == 16)

// ls020_wrcmd16(0xE80F);//16 bit mode

// else if (mode == 65){

// ls020_wrcmd16(0x0400);//65k color mode ?? what is this???

// ls020_wrcmd16(0x0000);}

//

// ----Set bit mode to 8 bit---RRGGGGBB

// ls020_wrcmd16(0xEF90);

// ls020_wrcmd16(0xE801);

//---

 

//-*********************************************************************************

 

 

 

/*--------GEOMETRICAL functions--------------------------------------------------------------------------------------

--------SHAPES----pixel, line, (filed, unfilled:) rectangle, circle ------------------------------------------------

*/

void ls020_set_window_Y(char x1, char y1, char x2,char y2) // Set window with Y direction to fill

{

ls020_wrcmd16(0x0500);// Set Direction Y for fill

ls020_wrcmd16(0x0A00+x1);

ls020_wrcmd16(0x0B00+x2);

ls020_wrcmd16(0x0800+y1);

ls020_wrcmd16(0x0900+y2);

}//then write data like in ls020_rectangle8 function

void ls020_set_window_X(char x1, char y1, char x2,char y2) // Set window with X direction to fill

{

ls020_wrcmd16(0x0504);// // Set Direction X for fill

ls020_wrcmd16(0x0A00+x1);

ls020_wrcmd16(0x0B00+x2);

ls020_wrcmd16(0x0800+y1);

ls020_wrcmd16(0x0900+y2);

}//then write data

void lcd_setPixel8(char x,char y,char color) // WRITE THE PIXEL to LCD- 8 bit = 256 colors

{

ls020_wrcmd16(0x0700+x);// Cursor position X

ls020_wrcmd16(0x0600+y);// Cursor position Y

ls020_wrdata8(color);

}

void lcd_setPixel16(char x,char y, uint16_t color) //WRITE THE PIXEL to LCD- 16 bit = 65.536 colors

{

ls020_wrcmd16(0x0700+x);// Cursor position X

ls020_wrcmd16(0x0600+y);// Cursor position Y

ls020_wrdata16(color);

}

void ls020_rectangle8(char x1, char y1, char x2, char y2, char color) //rectangle with 8bit colors fill

{

ls020_set_window_Y(x1,y1,x2,y2);

for (char y=y1;y<=y2;y++)

{

for (char x=x1;x<=x2;x++)

{

ls020_wrdata8(color);

}

}

}

 

void LCD_unfilled_Rectangle(char x, char y, char b, char a, char color)

{

unsigned char j; // zmienna pomocnicza

// rysowanie linii pionowych (boki)

for (j = 0; j < a; j++) {

lcd_setPixel8(x, y + j, color);

lcd_setPixel8(x + b - 1, y + j, color);

}

// rysowanie linii poziomych (podstawy)

for (j = 0; j < b; j++) {

lcd_setPixel8(x + j, y, color);

lcd_setPixel8(x + j, y + a - 1, color);

}

}

void LCD_Circle(char cx, char cy ,char radius, char color) // centre x, y and radius

{

int x, y, xchange, ychange, radiusError;

x = radius;

y = 0;

xchange = 1 - 2 * radius;

ychange = 1;

radiusError = 0;

while(x >= y)

{

lcd_setPixel8(cx+x, cy+y, color);

lcd_setPixel8(cx-x, cy+y, color);

lcd_setPixel8(cx-x, cy-y, color);

lcd_setPixel8(cx+x, cy-y, color);

lcd_setPixel8(cx+y, cy+x, color);

lcd_setPixel8(cx-y, cy+x, color);

lcd_setPixel8(cx-y, cy-x, color);

lcd_setPixel8(cx+y, cy-x, color);

y++;

radiusError += ychange;

ychange += 2;

if ( 2*radiusError + xchange > 0 )

{

x--;

radiusError += xchange;

xchange += 2;

}

}

}

void LCD_Filled_Circle(char rx, char ry, char radius, char color)

{

for(int y=-radius; y<=radius; y++)

for(int x=-radius; x<=radius; x++)

if(x*x+y*y <= radius*radius)

lcd_setPixel8(rx+x, ry+y, color);

}

void LCD_line(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint16_t color)

{

// -----------SOURCE: http://www.cs.unc.edu/~mcmillan/comp136/Lecture6/Lines.html ----------------

int16_t dx,dy,sx,sy,f;

uint16_t i;

dx = x2 - x1;

dy = y2 - y1;

if (dx < 0) {

dx = -dx;

sx = -1;

} else {

sx = 1;

}

if (dy < 0) {

dy = -dy;

sy = -1;

} else {

sy = 1;

}

dx <<= 1; // Shift Dx , Left , 1 '-2

dy <<= 1; // Shift Dy , Left , 1 '-2

lcd_setPixel8(x1,y1,color); // Call Lcdpixel(x1 , Y1 , Pixelmode)

if (dx > dy) {

i = dx;

i >>= 1;

f = dy-i;

while (x1!=x2) {

if (f >= 0) {

y1 += sy; //Y1 = Y1 + Stepy

f -= dx; //Fraction = Fraction - Dx

}

x1 += sx;

f += dy;

lcd_setPixel8(x1,y1,color);

}

} else {

i = dy;

i >>= 1;

f = dx-i;

while (y1!=y2) {

if (f >= 0) {

x1 += sx;

f -= dy; //Fraction = Fraction - Dy

}

y1 += sy;

f += dx;

lcd_setPixel8(x1,y1,color);

}

}

}

 

/*vertical slidebar

EXAMPLE: LCD_slidebar_vertical(10,10,80,20,xxx,CL8_GRAY ,CL8_PURPLE)*/

void LCD_slidebar_vertical(uint8_t x, uint8_t y, uint8_t width, uint8_t maxHight, uint8_t valueH, uint8_t fg, uint8_t bg)

{

if (valueH != 0) {ls020_rectangle8(x, y, width, valueH+y, fg);} //foreground color}

ls020_rectangle8(x, y+valueH, width, y+maxHight, bg); //background color

}

/*horizontal slidebar (maxWidth must be max of valueW)

EXAMPLE: LCD_slidebar_horizontal(10,10,80,20,xxx,CL8_GRAY ,CL8_PURPLE)*/

void LCD_slidebar_horizontal(uint8_t x, uint8_t y, uint8_t hight, uint8_t maxWidth, uint8_t valueW, uint8_t fg, uint8_t bg)

{

if (valueW != 0) {ls020_rectangle8(x, y, valueW+x, hight, fg);} //foreground color

ls020_rectangle8(x+valueW, y, x+maxWidth, hight, bg); //background color

}

//----END of---SHAPES----pixel, line, (filed, unfilled:) rectangle, circle ----------------------------------------------

 

 

 

 

/* ls020_put_char5x7: This function put a char 5x7 to lCD at position x y with color. ----------------------------------

"bkcolor" is color of background and must be defined /in transparent mode is ignored/

Transpatrnt mode-1, with babkground-0

Size could be 1/normal/ or 2/double/

LCD orientation

(0,131) ^-------------------------------+ (175,0)

y | |

| |

|_ __ _t |

y1 | | |

| | |

| | |

(0,0) +------------------------------->(131,175)

x1 x

Example: t positiom x1,y1 (90,50)

ls020_put_char5x7(10,30,'t',CL8_BLACK,CL8_GRAY,1,1);

*/

void ls020_put_char5x7(char x, char y, char symbol, char color, char bkcolor, char transparent, char size)

{

int offset=5*(symbol-0x20);

if((transparent==0) && (size==1))

{

ls020_rectangle8(x-1,y,x+5,y+8,bkcolor);

}

if((transparent==0) && (size==2))

{

ls020_rectangle8(x-2,y,x+5*2,y+8*2,bkcolor);

}

if (size==1)

{

for (char i=0;i<5;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font5x7[offset+i]))<<j)&0x80)==0x80)

{

lcd_setPixel8(x+i,y+j,color);

}

}

}

}//if(si...

if (size==2)

{

for (char i=0;i<5;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font5x7[offset+i]))<<j)&0x80)==0x80)

{

lcd_setPixel8(x+2*i,y+2*j,color);

lcd_setPixel8(x+2*i+1,y+2*j+1,color);

lcd_setPixel8(x+2*i,y+2*j+1,color);

lcd_setPixel8(x+2*i+1,y+2*j,color);

}

}

}

}//if(si...

}//void ls020_pu...

 

/* ls020_put_char8x14: This function put a char 8x14 to lCD at position x y with color. ---------------------

"bkcolor" is color of background and must be defined /in transparent mode is ignored/

Transpatrnt mode-1, with babkground-0

Size could be 1/normal/ or 2/double/

EXAMPLE:

ls020_put_char8x14(10,30,'A',CL8_BLACK,CL8_GRAY,1,1);

*/

void ls020_put_char8x14(char x, char y, char symbol, char color, char bkcolor, char transparent, char size)

{

int offset=14*(symbol-0x20);

if (size==2)

{

for (char i=0;i<14;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font8x14[offset+abs(i-14)]))<<j)&0x80)==0x80)

{

lcd_setPixel8(x+2*j,y+2*i,color);

lcd_setPixel8(x+2*j+1,y+2*i+1,color);

lcd_setPixel8(x+2*j,y+2*i+1,color);

lcd_setPixel8(x+2*j+1,y+2*i,color);

}

else

{

if(transparent==0)

{

lcd_setPixel8(x+2*j,y+2*i,bkcolor);

lcd_setPixel8(x+2*j+1,y+2*i+1,bkcolor);

lcd_setPixel8(x+2*j,y+2*i+1,bkcolor);

lcd_setPixel8(x+2*j+1,y+2*i,bkcolor);

}

}

}

}

}//if(si...

if (size==1)

{

for (char i=0;i<14;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font8x14[offset+abs(i-14)]))<<j)&0x80)==0x80)

{

lcd_setPixel8(x+j,y+i,color); //ked sa zameni i a j, potom je otocene o 90 stupnov

}

else

{

if(transparent==0)

{

lcd_setPixel8(x+j,y+i,bkcolor);

}

}

}

}

}//if(si...

}

 

 

 

/*----ls020_put_string8: this function put a string at xy position-means left down corner of text ---------------

---- FONT 5x7 or FONT 8x14 is used in normal-1 and double_size-2, coul be nontransparent-0 ortransparent-1 -----

-----fontType_5x7=1, fontType_8x14-2; transparent 0=off, 1=on; size 1-small, 2=big ----------------------------

for now, after out of border not continue at next line -will be solved.

LCD orientation

(131) ^-------------------------------+ (175,131)

y | |

| |

|_ __ _text |

y1 | | |

| | |

| | |

(0,0) +------------------------------->(175)

x1 x

Example text positiom x1,y1 (90,50):

char text6[]= "text";

ls020_put_string8(90,50,text6,CL8_WHITE,CL8_BLACK,1,1,1); //small transparent text style5x7

OR:

ls020_put_string8(90,50,"text",CL8_WHITE,CL8_BLACK,0,1,2);//double nomtransparent(with black background) text style8x14

Hight of small FONT 5x7 is 8 (16 lines per LCD).

Hight of small FONT 8x14 is I think 14 maybe 15 (9 lines per LCD). - must be count.

We must take into the account the frame 1px above the font. The pixel below is inside the font.

Big font have double Hight.

-----------------------------------------------------------------------------------------------------------*/

void ls020_put_string8(char x, char y, char *text, char color, char bkcolor,char transparent, char fontType_1_5x7or_2_8x14, char size)

{

char i=0;

char x0=0;

if ((fontType_1_5x7or_2_8x14==1) || (fontType_1_5x7or_2_8x14==2))

{

while (text[i]!=0)

{

if (fontType_1_5x7or_2_8x14==1)

{

ls020_put_char5x7(x+x0,y,text[i],color,bkcolor,transparent,size);//

i++;

if (size==1)

{

x0+=6;

}

else

{

x0+=12;

}

}

if (fontType_1_5x7or_2_8x14==2)

{

ls020_put_char8x14(x+x0,y,text[i],color,bkcolor,transparent,size);

i++;

if (size==1)

{

x0+=8;

}

else

{

x0+=16;

}

}

}//while

}//if((fontTyp...

}

 

 

 

//NEW

void ls020_put_char5x7_vertical(char x, char y, char symbol, char color, char bkcolor, char transparent, char size)

{

int offset=5*(symbol-0x20);

if((transparent==0) && (size==1))

{

ls020_rectangle8(y-1,x-1,y+7,x+5,bkcolor);

}

if((transparent==0) && (size==2))

{

ls020_rectangle8(y-1-7,x-2,y+7,x+5*2,bkcolor);

}

if (size==1)

{

for (char i=0;i<5;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font5x7[offset+i]))<<j)&0x80)==0x80) //abs(i-4)

{

lcd_setPixel8(y+7-j,x+i,color);

}

}

}

}//if(si...

if (size==2)

{

for (char i=0;i<5;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font5x7[offset+i]))<<j)&0x80)==0x80)

{

lcd_setPixel8(y+7-2*j,x+2*i,color);

lcd_setPixel8(y+7-2*j+1,x+2*i,color);

lcd_setPixel8(y+7-2*j,x+2*i+1,color);

lcd_setPixel8(y+7-2*j+1,x+2*i+1,color);

}

}

}

}//if(si...

}

//new

void ls020_put_char8x14_vertical(char x, char y, char symbol, char color, char bkcolor, char transparent, char size)

{

int offset=14*(symbol-0x20);

if (size==2)

{

for (char i=0;i<14;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font8x14[offset+i]))<<j)&0x80)==0x80)

{

lcd_setPixel8(x+2*i,y+2*j,color);

lcd_setPixel8(x+2*i+1,y+2*j+1,color);

lcd_setPixel8(x+2*i,y+2*j+1,color);

lcd_setPixel8(x+2*i+1,y+2*j,color);

}

else

{

if(transparent==0)

{

lcd_setPixel8(x+2*i,y+2*j,bkcolor);

lcd_setPixel8(x+2*i+1,y+2*j+1,bkcolor);

lcd_setPixel8(x+2*i,y+2*j+1,bkcolor);

lcd_setPixel8(x+2*i+1,y+2*j,bkcolor);

}

}

}

}

}//if(si...

if (size==1)

{

for (char i=0;i<14;i++)

{

for (char j=0;j<8;j++)

{

if ((((pgm_read_byte(&font8x14[offset+i]))<<j)&0x80)==0x80)

{

lcd_setPixel8(x+i,y+j,color); //ked sa zameni i a j, potom je otocene o 90 stupnov

}

else

{

if(transparent==0)

{

lcd_setPixel8(x+i,y+j,bkcolor);

}

}

}

}

}//if(si...

}

//new

void ls020_put_string8_vertical(char x, char y, char *text, char color, char bkcolor,char transparent, char fontType_1_5x7or_2_8x14, char size)

{

char i=0;

char y0=0;

//char x0=0;

if ((fontType_1_5x7or_2_8x14==1) || (fontType_1_5x7or_2_8x14==2))

{

while (text[i]!=0)

{

if (fontType_1_5x7or_2_8x14==1)

{

ls020_put_char5x7_vertical(y+y0,x,text[i],color,bkcolor,transparent,size);//

i++;

if (size==1)

{

y0+=6;

}

else

{

y0+=12;

}

}

if (fontType_1_5x7or_2_8x14==2)

{

ls020_put_char8x14_vertical(x,y+y0,text[i],color,bkcolor,transparent,size);

i++;

if (size==1)

{

y0+=8;

}

else

{

y0+=16;

}

}

}//while..

}//if...

}

/*ls020_put_string8_P: put the string from PROGRAM MEMORY------------------------------------------ALL TYPES of FONTS---

x,y =start coordination(left bottom corner of first character in normal mode; left upon corner in vertical mode)-----

transparent 0=off, 1=on; size 1-small, 2=big-------------------------------------------------------------------------

fontType_5x7=1, fontType_8x14=2 -------------------------------------------------------------------------------------

Siye: Small=1 and Double size=2, transparent=1 or nontransparent=0---------------------------------------------------

Last parameter is orientation 0=horizontal(normal), 1=vertical -----------------------------------------------------

Example: ls020_put_string8_P(130,20,PSTR("some text"),CL8_YELLOW,CL8_BLACK,1,1,1,0);//horizontal small type 1

ls020_put_string8_P(130,20,PSTR("some text"),CL8_YELLOW,CL8_BLACK,1,2,2,1);//vertical big type 2

ls020_put_string8_P(155,20,PSTR("bla bla."),CL8_YELLOW,CL8_BLACK,1,2,1,1);//vertical small type 2

*/

void ls020_put_string8_P(char x, char y, PGM_P text, char color, char bkcolor, char transparent, char fontType_1_5x7or_2_8x14, char size, char horizontal_0_vertical_1) //from prog. mem.

{

char x0=0;

char s[strlen_P(text) + 1];

strcpy_P(s, text);

if (horizontal_0_vertical_1==0)

{

ls020_put_string8(x+x0,y,s,color,bkcolor,transparent,fontType_1_5x7or_2_8x14,size);

}

else

{

ls020_put_string8_vertical(x+x0,y,s,color,bkcolor,transparent,fontType_1_5x7or_2_8x14,size);

}

}

 

/*----------LOAD PICTURE----- 16bit_mode ----------------------------------------------------------------------------

--------Nothing write if the picture is out of border!!!!!

EXAMPLE of picture with frame:

int rec_x=74; //position x

int rec_y=70; //position y

int image_w=50;

int image_h=50;

ls020_rectangle8(rec_x-2,rec_y-2,rec_x+50+1,rec_y+50+1,CL8_GREEN);//obramok //frame

s65_load_picture16((prog_uint16_t*)&color_logo,rec_x,rec_y,image_w,image_h); // Image width: 50px, Height: 50px

*/

void LCD_load_picture16(prog_uint16_t* pData, uint8_t x, uint8_t y, uint8_t w, uint8_t h) //data, position x y, picture size w h

{

ls020_16bit_mode(); //16 bit

//ls020_wrcmd16(0xE80F);//16 bit -ok

uint8_t y2,x2;

uint16_t b;

//h--;

w+= x;// = (w-1) + x;

h+= y;// = (h-1) + y;

if ((w > S65_WIDTH) || (h > S65_HEIGHT)) //out of border

{

ls020_8bit_mode(0); //8 bit //back to 8 bit mode

//ls020_wrcmd16(0xE801);//8 bit //back to 8 bit mode - ok

return;

}

for (y2=h;y2>y;y2--) {

//for (y2=y;y2<h;y2++) { //rotation 180 st

x2=x;

while (x2<w) {

b = pgm_read_word(pData++);

lcd_setPixel16(x2,y2,b);

x2++;

}

}

ls020_8bit_mode(0); //8 bit //back to 8 bit mode

//ls020_wrcmd16(0xE801);//8 bit //back to 8 bit mode -ok

}

//----------------------------------------------------------------------------------------

// void LCD_load_picture16_version2(prog_uint16_t* pData, uint8_t x, uint8_t y, uint8_t w, uint8_t h) //faster solution

// {

// uint8_t i,j;

// if (((x+w) > S65_WIDTH) || ((y+h) > S65_HEIGHT)) //out of border

// {

// ls020_8bit_mode(0); //8 bit //back to 8 bit mode

// //-ls020_wrcmd16(0xE801);//8 bit //back to 8 bit mode - ok

// return;

// }

//

// ls020_16bit_mode(); //16 bit

//

// ls020_wrcmd16(0x0504);// Set Direction X for fill

// //------set window-------------------------------

// ls020_wrcmd16(0x0A00+x);

// ls020_wrcmd16(0x0B00+x+w-1);

// ls020_wrcmd16(0x0800+y);

// ls020_wrcmd16(0x0900+y+h-1);

//

//

// for (i=x;i<x+w;i++)

// {

// for (j=y;j<y+h;j++)

// {

// ls020_wrdata16(pgm_read_word(w*h+pData--));

// }

// }

//

// ls020_8bit_mode(0); //8 bit //back to 8 bit mode

// }

//

void LCD_load_picture16_vertical(prog_uint16_t* pData, uint8_t x, uint8_t y, uint8_t w, uint8_t h) //faster solution

{

uint8_t i,j;

if (((x+h) > S65_WIDTH) || ((y+w) > S65_HEIGHT)) //out of border

{

ls020_8bit_mode(0); //8 bit //back to 8 bit mode

//ls020_wrcmd16(0xE801);//8 bit //back to 8 bit mode - ok

return;

}

ls020_16bit_mode(); //16 bit

ls020_set_window_Y(x,y,x+h-1,y+w-1);

for (i=x;i<x+w;i++)

{

for (j=y;j<y+h;j++)

{

ls020_wrdata16(pgm_read_word(pData++));

}

}

ls020_8bit_mode(0); //8 bit //back to 8 bit mode

}

 

 

// void scroll(char scr)

// {

// ls020_wrcmd(0xEF);

// ls020_wrcmd(0x90);

// ls020_wrcmd(0x11);

// ls020_wrcmd(scr);

// }

void draw_table(void)

{

for (char y=0; y<16; y++)

{

for (char x=0; x<16; x++)

{

ls020_rectangle8(x*10+9,y*7+5,x*10+8+9,y*7+5+5,y*16+x);

}

}

}

 

//----scroll------------------------

void ls020_scroll(char offset)

{

ls020_wrcmd16(0x1100+offset);

}

void partitial_scrolling(char start, char width, char offset)

{

ls020_wrcmd16(0xEF90);

ls020_wrcmd16(0x0F00+start);

ls020_wrcmd16(0x1000+width);

ls020_wrcmd16(0x1100+offset);

}

 

//---Deactivate and Activate the screen -----------

void lcd_activateScreen()

{

ls020_wrcmd16(0xEF90);

ls020_wrcmd16(0x0000);

}

void lcd_deactivateScreen(uint8_t bWhite) //Deactivate to black=0 or white=1

{

ls020_wrcmd16(0xEF90);

if (bWhite==1)

ls020_wrcmd16(0x0080);

else

ls020_wrcmd16(0x0040);

}

/* ------ inversionMode The inversion mode, either -------------------

0-LCD_INVERSION_POSITIVE

* 1-LCD_INVERSION_NEGATIVE

*/

void lcd_setInversionMode(uint8_t inversionMode)

{

ls020_wrcmd16(0xEFB0);

ls020_wrcmd16(0x4902 + inversionMode);

ls020_wrcmd16(0xEF90);

ls020_wrcmd16(0x0000);

}

 

void LCD_brightness_ON(uint8_t brightness)

{//PWM-backlight control-----------------------------------

DDRD |= (1 << PIND6); //PWM output

TCCR0A = (1 << WGM01) | (1 << WGM00) | (1 << COM0A1);

TCCR0B = (1 << CS00);

TCNT0 = 0;

OCR0A = brightness; //brightness 0=off, 80=max

/* ---For Atmega32----------------------*/

// TCCR2 = (1 << WGM21) | (1 << WGM20) | (1 << COM21) | (1 << CS20);

// TCNT2 = 0;

// OCR2 = brightnes

}

void LCD_brightness_OFF()

{

TCCR0A &= ~((1 << COM0A1) | (1 << COM0A0));

/* ---For Atmega32----------------------*/

// TCCR2 &= ~((1 << COM21) | (1 << COM20)); //brightness_OFF

}

//--------------------------------------------------

int main( void ) //------ program --------------------------

{

LCD_brightness_ON(100); //PWM control

//-------- Initialize SPI for S65 diaplay.---------

DDRB |= (1 << PINB0); //rs

DDRB |= (1 << PINB1); //reset

DDRB |= (1 << PINB2); //cs

DDRB |= (1 << PINB3); //MOSI

DDRB &= ~(1 << PINB4); //MISO

DDRB |= (1 << PINB5); //SCK

SPCR=(1<<MSTR)|(1<<SPE);

SPSR=1;

//--------------------------------------------------

//----init--LCD------------------------------------------------------------

PORTB&=~(1<<RST); // Clear RST pin

_delay_ms(1);

PORTB|=(1<<RST); //Release Reset

_delay_ms(1);

ls020_wrcmd8(0xFD);

_delay_us(10);

ls020_wrcmd8(0xFD);

_delay_us(10);

ls020_wrcmd8(0xFD);

_delay_us(10);

ls020_wrcmd8(0xFD);

_delay_ms(68); // delay 68ms

for (int i=0;i<20;i++)

{

ls020_wrcmd8(pgm_read_byte(&init0[i]));

_delay_us(10);

}

_delay_ms(10);

for (int i=0;i<46;i++)

{

ls020_wrcmd8(pgm_read_byte(&init1[i]));

_delay_us(10);

}

//----init---end---------------------------------------------------------

_delay_ms(10);

//--------------------------------------------------

char text0[]= "Based on Juraś-Proj. 2011";

char text1[]= "8-BIT, BGR off, RE8=0x00:";

char text2[]= "8-BIT, BGR on, RE8=0x40:";

char text3[]= "8-COLOR mode, R04=0x01:";

char text4[]= "65K-COLOR mode, R04=0x00:";

char text5[]= "Scrolling image using R11";

char text6[]= "ADD.newFonts by Joyc";

while (1)//-----main program----------------------------------------------------------------

{

ls020_8bit_mode(0);

ls020_rectangle8(0,0,175,131,0x00);// Fill Screen with black color, same as clear screen

//---See Using_the_Siemens_S65_Display-1.pdf-----------------------------

ls020_wrcmd16(0x0504);// Set Direction X //for fill screen and rectangle

//ls020_wrcmd16(0x0500);// ?? Set Direction Y //for fill screen and rectangle

// ---- Blue bars

for (unsigned int i=0; i<968;i++)

{

for (char j=0; j<4;j++) {ls020_wrdata8(j);}

for (char j=0; j<4;j++) {ls020_wrdata8(3-j);}

}

// -----------Green bars

for (unsigned int i=0; i<484;i++)

{

for (char j=0; j<8;j++) {ls020_wrdata8(j<<2);}

for (char j=0; j<8;j++) {ls020_wrdata8((7-j)<<2);}

}

//---------- Red bars

for (unsigned int i=0; i<484;i++)

{

for (char j=0; j<8;j++) {ls020_wrdata8(j<<5);}

for (char j=0; j<8;j++) {ls020_wrdata8((7-j)<<5);}

}

ls020_put_string8(20,106,text6,CL8_WHITE,CL8_BLACK,1,1,1);

ls020_put_string8(20,84,text6,CL8_WHITE,CL8_BLACK,1,1,1);

ls020_put_string8(20,62,"Big FONT",CL8_WHITE,CL8_BLACK,1,1,2);//double transparent text

ls020_put_string8(20,24,"Big FONT",CL8_WHITE,CL8_BLACK,0,2,2);//double nontransparent text font2

ls020_put_string8(5,8,text6,CL8_GREEN,CL8_BLACK,1,2,1);

ls020_put_string8(20,120,text0,CL8_WHITE,CL8_BLACK,0,1,1);//White text with black background

_delay_ms(5000);

//-----------------fill screen-----------------------------------

ls020_8bit_mode(0);//// Set 8bit LCD host mode OK

//ls020_8_color_mode();

//ls020_65k_color_mode();

ls020_rectangle8(0,0,175,131,0x80);// Fill Screen with dark red color

ls020_put_string8(14,120,"DARK RED",CL8_BLACK,CL8_BLACK,1,1,1);

_delay_ms(3000);

ls020_rectangle8(0,0,175,131,CL8_RED);// Fill Screen with black color, same as clear screen

ls020_put_string8(14,20,"Small transp",CL8_BLACK,CL8_YELLOW,1,1,1);

ls020_put_string8_P(14,120,PSTR("RED RED RED RED"),CL8_WHITE,CL8_BLACK,0,1,1,0);//small TEXT from program memory

ls020_put_string8_P(5,80,PSTR("RED RED RED"),CL8_YELLOW,CL8_BLACK,1,1,2,0);//big TEXT from program memory

ls020_put_string8_P(130,20,PSTR("Red 23"),CL8_YELLOW,CL8_BLACK,1,2,2,1);//vertical big type 2

ls020_put_string8_P(155,20,PSTR("Red back."),CL8_YELLOW,CL8_BLACK,1,2,1,1);//vertical small type 2

 

ls020_put_string8(14,52,"Red RED",CL8_WHITE,CL8_BLACK,1,2,2);

_delay_ms(4000);

ls020_rectangle8(0,0,175,131,CL8_BLUE);// Fill Screen BLUE

ls020_put_string8(14,100,"BLUE",CL8_YELLOW,CL8_BLACK,1,2,2);

LCD_Circle(50, 50 ,10, CL8_GREEN);

LCD_Circle(100, 100 ,16, CL8_WHITE);

LCD_Circle(100, 100 ,20, CL8_RED);

LCD_Filled_Circle(15, 80 ,12, CL8_COLOR_RGB(163,0,163) ); // Kruh LCD_COLOR8_RGB(163,0,163) //fialova

ls020_put_string8_vertical(166,10,"BLUE",CL8_BLUE_LIGHT,CL8_RED_DARK,1,1,2);

LCD_line(10,65,128,125,CL8_BLACK);

_delay_ms(3000);

ls020_rectangle8(0,0,175,131,CL8_GREEN);// Fill Screen GREEN

ls020_put_string8(14,80,"Green big",CL8_BLACK,CL8_YELLOW,1,1,2);

ls020_put_string8_vertical(150,10,"Green big :-)",CL8_GREEN_DARK,CL8_RED_DARK,1,1,1);

ls020_put_string8_vertical(166,10,"Green",CL8_GREEN_DARK,CL8_RED_DARK,1,1,2);

char gBuffer[10];

for (int i=250;i<300;i++)

{

sprintf( gBuffer," %3i,%i ",i/10,i%10);

ls020_put_string8(4,20,gBuffer,CL8_BLACK,CL8_YELLOW,0,2,2);

_delay_ms(200);

}

_delay_ms(5000);

//lcd_deactivateScreen(0); //16 bit picture is loading a bit slower, that way we can use deactivation, to make it visually fast

ls020_rectangle8(0,0,175,131,CL8_BLACK);// Fill Screen Black

int rec_x=94;

int rec_y=70;

ls020_rectangle8(rec_x-2,rec_y-2,rec_x+50+1,rec_y+50+1,CL8_GREEN);//obramok //frame

//LCD_Filled_Cyrcle(45, 45 ,42, CL8_YELLOW );

#if USE_PICTURE == 1

LCD_load_picture16((prog_uint16_t*)&color_logo,rec_x,rec_y,50,50); // Image width: 50px, Height: 50px

ls020_put_string8_P(94,58,PSTR("Normálne"),CL8_WHITE,CL8_BLACK,1,1,1,0);//small TEXT from program memory

LCD_load_picture16_vertical((prog_uint16_t*)&color_logo,20,20,50,50); // Image width: 50px, Height: 50px

ls020_put_string8_P(72,20,PSTR("Vertikálne"),CL8_WHITE,CL8_BLACK,1,1,1,1);//small TEXT from program memory

#endif

//lcd_activateScreen();//must be used to show screen after deactivation

_delay_ms(10000);

ls020_rectangle8(0,0,175,131,CL8_YELLOW);// Fill Screen YELLOW

int k;

for (k=1;k<20;k++)//-----cyrcle boom efekt------------------

{

LCD_Circle(75, 40, k, CL8_BLUE); //kruznica

LCD_Circle(75, 40, k-1, CL8_YELLOW); //kruznica xor

_delay_ms(150);

}

LCD_Circle(75, 40, k-1, CL8_YELLOW); //kruznica xor

_delay_ms(2000);

ls020_rectangle8(0,0,175,131,CL8_PURPLE);// Fill Screen purple /fialova 163,0,163

ls020_put_char5x7(100,30,'A',CL8_BLACK,CL8_GRAY,0,1);

ls020_put_string8_P(14,120,PSTR("Font with d. aáäbcčdďĎ"),CL8_YELLOW,CL8_GREEN,1,1,1,0);//small TEXT1 from program memory

ls020_put_string8_P(14,102,PSTR("áäčšśďĎ2@"),CL8_YELLOW,CL8_RED_DARK,0,1,2,0);//big TEXT1 from program memory

//-----------slide bar plus minus----------------------------------------

for (int k=0;k<=80;k++)

{

LCD_slidebar_horizontal(10,10,20,80,k,CL8_GRAY ,CL8_PURPLE_DARK);

LCD_slidebar_vertical(10,25,30,80,k,CL8_YELLOW_DARK ,CL8_PURPLE_DARK);

_delay_ms(50);

}

for (int k=80;k>=0;k--)

{

LCD_slidebar_horizontal(10,10,20,80,k,CL8_GRAY ,CL8_PURPLE_DARK);

LCD_slidebar_vertical(10,25,30,80,k,CL8_YELLOW_DARK ,CL8_PURPLE_DARK);

_delay_ms(50);

}

//---END ----slide bar plus minus----------------------------------------

LCD_unfilled_Rectangle(10, 20, 30, 40, CL8_BLACK);//bod 1 xy, bod 2 xy //dolny lavy roh je 00

ls020_put_char8x14(12,30,'A',CL8_BLACK,CL8_GRAY,1,1);

ls020_put_char5x7_vertical(78,60,'R',CL8_BLACK,CL8_GRAY,0,2);

ls020_put_char8x14_vertical(100,80,'F',CL8_BLACK,CL8_GRAY,0,2);

ls020_put_char8x14_vertical(100,100,'a',CL8_BLACK,CL8_GRAY,1,2);

ls020_put_string8_vertical(150,10,"Vertical",CL8_WHITE,CL8_RED_DARK,0,1,2);//xy

_delay_ms(5000);

ls020_rectangle8(0,0,175,131,CL8_ORANGE);// Fill Screen orange red

ls020_put_string8_vertical(166,10,"ORANGE",CL8_RED_DARK,CL8_RED_DARK,1,1,2);

_delay_ms(1000);

ls020_rectangle8(0,0,175,131,CL8_COLOR_RGB(199,21,133));// violet Fill Screen

ls020_put_string8_vertical(166,10,"PURPLE",CL8_RED_DARK,CL8_RED_DARK,1,1,2);

_delay_ms(1000);

ls020_rectangle8(0,0,175,131,CL8_PURPLE_DARK);// Fill Screen

ls020_put_string8_vertical(166,10,"PURPLE DARK",CL8_RED_DARK,CL8_RED_DARK,1,1,2);

_delay_ms(1000);

ls020_rectangle8(0,0,175,131,CL8_TEAL);// Fill Screen

ls020_put_string8_vertical(166,10,"TEAL",CL8_RED_DARK,CL8_RED_DARK,1,1,2);

_delay_ms(1000);

ls020_rectangle8(0,0,175,131,CL8_BROWN);// Fill Screen

ls020_put_string8_vertical(166,10,"BROWN",CL8_RED_DARK,CL8_RED_DARK,1,1,2);

_delay_ms(1000);

ls020_rectangle8(0,0,175,131,CL8_BLUE_LIGHT);// Fill Screen

ls020_put_string8_vertical(166,10,"BLUE_LIGHT",CL8_RED_DARK,CL8_RED_DARK,1,1,2);

_delay_ms(1000);

ls020_rectangle8(0,0,175,131,CL8_BLACK);// Fill Screen with black color, same as clear screen

ls020_8bit_mode(0); // OK

ls020_put_string8(14,120,text1,0xFF,0x00,0,1,1);//8-BIT, BGR off, RE8=0x00:

draw_table();

_delay_ms(5000);

ls020_8bit_mode(1);//

ls020_put_string8(14,120,text2,0xFF,0x00,0,1,1);//8-BIT, BGR on, RE8=0x40:

draw_table();

_delay_ms(5000);

ls020_put_string8(14,120,text3,0xFF,0x00,0,1,1); //8-COLOR mode, R04=0x01:

ls020_8_color_mode();

draw_table();

_delay_ms(5000);

ls020_put_string8(14,120,text4,0xFF,0x00,0,1,1); //65K-COLOR mode, R04=0x00:

ls020_65k_color_mode();

draw_table();

_delay_ms(5000);

ls020_put_string8(14,120,text5,0xFF,0x00,0,1,1); //scroll

_delay_ms(3000);

for (char i=0; i<176; i++)

{

ls020_scroll(i);

_delay_ms(10);;

}

_delay_ms(3000);

//invert color

ls020_put_string8(14,120,"inverted color ",0xFF,0x00,0,1,1); //scroll

lcd_setInversionMode(1);

_delay_ms(3000);

lcd_setInversionMode(0);

lcd_deactivateScreen(0); //16 bit picture is loading a bit slower, that way we can use deactivation, to make it visually fast

//write something to LCD and use: lcd_activateScreen();

_delay_ms(3000);

lcd_activateScreen();

lcd_deactivateScreen(1);//deactivation with white screen

_delay_ms(3000);

lcd_activateScreen();

}//while---------

return(0);

}