Browse Source

initial commit

master
T. Meissner 11 years ago
commit
43332ea125
7 changed files with 3133 additions and 0 deletions
  1. +4
    -0
      .gitignore
  2. +1199
    -0
      st7565-lcd/ada/bcm2835.c
  3. +1408
    -0
      st7565-lcd/ada/bcm2835_h.ads
  4. +132
    -0
      st7565-lcd/ada/raspilcd.adb
  5. +224
    -0
      st7565-lcd/ada/raspilcd.ads
  6. +44
    -0
      st7565-lcd/ada/raspitest.adb
  7. +122
    -0
      st7565-lcd/ada/stdint_h.ads

+ 4
- 0
.gitignore View File

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

+ 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 @@
with Interfaces;
use Interfaces;
with Interfaces.C;
use Interfaces.C;
with Interfaces.C.extensions;
use Interfaces.C.extensions;
with bcm2835_h;
use bcm2835_h;
package body RaspiLcd is
procedure io_init is
begin
bcm2835_gpio_fsel(pin => LCD_CS, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
bcm2835_gpio_fsel(pin => LCD_RST, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
bcm2835_gpio_fsel(pin => LCD_A0, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
bcm2835_gpio_fsel(pin => LCD_CLK, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
bcm2835_gpio_fsel(pin => LCD_SI, mode => unsigned_char(BCM2835_GPIO_FSEL_OUTP));
end io_init;
procedure lcd_init is
begin
-- reset
bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(HIGH));
bcm2835_delayMicroseconds(unsigned_long_long(1));
bcm2835_gpio_write(pin => LCD_RST, on => unsigned_char(LOW));
bcm2835_delayMicroseconds(unsigned_long_long(1));
bcm2835_gpio_write(pin => LCD_RST, on => unsigned_char(HIGH));
bcm2835_delayMicroseconds(unsigned_long_long(1));
-- init routine
for index in lcd_init_data'range loop
lcd_transfer_data(value => lcd_init_data(index), si => false);
end loop;
lcd_clear;
end lcd_init;
procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string) is
begin
for index in 0 .. data'length-1 loop
lcd_ascii57(xpos => xpos + index * 6, ypos => ypos, data => character'val(character'pos(data(index+1))));
end loop;
end lcd_ascii57_string;
procedure lcd_ascii57 (xpos : natural; ypos : natural; data : character) is
begin
lcd_set_page(page => ypos, column => xpos);
-- write one 5x7 char
for index in 0..4 loop
lcd_transfer_data(value => font_5x7(character'pos(data) - 32)(index), si => true);
end loop;
-- one free column between chars
lcd_transfer_data(value => 16#00#, si => true);
end lcd_ascii57;
procedure lcd_picture (xpos : natural; ypos: natural) is
begin
for outdex in 0..7 loop
lcd_set_page(page => ypos + outdex, column => xpos);
for index in (128 * outdex) .. (128 * (outdex + 1) - 1) loop
lcd_transfer_data(value => picture(index), si => true);
end loop;
end loop;
end lcd_picture;
procedure lcd_clear is
begin
bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(LOW));
for outdex in 0..7 loop
lcd_set_page(page => outdex, column => 0);
for index in 0..128 loop
lcd_transfer_data(value => 16#00#, si => true);
end loop;
end loop;
bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(HIGH));
end lcd_clear;
procedure lcd_transfer_data (value : byte; si : boolean) is
begin
bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(LOW));
bcm2835_gpio_write(pin => LCD_CLK, on => unsigned_char(HIGH));
if si then
bcm2835_gpio_write(pin => LCD_A0, on => unsigned_char(HIGH));
else
bcm2835_gpio_write(pin => LCD_A0, on => unsigned_char(LOW));
end if;
lcd_byte(value);
bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(HIGH));
end lcd_transfer_data;
procedure lcd_set_page (page : natural; column : natural) is
lsb : byte := byte(column + 1) and 16#0f#;
msb : byte := byte(column + 1) and 16#f0#;
page_int : byte := byte(page) or 16#b0#;
begin
msb := Shift_Right(msb, 4);
msb := msb or 16#10#;
lcd_transfer_data(value => page_int, si => false);
lcd_transfer_data(value => msb, si => false);
lcd_transfer_data(value => lsb, si => false);
null;
end lcd_set_page;
procedure lcd_byte (data : byte) is
data_int : byte := data;
begin
for index in 0..7 loop
bcm2835_delayMicroseconds(unsigned_long_long(1));
bcm2835_gpio_write(pin => LCD_CLK, on => unsigned_char(LOW));
if (data_int and 16#80#) = 16#80# then
bcm2835_gpio_write(pin => LCD_SI, on => unsigned_char(HIGH));
else
bcm2835_gpio_write(pin => LCD_SI, on => unsigned_char(LOW));
end if;
data_int := Shift_Left(data_int, 1);
bcm2835_delayMicroseconds(unsigned_long_long(1));
bcm2835_gpio_write(pin => LCD_CLK, on => unsigned_char(HIGH));
end loop;
end lcd_byte;
end RaspiLcd;

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

@ -0,0 +1,224 @@
with Interfaces;
with Interfaces.C;
package RaspiLcd is
-- type definitions
subtype byte is Interfaces.Unsigned_8;
type byte_array is array (natural range <>) of byte;
type byte_byte_array is array (natural range <>) of byte_array (0 .. 4);
-- character set
font_5x7 : constant byte_byte_array := (
( 16#00#, 16#00#, 16#00#, 16#00#, 16#00# ), -- - 16#20 - 32
( 16#00#, 16#00#, 16#5f#, 16#00#, 16#00# ), -- ! - 16#21 - 33
( 16#00#, 16#07#, 16#00#, 16#07#, 16#00# ), -- " - 16#22 - 34
( 16#14#, 16#7f#, 16#14#, 16#7f#, 16#14# ), -- # - 16#23 - 35
( 16#24#, 16#2a#, 16#7f#, 16#2a#, 16#12# ), -- $ - 16#24 - 36
( 16#23#, 16#13#, 16#08#, 16#64#, 16#62# ), -- % - 16#25 - 37
( 16#36#, 16#49#, 16#55#, 16#22#, 16#50# ), -- & - 16#26 - 38
( 16#00#, 16#05#, 16#03#, 16#00#, 16#00# ), -- ' - 16#27 - 39
( 16#00#, 16#1c#, 16#22#, 16#41#, 16#00# ), -- ( - 16#28 - 40
( 16#00#, 16#41#, 16#22#, 16#1c#, 16#00# ), -- ) - 16#29 - 41
( 16#14#, 16#08#, 16#3e#, 16#08#, 16#14# ), -- * - 16#2a - 42
( 16#08#, 16#08#, 16#3e#, 16#08#, 16#08# ), -- + - 16#2b - 43
( 16#00#, 16#50#, 16#30#, 16#00#, 16#00# ), -- , - 16#2c - 44
( 16#08#, 16#08#, 16#08#, 16#08#, 16#08# ), -- - - 16#2d - 45
( 16#00#, 16#60#, 16#60#, 16#00#, 16#00# ), -- . - 16#2e - 46
( 16#20#, 16#10#, 16#08#, 16#04#, 16#02# ), -- / - 16#2f - 47
( 16#3e#, 16#51#, 16#49#, 16#45#, 16#3e# ), -- 0 - 16#30 - 48
( 16#00#, 16#42#, 16#7f#, 16#40#, 16#00# ), -- 1 - 16#31 - 49
( 16#42#, 16#61#, 16#51#, 16#49#, 16#46# ), -- 2 - 16#32 - 50
( 16#21#, 16#41#, 16#45#, 16#4b#, 16#31# ), -- 3 - 16#33 - 51
( 16#18#, 16#14#, 16#12#, 16#7f#, 16#10# ), -- 4 - 16#34 - 52
( 16#27#, 16#45#, 16#45#, 16#45#, 16#39# ), -- 5 - 16#35 - 53
( 16#3c#, 16#4a#, 16#49#, 16#49#, 16#30# ), -- 6 - 16#36 - 54
( 16#01#, 16#71#, 16#09#, 16#05#, 16#03# ), -- 7 - 16#37 - 55
( 16#36#, 16#49#, 16#49#, 16#49#, 16#36# ), -- 8 - 16#38 - 56
( 16#06#, 16#49#, 16#49#, 16#29#, 16#1e# ), -- 9 - 16#39 - 57
( 16#00#, 16#36#, 16#36#, 16#00#, 16#00# ), -- : - 16#3a - 58
( 16#00#, 16#56#, 16#36#, 16#00#, 16#00# ), -- ; - 16#3b - 59
( 16#08#, 16#14#, 16#22#, 16#41#, 16#00# ), -- < - 16#3c - 60
( 16#14#, 16#14#, 16#14#, 16#14#, 16#14# ), -- = - 16#3d - 61
( 16#00#, 16#41#, 16#22#, 16#14#, 16#08# ), -- > - 16#3e - 62
( 16#02#, 16#01#, 16#51#, 16#09#, 16#06# ), -- ? - 16#3f - 63
( 16#32#, 16#49#, 16#79#, 16#41#, 16#3e# ), -- @ - 16#40 - 64
( 16#7e#, 16#11#, 16#11#, 16#11#, 16#7e# ), -- A - 16#41 - 65
( 16#7f#, 16#49#, 16#49#, 16#49#, 16#36# ), -- B - 16#42 - 66
( 16#3e#, 16#41#, 16#41#, 16#41#, 16#22# ), -- C - 16#43 - 67
( 16#7f#, 16#41#, 16#41#, 16#22#, 16#1c# ), -- D - 16#44 - 68
( 16#7f#, 16#49#, 16#49#, 16#49#, 16#41# ), -- E - 16#45 - 69
( 16#7f#, 16#09#, 16#09#, 16#09#, 16#01# ), -- F - 16#46 - 70
( 16#3e#, 16#41#, 16#49#, 16#49#, 16#7a# ), -- G - 16#47 - 71
( 16#7f#, 16#08#, 16#08#, 16#08#, 16#7f# ), -- H - 16#48 - 72
( 16#00#, 16#41#, 16#7f#, 16#41#, 16#00# ), -- I - 16#49 - 73
( 16#20#, 16#40#, 16#41#, 16#3f#, 16#01# ), -- J - 16#4a - 74
( 16#7f#, 16#08#, 16#14#, 16#22#, 16#41# ), -- K - 16#4b - 75
( 16#7f#, 16#40#, 16#40#, 16#40#, 16#40# ), -- L - 16#4c - 76
( 16#7f#, 16#02#, 16#0c#, 16#02#, 16#7f# ), -- M - 16#4d - 77
( 16#7f#, 16#04#, 16#08#, 16#10#, 16#7f# ), -- N - 16#4e - 78
( 16#3e#, 16#41#, 16#41#, 16#41#, 16#3e# ), -- O - 16#4f - 79
( 16#7f#, 16#09#, 16#09#, 16#09#, 16#06# ), -- P - 16#50 - 80
( 16#3e#, 16#41#, 16#51#, 16#21#, 16#5e# ), -- Q - 16#51 - 81
( 16#7f#, 16#09#, 16#19#, 16#29#, 16#46# ), -- R - 16#52 - 82
( 16#46#, 16#49#, 16#49#, 16#49#, 16#31# ), -- S - 16#53 - 83
( 16#01#, 16#01#, 16#7f#, 16#01#, 16#01# ), -- T - 16#54 - 84
( 16#3f#, 16#40#, 16#40#, 16#40#, 16#3f# ), -- U - 16#55 - 85
( 16#1f#, 16#20#, 16#40#, 16#20#, 16#1f# ), -- V - 16#56 - 86
( 16#3f#, 16#40#, 16#38#, 16#40#, 16#3f# ), -- W - 16#57 - 87
( 16#63#, 16#14#, 16#08#, 16#14#, 16#63# ), -- X - 16#58 - 88
( 16#07#, 16#08#, 16#70#, 16#08#, 16#07# ), -- Y - 16#59 - 89
( 16#61#, 16#51#, 16#49#, 16#45#, 16#43# ), -- Z - 16#5a - 90
( 16#00#, 16#7f#, 16#41#, 16#41#, 16#00# ), -- [ - 16#5b - 91
( 16#02#, 16#04#, 16#08#, 16#10#, 16#20# ), -- \ - 16#5c - 92
( 16#00#, 16#41#, 16#41#, 16#7f#, 16#00# ), -- ] - 16#5d - 93
( 16#04#, 16#02#, 16#01#, 16#02#, 16#04# ), -- ^ - 16#5e - 94
( 16#40#, 16#40#, 16#40#, 16#40#, 16#40# ), -- _ - 16#5f - 95
( 16#00#, 16#01#, 16#02#, 16#04#, 16#00# ), -- ` - 16#60 - 96
( 16#20#, 16#54#, 16#54#, 16#54#, 16#78# ), -- a - 16#61 - 97
( 16#7f#, 16#48#, 16#44#, 16#44#, 16#38# ), -- b - 16#62 - 98
( 16#38#, 16#44#, 16#44#, 16#44#, 16#20# ), -- c - 16#63 - 99
( 16#38#, 16#44#, 16#44#, 16#48#, 16#7f# ), -- d - 16#64 - 100
( 16#38#, 16#54#, 16#54#, 16#54#, 16#18# ), -- e - 16#65 - 101
( 16#08#, 16#7e#, 16#09#, 16#01#, 16#02# ), -- f - 16#66 - 102
( 16#38#, 16#44#, 16#44#, 16#54#, 16#34# ), -- g - 16#67 - 103
( 16#7f#, 16#08#, 16#04#, 16#04#, 16#78# ), -- h - 16#68 - 104
( 16#00#, 16#44#, 16#7d#, 16#40#, 16#00# ), -- i - 16#69 - 105
( 16#20#, 16#40#, 16#44#, 16#3d#, 16#00# ), -- j - 16#6a - 106
( 16#7f#, 16#10#, 16#28#, 16#44#, 16#00# ), -- k - 16#6b - 107
( 16#00#, 16#41#, 16#7f#, 16#40#, 16#00# ), -- l - 16#6c - 108
( 16#7c#, 16#04#, 16#18#, 16#04#, 16#78# ), -- m - 16#6d - 109
( 16#7c#, 16#08#, 16#04#, 16#04#, 16#78# ), -- n - 16#6e - 110
( 16#38#, 16#44#, 16#44#, 16#44#, 16#38# ), -- o - 16#6f - 111
( 16#7c#, 16#14#, 16#14#, 16#14#, 16#08# ), -- p - 16#70 - 112
( 16#08#, 16#14#, 16#14#, 16#18#, 16#7c# ), -- q - 16#71 - 113
( 16#7c#, 16#08#, 16#04#, 16#04#, 16#08# ), -- r - 16#72 - 114
( 16#48#, 16#54#, 16#54#, 16#54#, 16#20# ), -- s - 16#73 - 115
( 16#04#, 16#3f#, 16#44#, 16#40#, 16#20# ), -- t - 16#74 - 116
( 16#3c#, 16#40#, 16#40#, 16#20#, 16#7c# ), -- u - 16#75 - 117
( 16#1c#, 16#20#, 16#40#, 16#20#, 16#1c# ), -- v - 16#76 - 118
( 16#3c#, 16#40#, 16#30#, 16#40#, 16#3c# ), -- w - 16#77 - 119
( 16#44#, 16#28#, 16#10#, 16#28#, 16#44# ), -- x - 16#78 - 120
( 16#0c#, 16#50#, 16#50#, 16#50#, 16#3c# ), -- y - 16#79 - 121
( 16#44#, 16#64#, 16#54#, 16#4c#, 16#44# ), -- z - 16#7a - 122
( 16#00#, 16#08#, 16#36#, 16#41#, 16#00# ), -- { - 16#7b - 123
( 16#00#, 16#00#, 16#7f#, 16#00#, 16#00# ), -- | - 16#7c - 124
( 16#00#, 16#41#, 16#36#, 16#08#, 16#00# ), -- } - 16#7d - 125
( 16#10#, 16#08#, 16#08#, 16#10#, 16#08# ) -- ~ - 16#7e - 126
);
-- raspberry picture
picture : constant byte_array := (
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
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
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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
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
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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
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
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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
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
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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
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
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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
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
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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
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
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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#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
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
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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
16#00#,16#00#,16#00#,16#00#,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
);
-- lcd init values
lcd_init_data : constant byte_array := (
16#a0#, -- cmd8: adc select
16#c0#, -- cmd15: shl select
16#a3#, -- cmd11: lcd bias set
16#2c#, -- cmd16: power control set (vc=1, vr=0, vf=0)
16#2e#, -- cmd16: power control set (vc=1, vr=1, vf=0)
16#2f#, -- cmd16: power control set (vc=1, vr=1, vf=1)
16#26#, -- cmd17: regulator resistor select
16#60#, -- cmd2: display start line
16#a6#, -- cmd6: display normal
16#c8#, -- cmd15: common output mode select (reversed)
16#af#, -- cmd1: display on
16#a4#, -- cmd10: all points off
16#81#, -- cmd18: set volume 1st
16#18# -- cmd18: set volume 2nd (brightness)
);
-- pin definitions
LCD_CS : constant Interfaces.C.unsigned_char := 24;
LCD_RST : constant Interfaces.C.unsigned_char := 23;
LCD_A0 : constant Interfaces.C.unsigned_char := 22;
LCD_CLK : constant Interfaces.C.unsigned_char := 27;
LCD_SI : constant Interfaces.C.unsigned_char := 17;
-- procedures declarations
procedure io_init;
procedure lcd_init;
procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string);
procedure lcd_ascii57 (xpos : natural; ypos : natural; data : character);
procedure lcd_picture (xpos : natural; ypos: natural);
procedure lcd_clear;
procedure lcd_set_page (page : natural; column : natural);
procedure lcd_transfer_data (value : byte; si : boolean);
procedure lcd_byte (data : byte);
end RaspiLcd;

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

@ -0,0 +1,44 @@
with Ada.Text_IO;
with bcm2835_h;
with RaspiLcd;
procedure raspitest is
package IO renames Ada.Text_IO;
package LCD renames RaspiLcd;
begin
if integer(bcm2835_h.bcm2835_init) = 0 then
IO.Put_Line("Error while initializing BCM2835 library");
else
LCD.io_init;
LCD.lcd_init;
LCD.lcd_picture(xpos => 0, ypos => 0);
bcm2835_h.bcm2835_delay(5000);
LCD.lcd_clear;
LCD.lcd_ascii57_string(xpos => 0, ypos => 0, data => "raspiFPGA 0.1");
LCD.lcd_ascii57_string(xpos => 0, ypos => 1, data => "(c) raspiDEV 2013");
-- close library
if integer(bcm2835_h.bcm2835_close) = 0 then
IO.Put_Line("Error while closing BCM2835 library");
end if;
end if;
end raspitest;

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

@ -0,0 +1,122 @@
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions;
package stdint_h is
-- Copyright (C) 1997,1998,1999,2000,2001,2006 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, write to the Free
-- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-- 02111-1307 USA.
-- * ISO C99: 7.18 Integer types <stdint.h>
--
-- Exact integral types.
-- Signed.
-- There is some amount of overlap with <sys/types.h> as known by inet code
subtype int8_t is signed_char; -- /usr/include/stdint.h:37
subtype int16_t is short; -- /usr/include/stdint.h:38
subtype int32_t is int; -- /usr/include/stdint.h:39
subtype int64_t is Long_Long_Integer; -- /usr/include/stdint.h:44
-- Unsigned.
subtype uint8_t is unsigned_char; -- /usr/include/stdint.h:49
subtype uint16_t is unsigned_short; -- /usr/include/stdint.h:50
subtype uint32_t is unsigned; -- /usr/include/stdint.h:52
subtype uint64_t is Extensions.unsigned_long_long; -- /usr/include/stdint.h:59
-- Small types.
-- Signed.
subtype int_least8_t is signed_char; -- /usr/include/stdint.h:66
subtype int_least16_t is short; -- /usr/include/stdint.h:67
subtype int_least32_t is int; -- /usr/include/stdint.h:68
subtype int_least64_t is Long_Long_Integer; -- /usr/include/stdint.h:73
-- Unsigned.
subtype uint_least8_t is unsigned_char; -- /usr/include/stdint.h:77
subtype uint_least16_t is unsigned_short; -- /usr/include/stdint.h:78
subtype uint_least32_t is unsigned; -- /usr/include/stdint.h:79
subtype uint_least64_t is Extensions.unsigned_long_long; -- /usr/include/stdint.h:84
-- Fast types.
-- Signed.
subtype int_fast8_t is signed_char; -- /usr/include/stdint.h:91
subtype int_fast16_t is int; -- /usr/include/stdint.h:97
subtype int_fast32_t is int; -- /usr/include/stdint.h:98
subtype int_fast64_t is Long_Long_Integer; -- /usr/include/stdint.h:100
-- Unsigned.
subtype uint_fast8_t is unsigned_char; -- /usr/include/stdint.h:104
subtype uint_fast16_t is unsigned; -- /usr/include/stdint.h:110
subtype uint_fast32_t is unsigned; -- /usr/include/stdint.h:111
subtype uint_fast64_t is Extensions.unsigned_long_long; -- /usr/include/stdint.h:113
-- Types for `void *' pointers.
subtype intptr_t is int; -- /usr/include/stdint.h:126
subtype uintptr_t is unsigned; -- /usr/include/stdint.h:129
-- Largest integral types.
subtype intmax_t is Long_Long_Integer; -- /usr/include/stdint.h:139
subtype uintmax_t is Extensions.unsigned_long_long; -- /usr/include/stdint.h:141
-- The ISO C99 standard specifies that in C++ implementations these
-- macros should only be defined if explicitly requested.
-- Limits of integral types.
-- Minimum of signed integral types.
-- Maximum of signed integral types.
-- Maximum of unsigned integral types.
-- Minimum of signed integral types having a minimum size.
-- Maximum of signed integral types having a minimum size.
-- Maximum of unsigned integral types having a minimum size.
-- Minimum of fast signed integral types having a minimum size.
-- Maximum of fast signed integral types having a minimum size.
-- Maximum of fast unsigned integral types having a minimum size.
-- Values to test for integral types holding `void *' pointer.
-- Minimum for largest signed integral type.
-- Maximum for largest signed integral type.
-- Maximum for largest unsigned integral type.
-- Limits of other integer types.
-- Limits of `ptrdiff_t' type.
-- Limits of `sig_atomic_t'.
-- Limit of `size_t' type.
-- Limits of `wchar_t'.
-- These constants might also be defined in <wchar.h>.
-- Limits of `wint_t'.
-- The ISO C99 standard specifies that in C++ implementations these
-- should only be defined if explicitly requested.
-- Signed.
-- Unsigned.
-- Maximal type.
end stdint_h;

Loading…
Cancel
Save