Browse Source

initial commit

T. Meissner 6 years ago
commit
43332ea125

+ 4
- 0
.gitignore View File

@@ -0,0 +1,4 @@
1
+.DS_Store
2
+.idea
3
+*.swp
4
+*.*#*

+ 1199
- 0
st7565-lcd/ada/bcm2835.c
File diff suppressed because it is too large
View File


+ 1408
- 0
st7565-lcd/ada/bcm2835_h.ads
File diff suppressed because it is too large
View File


+ 132
- 0
st7565-lcd/ada/raspilcd.adb View File

@@ -0,0 +1,132 @@
1
+with Interfaces;
2
+use Interfaces;
3
+with Interfaces.C;
4
+use Interfaces.C;
5
+with Interfaces.C.extensions;
6
+use Interfaces.C.extensions;
7
+with bcm2835_h;
8
+use bcm2835_h;
9
+
10
+
11
+
12
+package body RaspiLcd is
13
+
14
+
15
+    procedure io_init is
16
+    begin
17
+        bcm2835_gpio_fsel(pin => LCD_CS, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
18
+        bcm2835_gpio_fsel(pin => LCD_RST, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
19
+        bcm2835_gpio_fsel(pin => LCD_A0, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
20
+        bcm2835_gpio_fsel(pin => LCD_CLK, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
21
+        bcm2835_gpio_fsel(pin => LCD_SI, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
22
+    end io_init;
23
+
24
+
25
+    procedure lcd_init is
26
+    begin
27
+        -- reset
28
+        bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(HIGH));
29
+        bcm2835_delayMicroseconds(unsigned_long_long(1));
30
+        bcm2835_gpio_write(pin => LCD_RST, on => unsigned_char(LOW));
31
+        bcm2835_delayMicroseconds(unsigned_long_long(1));
32
+        bcm2835_gpio_write(pin => LCD_RST, on => unsigned_char(HIGH));
33
+        bcm2835_delayMicroseconds(unsigned_long_long(1));
34
+        -- init routine
35
+        for index in lcd_init_data'range loop
36
+            lcd_transfer_data(value => lcd_init_data(index), si => false);
37
+        end loop;
38
+        lcd_clear;
39
+    end lcd_init;
40
+
41
+
42
+    procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string) is
43
+    begin
44
+        for index in 0 .. data'length-1 loop
45
+            lcd_ascii57(xpos => xpos + index * 6, ypos => ypos, data => character'val(character'pos(data(index+1))));
46
+        end loop;
47
+    end lcd_ascii57_string;
48
+
49
+
50
+    procedure lcd_ascii57 (xpos : natural; ypos : natural; data : character) is
51
+    begin
52
+        lcd_set_page(page => ypos, column => xpos);
53
+        -- write one 5x7 char
54
+        for index in 0..4 loop
55
+            lcd_transfer_data(value => font_5x7(character'pos(data) - 32)(index), si => true);
56
+        end loop;
57
+        -- one free column between chars
58
+        lcd_transfer_data(value => 16#00#, si => true);
59
+    end lcd_ascii57;
60
+
61
+
62
+    procedure lcd_picture (xpos : natural; ypos: natural) is
63
+    begin
64
+        for outdex in 0..7 loop 
65
+            lcd_set_page(page => ypos + outdex, column => xpos);
66
+            for index in (128 * outdex) .. (128 * (outdex + 1) - 1) loop
67
+              lcd_transfer_data(value => picture(index), si => true);
68
+            end loop;
69
+        end loop;
70
+    end lcd_picture;
71
+
72
+
73
+    procedure lcd_clear is
74
+    begin
75
+        bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(LOW));
76
+        for outdex in 0..7 loop
77
+            lcd_set_page(page => outdex, column => 0);
78
+            for index in 0..128 loop
79
+                lcd_transfer_data(value => 16#00#, si => true);
80
+            end loop;
81
+        end loop;
82
+        bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(HIGH));
83
+    end lcd_clear;
84
+
85
+
86
+    procedure lcd_transfer_data (value : byte; si : boolean) is
87
+    begin
88
+        bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(LOW));
89
+        bcm2835_gpio_write(pin => LCD_CLK, on => unsigned_char(HIGH));
90
+        if si then
91
+            bcm2835_gpio_write(pin => LCD_A0, on => unsigned_char(HIGH));
92
+        else
93
+            bcm2835_gpio_write(pin => LCD_A0, on => unsigned_char(LOW));
94
+        end if;
95
+        lcd_byte(value);
96
+        bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(HIGH));
97
+    end lcd_transfer_data;
98
+
99
+
100
+    procedure lcd_set_page (page : natural; column : natural) is
101
+        lsb      : byte := byte(column + 1) and 16#0f#;
102
+        msb      : byte := byte(column + 1) and 16#f0#;
103
+        page_int : byte := byte(page)   or  16#b0#;
104
+    begin
105
+        msb := Shift_Right(msb, 4);
106
+        msb := msb or 16#10#;
107
+        lcd_transfer_data(value => page_int, si => false);
108
+        lcd_transfer_data(value => msb, si => false);
109
+        lcd_transfer_data(value => lsb, si => false);
110
+        null;
111
+    end lcd_set_page;
112
+
113
+
114
+    procedure lcd_byte (data : byte) is
115
+        data_int : byte := data;
116
+    begin
117
+        for index in 0..7 loop
118
+            bcm2835_delayMicroseconds(unsigned_long_long(1));
119
+            bcm2835_gpio_write(pin => LCD_CLK, on => unsigned_char(LOW));
120
+            if (data_int and 16#80#) = 16#80# then
121
+                bcm2835_gpio_write(pin => LCD_SI, on => unsigned_char(HIGH));
122
+            else
123
+                bcm2835_gpio_write(pin => LCD_SI, on => unsigned_char(LOW));
124
+            end if;
125
+            data_int := Shift_Left(data_int, 1);
126
+            bcm2835_delayMicroseconds(unsigned_long_long(1));
127
+            bcm2835_gpio_write(pin => LCD_CLK, on => unsigned_char(HIGH));
128
+        end loop;
129
+    end lcd_byte;
130
+
131
+
132
+end RaspiLcd;

+ 224
- 0
st7565-lcd/ada/raspilcd.ads View File

@@ -0,0 +1,224 @@
1
+with Interfaces;
2
+with Interfaces.C;
3
+
4
+
5
+package RaspiLcd is
6
+
7
+
8
+    -- type definitions
9
+    subtype byte is Interfaces.Unsigned_8;
10
+
11
+    type byte_array is array (natural range <>) of byte;
12
+
13
+    type byte_byte_array is array (natural range <>) of byte_array (0 .. 4);
14
+
15
+
16
+    -- character set
17
+    font_5x7 : constant byte_byte_array := (
18
+        ( 16#00#, 16#00#, 16#00#, 16#00#, 16#00# ),  --   - 16#20 - 32
19
+        ( 16#00#, 16#00#, 16#5f#, 16#00#, 16#00# ),  -- ! - 16#21 - 33
20
+        ( 16#00#, 16#07#, 16#00#, 16#07#, 16#00# ),  -- " - 16#22 - 34
21
+        ( 16#14#, 16#7f#, 16#14#, 16#7f#, 16#14# ),  -- # - 16#23 - 35
22
+        ( 16#24#, 16#2a#, 16#7f#, 16#2a#, 16#12# ),  -- $ - 16#24 - 36
23
+        ( 16#23#, 16#13#, 16#08#, 16#64#, 16#62# ),  -- % - 16#25 - 37
24
+        ( 16#36#, 16#49#, 16#55#, 16#22#, 16#50# ),  -- & - 16#26 - 38
25
+        ( 16#00#, 16#05#, 16#03#, 16#00#, 16#00# ),  -- ' - 16#27 - 39
26
+        ( 16#00#, 16#1c#, 16#22#, 16#41#, 16#00# ),  -- ( - 16#28 - 40
27
+        ( 16#00#, 16#41#, 16#22#, 16#1c#, 16#00# ),  -- ) - 16#29 - 41
28
+        ( 16#14#, 16#08#, 16#3e#, 16#08#, 16#14# ),  -- * - 16#2a - 42
29
+        ( 16#08#, 16#08#, 16#3e#, 16#08#, 16#08# ),  -- + - 16#2b - 43
30
+        ( 16#00#, 16#50#, 16#30#, 16#00#, 16#00# ),  -- , - 16#2c - 44
31
+        ( 16#08#, 16#08#, 16#08#, 16#08#, 16#08# ),  -- - - 16#2d - 45
32
+        ( 16#00#, 16#60#, 16#60#, 16#00#, 16#00# ),  -- . - 16#2e - 46
33
+        ( 16#20#, 16#10#, 16#08#, 16#04#, 16#02# ),  -- / - 16#2f - 47
34
+        ( 16#3e#, 16#51#, 16#49#, 16#45#, 16#3e# ),  -- 0 - 16#30 - 48
35
+        ( 16#00#, 16#42#, 16#7f#, 16#40#, 16#00# ),  -- 1 - 16#31 - 49
36
+        ( 16#42#, 16#61#, 16#51#, 16#49#, 16#46# ),  -- 2 - 16#32 - 50
37
+        ( 16#21#, 16#41#, 16#45#, 16#4b#, 16#31# ),  -- 3 - 16#33 - 51
38
+        ( 16#18#, 16#14#, 16#12#, 16#7f#, 16#10# ),  -- 4 - 16#34 - 52
39
+        ( 16#27#, 16#45#, 16#45#, 16#45#, 16#39# ),  -- 5 - 16#35 - 53
40
+        ( 16#3c#, 16#4a#, 16#49#, 16#49#, 16#30# ),  -- 6 - 16#36 - 54
41
+        ( 16#01#, 16#71#, 16#09#, 16#05#, 16#03# ),  -- 7 - 16#37 - 55
42
+        ( 16#36#, 16#49#, 16#49#, 16#49#, 16#36# ),  -- 8 - 16#38 - 56
43
+        ( 16#06#, 16#49#, 16#49#, 16#29#, 16#1e# ),  -- 9 - 16#39 - 57
44
+        ( 16#00#, 16#36#, 16#36#, 16#00#, 16#00# ),  -- : - 16#3a - 58
45
+        ( 16#00#, 16#56#, 16#36#, 16#00#, 16#00# ),  -- ; - 16#3b - 59
46
+        ( 16#08#, 16#14#, 16#22#, 16#41#, 16#00# ),  -- < - 16#3c - 60
47
+        ( 16#14#, 16#14#, 16#14#, 16#14#, 16#14# ),  -- = - 16#3d - 61
48
+        ( 16#00#, 16#41#, 16#22#, 16#14#, 16#08# ),  -- > - 16#3e - 62
49
+        ( 16#02#, 16#01#, 16#51#, 16#09#, 16#06# ),  -- ? - 16#3f - 63
50
+        ( 16#32#, 16#49#, 16#79#, 16#41#, 16#3e# ),  -- @ - 16#40 - 64
51
+        ( 16#7e#, 16#11#, 16#11#, 16#11#, 16#7e# ),  -- A - 16#41 - 65
52
+        ( 16#7f#, 16#49#, 16#49#, 16#49#, 16#36# ),  -- B - 16#42 - 66
53
+        ( 16#3e#, 16#41#, 16#41#, 16#41#, 16#22# ),  -- C - 16#43 - 67
54
+        ( 16#7f#, 16#41#, 16#41#, 16#22#, 16#1c# ),  -- D - 16#44 - 68
55
+        ( 16#7f#, 16#49#, 16#49#, 16#49#, 16#41# ),  -- E - 16#45 - 69
56
+        ( 16#7f#, 16#09#, 16#09#, 16#09#, 16#01# ),  -- F - 16#46 - 70
57
+        ( 16#3e#, 16#41#, 16#49#, 16#49#, 16#7a# ),  -- G - 16#47 - 71
58
+        ( 16#7f#, 16#08#, 16#08#, 16#08#, 16#7f# ),  -- H - 16#48 - 72
59
+        ( 16#00#, 16#41#, 16#7f#, 16#41#, 16#00# ),  -- I - 16#49 - 73
60
+        ( 16#20#, 16#40#, 16#41#, 16#3f#, 16#01# ),  -- J - 16#4a - 74
61
+        ( 16#7f#, 16#08#, 16#14#, 16#22#, 16#41# ),  -- K - 16#4b - 75
62
+        ( 16#7f#, 16#40#, 16#40#, 16#40#, 16#40# ),  -- L - 16#4c - 76
63
+        ( 16#7f#, 16#02#, 16#0c#, 16#02#, 16#7f# ),  -- M - 16#4d - 77
64
+        ( 16#7f#, 16#04#, 16#08#, 16#10#, 16#7f# ),  -- N - 16#4e - 78
65
+        ( 16#3e#, 16#41#, 16#41#, 16#41#, 16#3e# ),  -- O - 16#4f - 79
66
+        ( 16#7f#, 16#09#, 16#09#, 16#09#, 16#06# ),  -- P - 16#50 - 80
67
+        ( 16#3e#, 16#41#, 16#51#, 16#21#, 16#5e# ),  -- Q - 16#51 - 81
68
+        ( 16#7f#, 16#09#, 16#19#, 16#29#, 16#46# ),  -- R - 16#52 - 82
69
+        ( 16#46#, 16#49#, 16#49#, 16#49#, 16#31# ),  -- S - 16#53 - 83
70
+        ( 16#01#, 16#01#, 16#7f#, 16#01#, 16#01# ),  -- T - 16#54 - 84
71
+        ( 16#3f#, 16#40#, 16#40#, 16#40#, 16#3f# ),  -- U - 16#55 - 85
72
+        ( 16#1f#, 16#20#, 16#40#, 16#20#, 16#1f# ),  -- V - 16#56 - 86
73
+        ( 16#3f#, 16#40#, 16#38#, 16#40#, 16#3f# ),  -- W - 16#57 - 87
74
+        ( 16#63#, 16#14#, 16#08#, 16#14#, 16#63# ),  -- X - 16#58 - 88
75
+        ( 16#07#, 16#08#, 16#70#, 16#08#, 16#07# ),  -- Y - 16#59 - 89
76
+        ( 16#61#, 16#51#, 16#49#, 16#45#, 16#43# ),  -- Z - 16#5a - 90
77
+        ( 16#00#, 16#7f#, 16#41#, 16#41#, 16#00# ),  -- [ - 16#5b - 91
78
+        ( 16#02#, 16#04#, 16#08#, 16#10#, 16#20# ),  -- \ - 16#5c - 92
79
+        ( 16#00#, 16#41#, 16#41#, 16#7f#, 16#00# ),  -- ] - 16#5d - 93
80
+        ( 16#04#, 16#02#, 16#01#, 16#02#, 16#04# ),  -- ^ - 16#5e - 94
81
+        ( 16#40#, 16#40#, 16#40#, 16#40#, 16#40# ),  -- _ - 16#5f - 95
82
+        ( 16#00#, 16#01#, 16#02#, 16#04#, 16#00# ),  -- ` - 16#60 - 96
83
+        ( 16#20#, 16#54#, 16#54#, 16#54#, 16#78# ),  -- a - 16#61 - 97
84
+        ( 16#7f#, 16#48#, 16#44#, 16#44#, 16#38# ),  -- b - 16#62 - 98
85
+        ( 16#38#, 16#44#, 16#44#, 16#44#, 16#20# ),  -- c - 16#63 - 99
86
+        ( 16#38#, 16#44#, 16#44#, 16#48#, 16#7f# ),  -- d - 16#64 - 100
87
+        ( 16#38#, 16#54#, 16#54#, 16#54#, 16#18# ),  -- e - 16#65 - 101
88
+        ( 16#08#, 16#7e#, 16#09#, 16#01#, 16#02# ),  -- f - 16#66 - 102
89
+        ( 16#38#, 16#44#, 16#44#, 16#54#, 16#34# ),  -- g - 16#67 - 103
90
+        ( 16#7f#, 16#08#, 16#04#, 16#04#, 16#78# ),  -- h - 16#68 - 104
91
+        ( 16#00#, 16#44#, 16#7d#, 16#40#, 16#00# ),  -- i - 16#69 - 105
92
+        ( 16#20#, 16#40#, 16#44#, 16#3d#, 16#00# ),  -- j - 16#6a - 106
93
+        ( 16#7f#, 16#10#, 16#28#, 16#44#, 16#00# ),  -- k - 16#6b - 107
94
+        ( 16#00#, 16#41#, 16#7f#, 16#40#, 16#00# ),  -- l - 16#6c - 108
95
+        ( 16#7c#, 16#04#, 16#18#, 16#04#, 16#78# ),  -- m - 16#6d - 109
96
+        ( 16#7c#, 16#08#, 16#04#, 16#04#, 16#78# ),  -- n - 16#6e - 110
97
+        ( 16#38#, 16#44#, 16#44#, 16#44#, 16#38# ),  -- o - 16#6f - 111
98
+        ( 16#7c#, 16#14#, 16#14#, 16#14#, 16#08# ),  -- p - 16#70 - 112
99
+        ( 16#08#, 16#14#, 16#14#, 16#18#, 16#7c# ),  -- q - 16#71 - 113
100
+        ( 16#7c#, 16#08#, 16#04#, 16#04#, 16#08# ),  -- r - 16#72 - 114
101
+        ( 16#48#, 16#54#, 16#54#, 16#54#, 16#20# ),  -- s - 16#73 - 115
102
+        ( 16#04#, 16#3f#, 16#44#, 16#40#, 16#20# ),  -- t - 16#74 - 116
103
+        ( 16#3c#, 16#40#, 16#40#, 16#20#, 16#7c# ),  -- u - 16#75 - 117
104
+        ( 16#1c#, 16#20#, 16#40#, 16#20#, 16#1c# ),  -- v - 16#76 - 118
105
+        ( 16#3c#, 16#40#, 16#30#, 16#40#, 16#3c# ),  -- w - 16#77 - 119
106
+        ( 16#44#, 16#28#, 16#10#, 16#28#, 16#44# ),  -- x - 16#78 - 120
107
+        ( 16#0c#, 16#50#, 16#50#, 16#50#, 16#3c# ),  -- y - 16#79 - 121
108
+        ( 16#44#, 16#64#, 16#54#, 16#4c#, 16#44# ),  -- z - 16#7a - 122
109
+        ( 16#00#, 16#08#, 16#36#, 16#41#, 16#00# ),  -- { - 16#7b - 123
110
+        ( 16#00#, 16#00#, 16#7f#, 16#00#, 16#00# ),  -- | - 16#7c - 124
111
+        ( 16#00#, 16#41#, 16#36#, 16#08#, 16#00# ),  -- } - 16#7d - 125
112
+        ( 16#10#, 16#08#, 16#08#, 16#10#, 16#08# )   -- ~ - 16#7e - 126
113
+    );
114
+
115
+
116
+    -- raspberry picture
117
+    picture : constant byte_array := (
118
+        16#00#,16#00#,16#00#,16#00#,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
119
+        16#00#,16#00#,16#00#,16#00#,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
120
+        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
121
+        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
122
+        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
123
+        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
124
+        16#00#,16#00#,16#00#,16#00#,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
125
+        16#00#,16#00#,16#00#,16#00#,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
126
+        16#00#,16#00#,16#00#,16#00#,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
127
+        16#00#,16#00#,16#00#,16#00#,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
128
+        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
129
+        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
130
+        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
131
+        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
132
+        16#00#,16#00#,16#00#,16#00#,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
133
+        16#00#,16#00#,16#00#,16#00#,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
134
+        16#00#,16#00#,16#00#,16#00#,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
135
+        16#00#,16#00#,16#00#,16#00#,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
136
+        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
137
+        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
138
+        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
139
+        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
140
+        16#00#,16#00#,16#00#,16#00#,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
141
+        16#00#,16#00#,16#00#,16#00#,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
142
+        16#00#,16#00#,16#00#,16#00#,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
143
+        16#00#,16#00#,16#00#,16#00#,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
144
+        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
145
+        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
146
+        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
147
+        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
148
+        16#00#,16#00#,16#00#,16#00#,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
149
+        16#00#,16#00#,16#00#,16#00#,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
150
+        16#00#,16#00#,16#00#,16#00#,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
151
+        16#00#,16#00#,16#00#,16#00#,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
152
+        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
153
+        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
154
+        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
155
+        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
156
+        16#00#,16#00#,16#00#,16#00#,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
157
+        16#00#,16#00#,16#00#,16#00#,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
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#, -- 6. 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#, -- 6. row
160
+        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
161
+        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
162
+        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
163
+        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
164
+        16#00#,16#00#,16#00#,16#00#,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
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#, -- 6. 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#, -- 7. 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#, -- 7. row
168
+        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
169
+        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
170
+        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
171
+        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
172
+        16#00#,16#00#,16#00#,16#00#,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
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#, -- 7. 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#, -- 8. 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#, -- 8. 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#01#,16#01#, -- 8. row
177
+        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
178
+        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
179
+        16#00#,16#00#,16#00#,16#00#,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
180
+        16#00#,16#00#,16#00#,16#00#,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
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#  -- 8. row
182
+    );
183
+
184
+
185
+    -- lcd init values
186
+    lcd_init_data : constant byte_array := (
187
+        16#a0#,  -- cmd8:  adc select
188
+        16#c0#,  -- cmd15: shl select
189
+        16#a3#,  -- cmd11: lcd bias set
190
+        16#2c#,  -- cmd16: power control set (vc=1, vr=0, vf=0)
191
+        16#2e#,  -- cmd16: power control set (vc=1, vr=1, vf=0)
192
+        16#2f#,  -- cmd16: power control set (vc=1, vr=1, vf=1)
193
+        16#26#,  -- cmd17: regulator resistor select
194
+        16#60#,  -- cmd2:  display start line
195
+        16#a6#,  -- cmd6:  display normal
196
+        16#c8#,  -- cmd15: common output mode select (reversed)
197
+        16#af#,  -- cmd1:  display on 
198
+        16#a4#,  -- cmd10: all points off
199
+        16#81#,  -- cmd18: set volume 1st
200
+        16#18#   -- cmd18: set volume 2nd (brightness)
201
+    );
202
+
203
+
204
+    -- pin definitions
205
+    LCD_CS  : constant Interfaces.C.unsigned_char := 24;
206
+    LCD_RST : constant Interfaces.C.unsigned_char := 23;
207
+    LCD_A0  : constant Interfaces.C.unsigned_char := 22;
208
+    LCD_CLK : constant Interfaces.C.unsigned_char := 27;
209
+    LCD_SI  : constant Interfaces.C.unsigned_char := 17;
210
+
211
+
212
+    -- procedures declarations
213
+    procedure io_init;
214
+    procedure lcd_init;
215
+    procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string);
216
+    procedure lcd_ascii57 (xpos : natural; ypos : natural; data : character);
217
+    procedure lcd_picture (xpos : natural; ypos: natural);
218
+    procedure lcd_clear;
219
+    procedure lcd_set_page (page : natural; column : natural);
220
+    procedure lcd_transfer_data (value : byte; si : boolean);
221
+    procedure lcd_byte (data : byte);
222
+
223
+
224
+end RaspiLcd;

+ 44
- 0
st7565-lcd/ada/raspitest.adb View File

@@ -0,0 +1,44 @@
1
+with Ada.Text_IO;
2
+with bcm2835_h;
3
+with RaspiLcd;
4
+
5
+
6
+
7
+procedure raspitest is
8
+
9
+
10
+    package IO    renames Ada.Text_IO;
11
+    package LCD renames RaspiLcd;
12
+
13
+
14
+begin
15
+
16
+
17
+    if integer(bcm2835_h.bcm2835_init) = 0 then
18
+
19
+        IO.Put_Line("Error while initializing BCM2835 library");
20
+    
21
+    else
22
+
23
+        LCD.io_init;
24
+ 
25
+        LCD.lcd_init;
26
+ 
27
+        LCD.lcd_picture(xpos => 0, ypos => 0);
28
+
29
+        bcm2835_h.bcm2835_delay(5000);
30
+ 
31
+        LCD.lcd_clear;
32
+
33
+        LCD.lcd_ascii57_string(xpos => 0, ypos => 0, data => "raspiFPGA 0.1");
34
+        LCD.lcd_ascii57_string(xpos => 0, ypos => 1, data => "(c) raspiDEV 2013");
35
+
36
+        -- close library
37
+        if integer(bcm2835_h.bcm2835_close) = 0 then
38
+            IO.Put_Line("Error while closing BCM2835 library");
39
+        end if;
40
+
41
+    end if;
42
+
43
+
44
+end raspitest;

+ 122
- 0
st7565-lcd/ada/stdint_h.ads View File

@@ -0,0 +1,122 @@
1
+with Interfaces.C; use Interfaces.C;
2
+with Interfaces.C.Extensions;
3
+
4
+package stdint_h is
5
+
6
+  -- Copyright (C) 1997,1998,1999,2000,2001,2006 Free Software Foundation, Inc.
7
+  --   This file is part of the GNU C Library.
8
+  --   The GNU C Library is free software; you can redistribute it and/or
9
+  --   modify it under the terms of the GNU Lesser General Public
10
+  --   License as published by the Free Software Foundation; either
11
+  --   version 2.1 of the License, or (at your option) any later version.
12
+  --   The GNU C Library is distributed in the hope that it will be useful,
13
+  --   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+  --   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+  --   Lesser General Public License for more details.
16
+  --   You should have received a copy of the GNU Lesser General Public
17
+  --   License along with the GNU C Library; if not, write to the Free
18
+  --   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
+  --   02111-1307 USA.   
20
+
21
+  -- *	ISO C99: 7.18 Integer types <stdint.h>
22
+  --  
23
+
24
+  -- Exact integral types.   
25
+  -- Signed.   
26
+  -- There is some amount of overlap with <sys/types.h> as known by inet code  
27
+   subtype int8_t is signed_char;  -- /usr/include/stdint.h:37
28
+
29
+   subtype int16_t is short;  -- /usr/include/stdint.h:38
30
+
31
+   subtype int32_t is int;  -- /usr/include/stdint.h:39
32
+
33
+   subtype int64_t is Long_Long_Integer;  -- /usr/include/stdint.h:44
34
+
35
+  -- Unsigned.   
36
+   subtype uint8_t is unsigned_char;  -- /usr/include/stdint.h:49
37
+
38
+   subtype uint16_t is unsigned_short;  -- /usr/include/stdint.h:50
39
+
40
+   subtype uint32_t is unsigned;  -- /usr/include/stdint.h:52
41
+
42
+   subtype uint64_t is Extensions.unsigned_long_long;  -- /usr/include/stdint.h:59
43
+
44
+  -- Small types.   
45
+  -- Signed.   
46
+   subtype int_least8_t is signed_char;  -- /usr/include/stdint.h:66
47
+
48
+   subtype int_least16_t is short;  -- /usr/include/stdint.h:67
49
+
50
+   subtype int_least32_t is int;  -- /usr/include/stdint.h:68
51
+
52
+   subtype int_least64_t is Long_Long_Integer;  -- /usr/include/stdint.h:73
53
+
54
+  -- Unsigned.   
55
+   subtype uint_least8_t is unsigned_char;  -- /usr/include/stdint.h:77
56
+
57
+   subtype uint_least16_t is unsigned_short;  -- /usr/include/stdint.h:78
58
+
59
+   subtype uint_least32_t is unsigned;  -- /usr/include/stdint.h:79
60
+
61
+   subtype uint_least64_t is Extensions.unsigned_long_long;  -- /usr/include/stdint.h:84
62
+
63
+  -- Fast types.   
64
+  -- Signed.   
65
+   subtype int_fast8_t is signed_char;  -- /usr/include/stdint.h:91
66
+
67
+   subtype int_fast16_t is int;  -- /usr/include/stdint.h:97
68
+
69
+   subtype int_fast32_t is int;  -- /usr/include/stdint.h:98
70
+
71
+   subtype int_fast64_t is Long_Long_Integer;  -- /usr/include/stdint.h:100
72
+
73
+  -- Unsigned.   
74
+   subtype uint_fast8_t is unsigned_char;  -- /usr/include/stdint.h:104
75
+
76
+   subtype uint_fast16_t is unsigned;  -- /usr/include/stdint.h:110
77
+
78
+   subtype uint_fast32_t is unsigned;  -- /usr/include/stdint.h:111
79
+
80
+   subtype uint_fast64_t is Extensions.unsigned_long_long;  -- /usr/include/stdint.h:113
81
+
82
+  -- Types for `void *' pointers.   
83
+   subtype intptr_t is int;  -- /usr/include/stdint.h:126
84
+
85
+   subtype uintptr_t is unsigned;  -- /usr/include/stdint.h:129
86
+
87
+  -- Largest integral types.   
88
+   subtype intmax_t is Long_Long_Integer;  -- /usr/include/stdint.h:139
89
+
90
+   subtype uintmax_t is Extensions.unsigned_long_long;  -- /usr/include/stdint.h:141
91
+
92
+  -- The ISO C99 standard specifies that in C++ implementations these
93
+  --   macros should only be defined if explicitly requested.   
94
+
95
+  -- Limits of integral types.   
96
+  -- Minimum of signed integral types.   
97
+  -- Maximum of signed integral types.   
98
+  -- Maximum of unsigned integral types.   
99
+  -- Minimum of signed integral types having a minimum size.   
100
+  -- Maximum of signed integral types having a minimum size.   
101
+  -- Maximum of unsigned integral types having a minimum size.   
102
+  -- Minimum of fast signed integral types having a minimum size.   
103
+  -- Maximum of fast signed integral types having a minimum size.   
104
+  -- Maximum of fast unsigned integral types having a minimum size.   
105
+  -- Values to test for integral types holding `void *' pointer.   
106
+  -- Minimum for largest signed integral type.   
107
+  -- Maximum for largest signed integral type.   
108
+  -- Maximum for largest unsigned integral type.   
109
+  -- Limits of other integer types.   
110
+  -- Limits of `ptrdiff_t' type.   
111
+  -- Limits of `sig_atomic_t'.   
112
+  -- Limit of `size_t' type.   
113
+  -- Limits of `wchar_t'.   
114
+  -- These constants might also be defined in <wchar.h>.   
115
+  -- Limits of `wint_t'.   
116
+  -- The ISO C99 standard specifies that in C++ implementations these
117
+  --   should only be defined if explicitly requested.   
118
+
119
+  -- Signed.   
120
+  -- Unsigned.   
121
+  -- Maximal type.   
122
+end stdint_h;