Various projects using Raspberry Pi
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
19 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. -- raspilcd, a simple tool to display bmp pictures & text on a ST7565 LCD
  2. -- Copyright (C) 2014 Torsten Meissner
  3. --
  4. -- This program is free software: you can redistribute it and/or modify
  5. -- it under the terms of the GNU General Public License as published by
  6. -- the Free Software Foundation, either version 3 of the License, or
  7. -- (at your option) any later version.
  8. --
  9. -- This program is distributed in the hope that it will be useful,
  10. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. -- GNU General Public License for more details.
  13. --
  14. -- You should have received a copy of the GNU General Public License
  15. -- along with this program. If not, see http://www.gnu.org/licenses/.
  16. with Interfaces;
  17. with Interfaces.C;
  18. package st7565lcd is
  19. -- type definitions
  20. subtype byte is Interfaces.Unsigned_8;
  21. subtype word is Interfaces.Unsigned_16;
  22. subtype dword is Interfaces.Unsigned_32;
  23. type t_byte_array is array (natural range <>) of byte;
  24. type t_font_array is array (natural range <>) of t_byte_array (0 .. 4);
  25. type t_bmp_array is array (natural range <>) of t_byte_array (0 .. 3);
  26. subtype t_lcd_array is t_byte_array (0 .. 128 * 8 - 1);
  27. -- bmp header structure
  28. type t_bmp_header is record
  29. bfType : word;
  30. bfSize : dword;
  31. bfReserved : dword;
  32. bfOffBits : dword;
  33. biSize : dword;
  34. biWidth : integer;
  35. biHeight : integer;
  36. biPlanes : word;
  37. biBitCount : word;
  38. biCompression : dword;
  39. biSizeImage : dword;
  40. biXPelsPerMeter : integer;
  41. biYPelsPerMeter : integer;
  42. biClrUsed : dword;
  43. biClrImportant : dword;
  44. end record;
  45. -- color mask
  46. type t_color_mask is record
  47. red : dword := 16#00FF0000#;
  48. green : dword := 16#0000FF00#;
  49. blue : dword := 16#000000FF#;
  50. alpha : dword := 16#FF000000#;
  51. end record;
  52. -- character set
  53. font_5x7 : constant t_font_array (32 .. 126) := (
  54. ( 16#00#, 16#00#, 16#00#, 16#00#, 16#00# ), -- - 16#20 - 32
  55. ( 16#00#, 16#00#, 16#5f#, 16#00#, 16#00# ), -- ! - 16#21 - 33
  56. ( 16#00#, 16#07#, 16#00#, 16#07#, 16#00# ), -- " - 16#22 - 34
  57. ( 16#14#, 16#7f#, 16#14#, 16#7f#, 16#14# ), -- # - 16#23 - 35
  58. ( 16#24#, 16#2a#, 16#7f#, 16#2a#, 16#12# ), -- $ - 16#24 - 36
  59. ( 16#23#, 16#13#, 16#08#, 16#64#, 16#62# ), -- % - 16#25 - 37
  60. ( 16#36#, 16#49#, 16#55#, 16#22#, 16#50# ), -- & - 16#26 - 38
  61. ( 16#00#, 16#05#, 16#03#, 16#00#, 16#00# ), -- ' - 16#27 - 39
  62. ( 16#00#, 16#1c#, 16#22#, 16#41#, 16#00# ), -- ( - 16#28 - 40
  63. ( 16#00#, 16#41#, 16#22#, 16#1c#, 16#00# ), -- ) - 16#29 - 41
  64. ( 16#14#, 16#08#, 16#3e#, 16#08#, 16#14# ), -- * - 16#2a - 42
  65. ( 16#08#, 16#08#, 16#3e#, 16#08#, 16#08# ), -- + - 16#2b - 43
  66. ( 16#00#, 16#50#, 16#30#, 16#00#, 16#00# ), -- , - 16#2c - 44
  67. ( 16#08#, 16#08#, 16#08#, 16#08#, 16#08# ), -- - - 16#2d - 45
  68. ( 16#00#, 16#60#, 16#60#, 16#00#, 16#00# ), -- . - 16#2e - 46
  69. ( 16#20#, 16#10#, 16#08#, 16#04#, 16#02# ), -- / - 16#2f - 47
  70. ( 16#3e#, 16#51#, 16#49#, 16#45#, 16#3e# ), -- 0 - 16#30 - 48
  71. ( 16#00#, 16#42#, 16#7f#, 16#40#, 16#00# ), -- 1 - 16#31 - 49
  72. ( 16#42#, 16#61#, 16#51#, 16#49#, 16#46# ), -- 2 - 16#32 - 50
  73. ( 16#21#, 16#41#, 16#45#, 16#4b#, 16#31# ), -- 3 - 16#33 - 51
  74. ( 16#18#, 16#14#, 16#12#, 16#7f#, 16#10# ), -- 4 - 16#34 - 52
  75. ( 16#27#, 16#45#, 16#45#, 16#45#, 16#39# ), -- 5 - 16#35 - 53
  76. ( 16#3c#, 16#4a#, 16#49#, 16#49#, 16#30# ), -- 6 - 16#36 - 54
  77. ( 16#01#, 16#71#, 16#09#, 16#05#, 16#03# ), -- 7 - 16#37 - 55
  78. ( 16#36#, 16#49#, 16#49#, 16#49#, 16#36# ), -- 8 - 16#38 - 56
  79. ( 16#06#, 16#49#, 16#49#, 16#29#, 16#1e# ), -- 9 - 16#39 - 57
  80. ( 16#00#, 16#36#, 16#36#, 16#00#, 16#00# ), -- : - 16#3a - 58
  81. ( 16#00#, 16#56#, 16#36#, 16#00#, 16#00# ), -- ; - 16#3b - 59
  82. ( 16#08#, 16#14#, 16#22#, 16#41#, 16#00# ), -- < - 16#3c - 60
  83. ( 16#14#, 16#14#, 16#14#, 16#14#, 16#14# ), -- = - 16#3d - 61
  84. ( 16#00#, 16#41#, 16#22#, 16#14#, 16#08# ), -- > - 16#3e - 62
  85. ( 16#02#, 16#01#, 16#51#, 16#09#, 16#06# ), -- ? - 16#3f - 63
  86. ( 16#32#, 16#49#, 16#79#, 16#41#, 16#3e# ), -- @ - 16#40 - 64
  87. ( 16#7e#, 16#11#, 16#11#, 16#11#, 16#7e# ), -- A - 16#41 - 65
  88. ( 16#7f#, 16#49#, 16#49#, 16#49#, 16#36# ), -- B - 16#42 - 66
  89. ( 16#3e#, 16#41#, 16#41#, 16#41#, 16#22# ), -- C - 16#43 - 67
  90. ( 16#7f#, 16#41#, 16#41#, 16#22#, 16#1c# ), -- D - 16#44 - 68
  91. ( 16#7f#, 16#49#, 16#49#, 16#49#, 16#41# ), -- E - 16#45 - 69
  92. ( 16#7f#, 16#09#, 16#09#, 16#09#, 16#01# ), -- F - 16#46 - 70
  93. ( 16#3e#, 16#41#, 16#49#, 16#49#, 16#7a# ), -- G - 16#47 - 71
  94. ( 16#7f#, 16#08#, 16#08#, 16#08#, 16#7f# ), -- H - 16#48 - 72
  95. ( 16#00#, 16#41#, 16#7f#, 16#41#, 16#00# ), -- I - 16#49 - 73
  96. ( 16#20#, 16#40#, 16#41#, 16#3f#, 16#01# ), -- J - 16#4a - 74
  97. ( 16#7f#, 16#08#, 16#14#, 16#22#, 16#41# ), -- K - 16#4b - 75
  98. ( 16#7f#, 16#40#, 16#40#, 16#40#, 16#40# ), -- L - 16#4c - 76
  99. ( 16#7f#, 16#02#, 16#0c#, 16#02#, 16#7f# ), -- M - 16#4d - 77
  100. ( 16#7f#, 16#04#, 16#08#, 16#10#, 16#7f# ), -- N - 16#4e - 78
  101. ( 16#3e#, 16#41#, 16#41#, 16#41#, 16#3e# ), -- O - 16#4f - 79
  102. ( 16#7f#, 16#09#, 16#09#, 16#09#, 16#06# ), -- P - 16#50 - 80
  103. ( 16#3e#, 16#41#, 16#51#, 16#21#, 16#5e# ), -- Q - 16#51 - 81
  104. ( 16#7f#, 16#09#, 16#19#, 16#29#, 16#46# ), -- R - 16#52 - 82
  105. ( 16#46#, 16#49#, 16#49#, 16#49#, 16#31# ), -- S - 16#53 - 83
  106. ( 16#01#, 16#01#, 16#7f#, 16#01#, 16#01# ), -- T - 16#54 - 84
  107. ( 16#3f#, 16#40#, 16#40#, 16#40#, 16#3f# ), -- U - 16#55 - 85
  108. ( 16#1f#, 16#20#, 16#40#, 16#20#, 16#1f# ), -- V - 16#56 - 86
  109. ( 16#3f#, 16#40#, 16#38#, 16#40#, 16#3f# ), -- W - 16#57 - 87
  110. ( 16#63#, 16#14#, 16#08#, 16#14#, 16#63# ), -- X - 16#58 - 88
  111. ( 16#07#, 16#08#, 16#70#, 16#08#, 16#07# ), -- Y - 16#59 - 89
  112. ( 16#61#, 16#51#, 16#49#, 16#45#, 16#43# ), -- Z - 16#5a - 90
  113. ( 16#00#, 16#7f#, 16#41#, 16#41#, 16#00# ), -- [ - 16#5b - 91
  114. ( 16#02#, 16#04#, 16#08#, 16#10#, 16#20# ), -- \ - 16#5c - 92
  115. ( 16#00#, 16#41#, 16#41#, 16#7f#, 16#00# ), -- ] - 16#5d - 93
  116. ( 16#04#, 16#02#, 16#01#, 16#02#, 16#04# ), -- ^ - 16#5e - 94
  117. ( 16#40#, 16#40#, 16#40#, 16#40#, 16#40# ), -- _ - 16#5f - 95
  118. ( 16#00#, 16#01#, 16#02#, 16#04#, 16#00# ), -- ` - 16#60 - 96
  119. ( 16#20#, 16#54#, 16#54#, 16#54#, 16#78# ), -- a - 16#61 - 97
  120. ( 16#7f#, 16#48#, 16#44#, 16#44#, 16#38# ), -- b - 16#62 - 98
  121. ( 16#38#, 16#44#, 16#44#, 16#44#, 16#20# ), -- c - 16#63 - 99
  122. ( 16#38#, 16#44#, 16#44#, 16#48#, 16#7f# ), -- d - 16#64 - 100
  123. ( 16#38#, 16#54#, 16#54#, 16#54#, 16#18# ), -- e - 16#65 - 101
  124. ( 16#08#, 16#7e#, 16#09#, 16#01#, 16#02# ), -- f - 16#66 - 102
  125. ( 16#38#, 16#44#, 16#44#, 16#54#, 16#34# ), -- g - 16#67 - 103
  126. ( 16#7f#, 16#08#, 16#04#, 16#04#, 16#78# ), -- h - 16#68 - 104
  127. ( 16#00#, 16#44#, 16#7d#, 16#40#, 16#00# ), -- i - 16#69 - 105
  128. ( 16#20#, 16#40#, 16#44#, 16#3d#, 16#00# ), -- j - 16#6a - 106
  129. ( 16#7f#, 16#10#, 16#28#, 16#44#, 16#00# ), -- k - 16#6b - 107
  130. ( 16#00#, 16#41#, 16#7f#, 16#40#, 16#00# ), -- l - 16#6c - 108
  131. ( 16#7c#, 16#04#, 16#18#, 16#04#, 16#78# ), -- m - 16#6d - 109
  132. ( 16#7c#, 16#08#, 16#04#, 16#04#, 16#78# ), -- n - 16#6e - 110
  133. ( 16#38#, 16#44#, 16#44#, 16#44#, 16#38# ), -- o - 16#6f - 111
  134. ( 16#7c#, 16#14#, 16#14#, 16#14#, 16#08# ), -- p - 16#70 - 112
  135. ( 16#08#, 16#14#, 16#14#, 16#18#, 16#7c# ), -- q - 16#71 - 113
  136. ( 16#7c#, 16#08#, 16#04#, 16#04#, 16#08# ), -- r - 16#72 - 114
  137. ( 16#48#, 16#54#, 16#54#, 16#54#, 16#20# ), -- s - 16#73 - 115
  138. ( 16#04#, 16#3f#, 16#44#, 16#40#, 16#20# ), -- t - 16#74 - 116
  139. ( 16#3c#, 16#40#, 16#40#, 16#20#, 16#7c# ), -- u - 16#75 - 117
  140. ( 16#1c#, 16#20#, 16#40#, 16#20#, 16#1c# ), -- v - 16#76 - 118
  141. ( 16#3c#, 16#40#, 16#30#, 16#40#, 16#3c# ), -- w - 16#77 - 119
  142. ( 16#44#, 16#28#, 16#10#, 16#28#, 16#44# ), -- x - 16#78 - 120
  143. ( 16#0c#, 16#50#, 16#50#, 16#50#, 16#3c# ), -- y - 16#79 - 121
  144. ( 16#44#, 16#64#, 16#54#, 16#4c#, 16#44# ), -- z - 16#7a - 122
  145. ( 16#00#, 16#08#, 16#36#, 16#41#, 16#00# ), -- { - 16#7b - 123
  146. ( 16#00#, 16#00#, 16#7f#, 16#00#, 16#00# ), -- | - 16#7c - 124
  147. ( 16#00#, 16#41#, 16#36#, 16#08#, 16#00# ), -- } - 16#7d - 125
  148. ( 16#10#, 16#08#, 16#08#, 16#10#, 16#08# ) -- ~ - 16#7e - 126
  149. );
  150. -- raspberry picture
  151. raspberry : constant t_lcd_array := (
  152. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 1. row
  153. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 1. row
  154. 16#00#,16#00#,16#00#,16#00#,16#F0#,16#F8#,16#58#,16#1C#,16#1C#,16#0C#,16#0C#,16#06#,16#86#,16#86#,16#86#,16#0E#, -- 1. row
  155. 16#0E#,16#06#,16#0E#,16#1E#,16#1C#,16#1C#,16#0C#,16#3C#,16#38#,16#78#,16#F0#,16#E0#,16#C0#,16#C0#,16#E0#,16#70#, -- 1. row
  156. 16#38#,16#18#,16#1C#,16#1C#,16#0C#,16#0E#,16#0E#,16#0E#,16#0E#,16#0E#,16#0E#,16#86#,16#86#,16#06#,16#04#,16#0C#, -- 1. row
  157. 16#0C#,16#18#,16#F8#,16#F8#,16#F8#,16#F0#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 1. row
  158. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 1. row
  159. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 1. row
  160. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 2. row
  161. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 2. row
  162. 16#00#,16#00#,16#00#,16#00#,16#03#,16#0F#,16#3F#,16#7C#,16#F0#,16#C0#,16#C0#,16#C0#,16#C0#,16#00#,16#01#,16#01#, -- 2. row
  163. 16#03#,16#02#,16#06#,16#04#,16#04#,16#1C#,16#B8#,16#F0#,16#E0#,16#70#,16#30#,16#1F#,16#0F#,16#0F#,16#3F#,16#30#, -- 2. row
  164. 16#F0#,16#E0#,16#B0#,16#18#,16#08#,16#0C#,16#04#,16#06#,16#02#,16#01#,16#01#,16#00#,16#00#,16#00#,16#00#,16#C0#, -- 2. row
  165. 16#F0#,16#F8#,16#7F#,16#1F#,16#07#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 2. row
  166. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 2. row
  167. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 2. row
  168. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 3. row
  169. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 3. row
  170. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#80#,16#E0#,16#F3#,16#33#,16#3F#,16#1F#,16#1E#,16#0E#,16#0E#, -- 3. row
  171. 16#0C#,16#0C#,16#EC#,16#EC#,16#EE#,16#BE#,16#0F#,16#0F#,16#07#,16#06#,16#02#,16#02#,16#02#,16#02#,16#02#,16#06#, -- 3. row
  172. 16#06#,16#0F#,16#0F#,16#BE#,16#EE#,16#CC#,16#8C#,16#0C#,16#0C#,16#0C#,16#0E#,16#1E#,16#1E#,16#3F#,16#73#,16#E1#, -- 3. row
  173. 16#C1#,16#00#,16#36#,16#25#,16#55#,16#5D#,16#49#,16#6D#,16#32#,16#0C#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 3. row
  174. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 3. row
  175. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 3. row
  176. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 4. row
  177. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 4. row
  178. 16#00#,16#00#,16#00#,16#80#,16#C0#,16#E0#,16#70#,16#7F#,16#7F#,16#3F#,16#FC#,16#FC#,16#FC#,16#3C#,16#1C#,16#0E#, -- 4. row
  179. 16#07#,16#07#,16#03#,16#03#,16#03#,16#03#,16#03#,16#02#,16#06#,16#0E#,16#1C#,16#FC#,16#FC#,16#FC#,16#3C#,16#0E#, -- 4. row
  180. 16#06#,16#02#,16#03#,16#03#,16#03#,16#03#,16#03#,16#03#,16#07#,16#06#,16#0C#,16#18#,16#78#,16#F0#,16#F0#,16#33#, -- 4. row
  181. 16#7F#,16#7F#,16#70#,16#F0#,16#C0#,16#80#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 4. row
  182. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 4. row
  183. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 4. row
  184. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 5. row
  185. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 5. row
  186. 16#00#,16#00#,16#FF#,16#FF#,16#83#,16#00#,16#00#,16#00#,16#00#,16#C0#,16#FF#,16#FF#,16#F0#,16#F0#,16#F0#,16#80#, -- 5. row
  187. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#80#,16#80#,16#C0#,16#60#,16#78#,16#7F#,16#7F#,16#7F#,16#7C#,16#70#, -- 5. row
  188. 16#E0#,16#C0#,16#80#,16#80#,16#00#,16#00#,16#00#,16#00#,16#00#,16#80#,16#80#,16#C0#,16#E0#,16#FF#,16#FF#,16#C0#, -- 5. row
  189. 16#00#,16#00#,16#00#,16#00#,16#C3#,16#FF#,16#FE#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 5. row
  190. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 5. row
  191. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 5. row
  192. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 6. row
  193. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 6. row
  194. 16#00#,16#00#,16#00#,16#03#,16#0F#,16#3E#,16#FC#,16#FC#,16#0E#,16#03#,16#03#,16#03#,16#03#,16#07#,16#07#,16#0F#, -- 6. row
  195. 16#1F#,16#3F#,16#7F#,16#FF#,16#FF#,16#07#,16#01#,16#01#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 6. row
  196. 16#00#,16#00#,16#01#,16#03#,16#FF#,16#FF#,16#7F#,16#1F#,16#0F#,16#07#,16#07#,16#03#,16#01#,16#01#,16#01#,16#01#, -- 6. row
  197. 16#03#,16#FE#,16#FE#,16#7E#,16#07#,16#03#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 6. row
  198. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 6. row
  199. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 6. row
  200. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 7. row
  201. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 7. row
  202. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#01#,16#07#,16#1F#,16#3C#,16#78#,16#70#,16#E0#,16#E0#,16#E0#,16#C0#, -- 7. row
  203. 16#C0#,16#C0#,16#C0#,16#E1#,16#FF#,16#7F#,16#7F#,16#3C#,16#3C#,16#3C#,16#38#,16#30#,16#30#,16#30#,16#30#,16#38#, -- 7. row
  204. 16#38#,16#3C#,16#3C#,16#7F#,16#FF#,16#E1#,16#C0#,16#C0#,16#C0#,16#C0#,16#C0#,16#E0#,16#60#,16#70#,16#38#,16#38#, -- 7. row
  205. 16#1E#,16#0F#,16#03#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 7. row
  206. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 7. row
  207. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 7. row
  208. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 8. row
  209. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 8. row
  210. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#01#,16#01#, -- 8. row
  211. 16#01#,16#03#,16#03#,16#07#,16#07#,16#0E#,16#18#,16#18#,16#38#,16#30#,16#30#,16#30#,16#30#,16#30#,16#30#,16#30#, -- 8. row
  212. 16#38#,16#18#,16#1C#,16#1E#,16#0F#,16#07#,16#03#,16#03#,16#01#,16#01#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 8. row
  213. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 8. row
  214. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#, -- 8. row
  215. 16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00#,16#00# -- 8. row
  216. );
  217. -- lcd init values
  218. lcd_init_data : constant t_byte_array := (
  219. 16#a0#, -- cmd8: adc select
  220. 16#c0#, -- cmd15: shl select
  221. 16#a3#, -- cmd11: lcd bias set
  222. 16#2c#, -- cmd16: power control set (vc=1, vr=0, vf=0)
  223. 16#2e#, -- cmd16: power control set (vc=1, vr=1, vf=0)
  224. 16#2f#, -- cmd16: power control set (vc=1, vr=1, vf=1)
  225. 16#26#, -- cmd17: regulator resistor select
  226. 16#60#, -- cmd2: display start line
  227. 16#a6#, -- cmd6: display normal
  228. 16#c8#, -- cmd15: common output mode select (reversed)
  229. 16#af#, -- cmd1: display on
  230. 16#a4#, -- cmd10: all points off
  231. 16#81#, -- cmd18: set volume 1st
  232. 16#18# -- cmd18: set volume 2nd (brightness)
  233. );
  234. -- pin definitions
  235. LCD_CS : constant Interfaces.C.unsigned_char := 24;
  236. LCD_RST : constant Interfaces.C.unsigned_char := 23;
  237. LCD_A0 : constant Interfaces.C.unsigned_char := 22;
  238. LCD_CLK : constant Interfaces.C.unsigned_char := 27;
  239. LCD_SI : constant Interfaces.C.unsigned_char := 17;
  240. -- procedures declarations
  241. procedure io_init;
  242. procedure lcd_init;
  243. procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string);
  244. procedure lcd_ascii57 (xpos : natural; ypos : natural; data : character);
  245. procedure lcd_picture (xpos : natural; ypos: natural; picture : t_lcd_array);
  246. procedure lcd_clear;
  247. procedure lcd_set_page (page : natural; column : natural);
  248. procedure lcd_transfer_data (value : byte; si : boolean);
  249. procedure lcd_byte (data : byte);
  250. function bmp_to_lcd (bmp : t_bmp_array; color_mask : t_color_mask) return t_lcd_array;
  251. function which_byte (data : dword) return integer;
  252. end st7565lcd;