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.

300 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
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. with Ada.Streams.Stream_IO;
  19. package st7565lcd is
  20. -- type definitions
  21. subtype byte is Interfaces.Unsigned_8;
  22. subtype word is Interfaces.Unsigned_16;
  23. subtype dword is Interfaces.Unsigned_32;
  24. type t_byte_array is array (natural range <>) of byte;
  25. type t_font_array is array (natural range <>) of t_byte_array (0 .. 4);
  26. type t_bmp_array is array (0 .. 128 * 64 - 1) of t_byte_array (0 .. 3);
  27. subtype t_lcd_array is t_byte_array (0 .. 128 * 8 - 1);
  28. -- bmp header structure
  29. type t_bmp_header is record
  30. bfType : word;
  31. bfSize : dword;
  32. bfReserved : dword;
  33. bfOffBits : dword;
  34. biSize : dword;
  35. biWidth : integer;
  36. biHeight : integer;
  37. biPlanes : word;
  38. biBitCount : word;
  39. biCompression : dword;
  40. biSizeImage : dword;
  41. biXPelsPerMeter : integer;
  42. biYPelsPerMeter : integer;
  43. biClrUsed : dword;
  44. biClrImportant : dword;
  45. end record;
  46. -- color mask
  47. type t_color_mask is record
  48. red : dword := 16#00FF0000#;
  49. green : dword := 16#0000FF00#;
  50. blue : dword := 16#000000FF#;
  51. alpha : dword := 16#FF000000#;
  52. end record;
  53. -- bmp record
  54. type t_bmp_picture is record
  55. header : t_bmp_header;
  56. mask : t_color_mask;
  57. data : t_bmp_array;
  58. end record;
  59. -- character set
  60. font_5x7 : constant t_font_array (32 .. 126) := (
  61. ( 16#00#, 16#00#, 16#00#, 16#00#, 16#00# ), -- - 16#20 - 32
  62. ( 16#00#, 16#00#, 16#5f#, 16#00#, 16#00# ), -- ! - 16#21 - 33
  63. ( 16#00#, 16#07#, 16#00#, 16#07#, 16#00# ), -- " - 16#22 - 34
  64. ( 16#14#, 16#7f#, 16#14#, 16#7f#, 16#14# ), -- # - 16#23 - 35
  65. ( 16#24#, 16#2a#, 16#7f#, 16#2a#, 16#12# ), -- $ - 16#24 - 36
  66. ( 16#23#, 16#13#, 16#08#, 16#64#, 16#62# ), -- % - 16#25 - 37
  67. ( 16#36#, 16#49#, 16#55#, 16#22#, 16#50# ), -- & - 16#26 - 38
  68. ( 16#00#, 16#05#, 16#03#, 16#00#, 16#00# ), -- ' - 16#27 - 39
  69. ( 16#00#, 16#1c#, 16#22#, 16#41#, 16#00# ), -- ( - 16#28 - 40
  70. ( 16#00#, 16#41#, 16#22#, 16#1c#, 16#00# ), -- ) - 16#29 - 41
  71. ( 16#14#, 16#08#, 16#3e#, 16#08#, 16#14# ), -- * - 16#2a - 42
  72. ( 16#08#, 16#08#, 16#3e#, 16#08#, 16#08# ), -- + - 16#2b - 43
  73. ( 16#00#, 16#50#, 16#30#, 16#00#, 16#00# ), -- , - 16#2c - 44
  74. ( 16#08#, 16#08#, 16#08#, 16#08#, 16#08# ), -- - - 16#2d - 45
  75. ( 16#00#, 16#60#, 16#60#, 16#00#, 16#00# ), -- . - 16#2e - 46
  76. ( 16#20#, 16#10#, 16#08#, 16#04#, 16#02# ), -- / - 16#2f - 47
  77. ( 16#3e#, 16#51#, 16#49#, 16#45#, 16#3e# ), -- 0 - 16#30 - 48
  78. ( 16#00#, 16#42#, 16#7f#, 16#40#, 16#00# ), -- 1 - 16#31 - 49
  79. ( 16#42#, 16#61#, 16#51#, 16#49#, 16#46# ), -- 2 - 16#32 - 50
  80. ( 16#21#, 16#41#, 16#45#, 16#4b#, 16#31# ), -- 3 - 16#33 - 51
  81. ( 16#18#, 16#14#, 16#12#, 16#7f#, 16#10# ), -- 4 - 16#34 - 52
  82. ( 16#27#, 16#45#, 16#45#, 16#45#, 16#39# ), -- 5 - 16#35 - 53
  83. ( 16#3c#, 16#4a#, 16#49#, 16#49#, 16#30# ), -- 6 - 16#36 - 54
  84. ( 16#01#, 16#71#, 16#09#, 16#05#, 16#03# ), -- 7 - 16#37 - 55
  85. ( 16#36#, 16#49#, 16#49#, 16#49#, 16#36# ), -- 8 - 16#38 - 56
  86. ( 16#06#, 16#49#, 16#49#, 16#29#, 16#1e# ), -- 9 - 16#39 - 57
  87. ( 16#00#, 16#36#, 16#36#, 16#00#, 16#00# ), -- : - 16#3a - 58
  88. ( 16#00#, 16#56#, 16#36#, 16#00#, 16#00# ), -- ; - 16#3b - 59
  89. ( 16#08#, 16#14#, 16#22#, 16#41#, 16#00# ), -- < - 16#3c - 60
  90. ( 16#14#, 16#14#, 16#14#, 16#14#, 16#14# ), -- = - 16#3d - 61
  91. ( 16#00#, 16#41#, 16#22#, 16#14#, 16#08# ), -- > - 16#3e - 62
  92. ( 16#02#, 16#01#, 16#51#, 16#09#, 16#06# ), -- ? - 16#3f - 63
  93. ( 16#32#, 16#49#, 16#79#, 16#41#, 16#3e# ), -- @ - 16#40 - 64
  94. ( 16#7e#, 16#11#, 16#11#, 16#11#, 16#7e# ), -- A - 16#41 - 65
  95. ( 16#7f#, 16#49#, 16#49#, 16#49#, 16#36# ), -- B - 16#42 - 66
  96. ( 16#3e#, 16#41#, 16#41#, 16#41#, 16#22# ), -- C - 16#43 - 67
  97. ( 16#7f#, 16#41#, 16#41#, 16#22#, 16#1c# ), -- D - 16#44 - 68
  98. ( 16#7f#, 16#49#, 16#49#, 16#49#, 16#41# ), -- E - 16#45 - 69
  99. ( 16#7f#, 16#09#, 16#09#, 16#09#, 16#01# ), -- F - 16#46 - 70
  100. ( 16#3e#, 16#41#, 16#49#, 16#49#, 16#7a# ), -- G - 16#47 - 71
  101. ( 16#7f#, 16#08#, 16#08#, 16#08#, 16#7f# ), -- H - 16#48 - 72
  102. ( 16#00#, 16#41#, 16#7f#, 16#41#, 16#00# ), -- I - 16#49 - 73
  103. ( 16#20#, 16#40#, 16#41#, 16#3f#, 16#01# ), -- J - 16#4a - 74
  104. ( 16#7f#, 16#08#, 16#14#, 16#22#, 16#41# ), -- K - 16#4b - 75
  105. ( 16#7f#, 16#40#, 16#40#, 16#40#, 16#40# ), -- L - 16#4c - 76
  106. ( 16#7f#, 16#02#, 16#0c#, 16#02#, 16#7f# ), -- M - 16#4d - 77
  107. ( 16#7f#, 16#04#, 16#08#, 16#10#, 16#7f# ), -- N - 16#4e - 78
  108. ( 16#3e#, 16#41#, 16#41#, 16#41#, 16#3e# ), -- O - 16#4f - 79
  109. ( 16#7f#, 16#09#, 16#09#, 16#09#, 16#06# ), -- P - 16#50 - 80
  110. ( 16#3e#, 16#41#, 16#51#, 16#21#, 16#5e# ), -- Q - 16#51 - 81
  111. ( 16#7f#, 16#09#, 16#19#, 16#29#, 16#46# ), -- R - 16#52 - 82
  112. ( 16#46#, 16#49#, 16#49#, 16#49#, 16#31# ), -- S - 16#53 - 83
  113. ( 16#01#, 16#01#, 16#7f#, 16#01#, 16#01# ), -- T - 16#54 - 84
  114. ( 16#3f#, 16#40#, 16#40#, 16#40#, 16#3f# ), -- U - 16#55 - 85
  115. ( 16#1f#, 16#20#, 16#40#, 16#20#, 16#1f# ), -- V - 16#56 - 86
  116. ( 16#3f#, 16#40#, 16#38#, 16#40#, 16#3f# ), -- W - 16#57 - 87
  117. ( 16#63#, 16#14#, 16#08#, 16#14#, 16#63# ), -- X - 16#58 - 88
  118. ( 16#07#, 16#08#, 16#70#, 16#08#, 16#07# ), -- Y - 16#59 - 89
  119. ( 16#61#, 16#51#, 16#49#, 16#45#, 16#43# ), -- Z - 16#5a - 90
  120. ( 16#00#, 16#7f#, 16#41#, 16#41#, 16#00# ), -- [ - 16#5b - 91
  121. ( 16#02#, 16#04#, 16#08#, 16#10#, 16#20# ), -- \ - 16#5c - 92
  122. ( 16#00#, 16#41#, 16#41#, 16#7f#, 16#00# ), -- ] - 16#5d - 93
  123. ( 16#04#, 16#02#, 16#01#, 16#02#, 16#04# ), -- ^ - 16#5e - 94
  124. ( 16#40#, 16#40#, 16#40#, 16#40#, 16#40# ), -- _ - 16#5f - 95
  125. ( 16#00#, 16#01#, 16#02#, 16#04#, 16#00# ), -- ` - 16#60 - 96
  126. ( 16#20#, 16#54#, 16#54#, 16#54#, 16#78# ), -- a - 16#61 - 97
  127. ( 16#7f#, 16#48#, 16#44#, 16#44#, 16#38# ), -- b - 16#62 - 98
  128. ( 16#38#, 16#44#, 16#44#, 16#44#, 16#20# ), -- c - 16#63 - 99
  129. ( 16#38#, 16#44#, 16#44#, 16#48#, 16#7f# ), -- d - 16#64 - 100
  130. ( 16#38#, 16#54#, 16#54#, 16#54#, 16#18# ), -- e - 16#65 - 101
  131. ( 16#08#, 16#7e#, 16#09#, 16#01#, 16#02# ), -- f - 16#66 - 102
  132. ( 16#38#, 16#44#, 16#44#, 16#54#, 16#34# ), -- g - 16#67 - 103
  133. ( 16#7f#, 16#08#, 16#04#, 16#04#, 16#78# ), -- h - 16#68 - 104
  134. ( 16#00#, 16#44#, 16#7d#, 16#40#, 16#00# ), -- i - 16#69 - 105
  135. ( 16#20#, 16#40#, 16#44#, 16#3d#, 16#00# ), -- j - 16#6a - 106
  136. ( 16#7f#, 16#10#, 16#28#, 16#44#, 16#00# ), -- k - 16#6b - 107
  137. ( 16#00#, 16#41#, 16#7f#, 16#40#, 16#00# ), -- l - 16#6c - 108
  138. ( 16#7c#, 16#04#, 16#18#, 16#04#, 16#78# ), -- m - 16#6d - 109
  139. ( 16#7c#, 16#08#, 16#04#, 16#04#, 16#78# ), -- n - 16#6e - 110
  140. ( 16#38#, 16#44#, 16#44#, 16#44#, 16#38# ), -- o - 16#6f - 111
  141. ( 16#7c#, 16#14#, 16#14#, 16#14#, 16#08# ), -- p - 16#70 - 112
  142. ( 16#08#, 16#14#, 16#14#, 16#18#, 16#7c# ), -- q - 16#71 - 113
  143. ( 16#7c#, 16#08#, 16#04#, 16#04#, 16#08# ), -- r - 16#72 - 114
  144. ( 16#48#, 16#54#, 16#54#, 16#54#, 16#20# ), -- s - 16#73 - 115
  145. ( 16#04#, 16#3f#, 16#44#, 16#40#, 16#20# ), -- t - 16#74 - 116
  146. ( 16#3c#, 16#40#, 16#40#, 16#20#, 16#7c# ), -- u - 16#75 - 117
  147. ( 16#1c#, 16#20#, 16#40#, 16#20#, 16#1c# ), -- v - 16#76 - 118
  148. ( 16#3c#, 16#40#, 16#30#, 16#40#, 16#3c# ), -- w - 16#77 - 119
  149. ( 16#44#, 16#28#, 16#10#, 16#28#, 16#44# ), -- x - 16#78 - 120
  150. ( 16#0c#, 16#50#, 16#50#, 16#50#, 16#3c# ), -- y - 16#79 - 121
  151. ( 16#44#, 16#64#, 16#54#, 16#4c#, 16#44# ), -- z - 16#7a - 122
  152. ( 16#00#, 16#08#, 16#36#, 16#41#, 16#00# ), -- { - 16#7b - 123
  153. ( 16#00#, 16#00#, 16#7f#, 16#00#, 16#00# ), -- | - 16#7c - 124
  154. ( 16#00#, 16#41#, 16#36#, 16#08#, 16#00# ), -- } - 16#7d - 125
  155. ( 16#10#, 16#08#, 16#08#, 16#10#, 16#08# ) -- ~ - 16#7e - 126
  156. );
  157. -- raspberry picture
  158. raspberry : constant t_lcd_array := (
  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#, -- 1. row
  161. 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
  162. 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
  163. 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
  164. 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
  165. 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
  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#, -- 1. 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#, -- 2. row
  169. 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
  170. 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
  171. 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
  172. 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
  173. 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
  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#, -- 2. 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#, -- 3. row
  177. 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
  178. 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
  179. 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
  180. 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
  181. 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
  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#, -- 3. 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#, -- 4. row
  185. 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
  186. 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
  187. 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
  188. 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
  189. 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
  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#, -- 4. 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#, -- 5. row
  193. 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
  194. 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
  195. 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
  196. 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
  197. 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
  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#, -- 5. 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#, -- 6. row
  201. 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
  202. 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
  203. 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
  204. 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
  205. 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
  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#, -- 6. 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#, -- 7. row
  209. 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
  210. 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
  211. 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
  212. 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
  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#, -- 7. 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#, -- 7. 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. 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
  217. 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
  218. 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
  219. 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
  220. 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
  221. 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
  222. 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
  223. );
  224. -- lcd init values
  225. lcd_init_data : constant t_byte_array := (
  226. 16#a0#, -- cmd8: adc select
  227. 16#c0#, -- cmd15: shl select
  228. 16#a3#, -- cmd11: lcd bias set
  229. 16#2c#, -- cmd16: power control set (vc=1, vr=0, vf=0)
  230. 16#2e#, -- cmd16: power control set (vc=1, vr=1, vf=0)
  231. 16#2f#, -- cmd16: power control set (vc=1, vr=1, vf=1)
  232. 16#26#, -- cmd17: regulator resistor select
  233. 16#60#, -- cmd2: display start line
  234. 16#a6#, -- cmd6: display normal
  235. 16#c8#, -- cmd15: common output mode select (reversed)
  236. 16#af#, -- cmd1: display on
  237. 16#a4#, -- cmd10: all points off
  238. 16#81#, -- cmd18: set volume 1st
  239. 16#18# -- cmd18: set volume 2nd (brightness)
  240. );
  241. -- pin definitions
  242. LCD_CS : constant Interfaces.C.unsigned_char := 24;
  243. LCD_RST : constant Interfaces.C.unsigned_char := 23;
  244. LCD_A0 : constant Interfaces.C.unsigned_char := 22;
  245. LCD_CLK : constant Interfaces.C.unsigned_char := 27;
  246. LCD_SI : constant Interfaces.C.unsigned_char := 17;
  247. -- exceptions
  248. mask_exception : exception;
  249. bmp_exception : exception;
  250. exception_head : string := "raspilcd version 0.1.1, (c) 2014 by tmeissner";
  251. -- procedure declarations
  252. procedure io_init;
  253. procedure lcd_init;
  254. procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string);
  255. procedure lcd_ascii57 (xpos : natural; ypos : natural; data : character);
  256. procedure lcd_picture (xpos : natural; ypos: natural; picture : t_lcd_array);
  257. procedure lcd_clear;
  258. procedure lcd_set_page (page : natural; column : natural);
  259. procedure lcd_transfer_data (value : byte; si : boolean);
  260. procedure lcd_byte (data : byte);
  261. procedure read_bmp (file : in Ada.Streams.Stream_IO.File_Type;
  262. file_access : access Ada.Streams.Root_Stream_Type'Class;
  263. bmp_picture : in out t_bmp_picture);
  264. -- function declarations
  265. function bmp_to_lcd (bmp_picture : t_bmp_picture) return t_lcd_array;
  266. function which_byte (data : dword) return integer;
  267. end st7565lcd;