@ -1,175 +1,145 @@ | |||||
with Interfaces; | |||||
use Interfaces; | |||||
with Interfaces.C; | |||||
use Interfaces.C; | |||||
with Interfaces.C.extensions; | |||||
use Interfaces.C.extensions; | |||||
with Ada.Text_IO; | |||||
with bcm2835_h; | with bcm2835_h; | ||||
use bcm2835_h; | |||||
with st7565lcd; | |||||
with Interfaces; use Interfaces; | |||||
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Streams.Stream_IO; | |||||
use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Streams.Stream_IO; | |||||
with Ada.Command_Line; use Ada.Command_Line; | |||||
package body st7565lcd is | |||||
procedure 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; | |||||
-- shorter names for packages | |||||
package IO renames Ada.Text_IO; | |||||
package LCD renames st7565lcd; | |||||
package IOS renames Ada.Streams.Stream_IO; | |||||
-- stream.io definitions | |||||
My_File : IOS.FILE_TYPE; | |||||
My_File_Access : IOS.STREAM_ACCESS; | |||||
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; | |||||
-- picture data | |||||
picture_header : LCD.t_bmp_header; | |||||
color_mask : LCD.t_color_mask; | |||||
picture_data : LCD.t_bmp_array (0 .. 128 * 64 - 1); | |||||
-- lcd pixel array | |||||
lcd_data : LCD.t_lcd_array; | |||||
-- display strings on the lcd at a given position | |||||
-- data is a string with any allowed range | |||||
-- for strings not beginning at 0 we have to decrement the index | |||||
-- variable for xpos by the value of the range begin, so we get | |||||
-- for xpos a range from (xpos + 0 .. xpos + number of char in string) | |||||
procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string) is | |||||
begin | |||||
for index in data'range loop | |||||
lcd_ascii57(xpos => xpos + (index - data'first) * 6, ypos => ypos, data => character'val(character'pos(data(index)))); | |||||
end loop; | |||||
end lcd_ascii57_string; | |||||
-- exception handling | |||||
tool_info : string := "raspi-lcd version 0.1, (c) 2014 by tmeissner"; | |||||
usage : string := "usage: ./raspitest BMP-FILE (as root)"; | |||||
bmp_error : string := "error: malformed BMP-FILE (valid: 128x64, no compression, 32bpp)"; | |||||
cli_exception : exception; | |||||
bmp_exception : exception; | |||||
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))(index), si => true); | |||||
end loop; | |||||
-- one free column between chars | |||||
lcd_transfer_data(value => 16#00#, si => true); | |||||
end lcd_ascii57; | |||||
begin | |||||
-- no picture given | |||||
if Argument_Count /= 1 then | |||||
raise cli_exception; | |||||
end if; | |||||
procedure lcd_picture (xpos : natural; ypos: natural; picture : t_lcd_array) is | |||||
-- open picture file | |||||
declare | |||||
filename : string := Argument (1); | |||||
begin | 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; | |||||
IOS.Open(My_File, In_File, filename); | |||||
My_File_Access := IOS.Stream(My_File); | |||||
end; | |||||
-- read bmp header | |||||
LCD.t_bmp_header'Read(My_File_Access, picture_header); | |||||
--Put_Line("Width: " & Integer'Image(picture_header.biWidth)); | |||||
--Put_Line("Height: " & Integer'Image(picture_header.biHeight)); | |||||
--Put_Line("Color Depth: " & Integer'Image(Integer(picture_header.biBitCount))); | |||||
--Put_Line("Compression: " & Integer'Image(Integer(picture_header.biCompression))); | |||||
-- check for valid bmp format | |||||
if (abs picture_header.biHeight /= 64 or picture_header.biWidth /= 128 or | |||||
(picture_header.biCompression /= 0 and picture_header.biCompression /= 3) or | |||||
picture_header.biBitCount /= 32) then | |||||
raise bmp_exception; | |||||
end if; | |||||
-- get color map if existing | |||||
if picture_header.biCompression = 3 then | |||||
LCD.t_color_mask'Read(My_File_Access, color_mask); | |||||
end if; | |||||
-- read in image data | |||||
if picture_header.biHeight < 0 then | |||||
-- top-down pixel matrix | |||||
for index in picture_data'range loop | |||||
if not IOS.End_Of_File(My_File) then | |||||
LCD.t_byte_array'Read(My_File_Access, picture_data(index)); | |||||
end if; | |||||
end loop; | end loop; | ||||
end lcd_picture; | |||||
else | |||||
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); | |||||
-- bottom-top pixel matrix | |||||
for row in reverse 0 .. 63 loop | |||||
for column in 0 .. 127 loop | |||||
if not IOS.End_Of_File(My_File) then | |||||
LCD.t_byte_array'Read(My_File_Access, picture_data(row * 128 + column)); | |||||
end if; | |||||
end loop; | end loop; | ||||
end loop; | end loop; | ||||
bcm2835_gpio_write(pin => LCD_CS, on => unsigned_char(HIGH)); | |||||
end lcd_clear; | |||||
end if; | |||||
-- close picture file | |||||
Ada.Streams.Stream_IO.Close(My_File); | |||||
-- convert bmp to lcd matrix | |||||
lcd_data := LCD.bmp_to_lcd(bmp => picture_data, color_mask => color_mask); | |||||
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; | |||||
-- load bcm2835 lib | |||||
-- print picture and some text on lcd | |||||
if integer(bcm2835_h.bcm2835_init) = 0 then | |||||
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; | |||||
IO.Put_Line("Error while initializing BCM2835 library"); | |||||
else | |||||
LCD.io_init; | |||||
LCD.lcd_init; | |||||
LCD.lcd_picture(xpos => 0, ypos => 0, picture => lcd_data); | |||||
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; | |||||
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"); | |||||
function bmp_to_lcd (bmp : t_bmp_array; color_mask : t_color_mask) return t_lcd_array is | |||||
lcd : t_lcd_array := (others => 16#00#); | |||||
logic : byte; | |||||
begin | |||||
for aussen in 0 .. 7 loop | |||||
logic := 16#01#; | |||||
for outdex in 0 .. 7 loop | |||||
for index in 0 .. 127 loop | |||||
if ((bmp(aussen * 1024 + outdex * 128 + index)(which_byte(color_mask.red)) or | |||||
bmp(aussen * 1024 + outdex * 128 + index)(which_byte(color_mask.green)) or | |||||
bmp(aussen * 1024 + outdex * 128 + index)(which_byte(color_mask.blue))) < 16#77#) then | |||||
lcd(aussen * 128 + index) := lcd(aussen * 128 + index) or logic; | |||||
end if; | |||||
end loop; | |||||
logic := Shift_Left(logic, 1); | |||||
end loop; | |||||
end loop; | |||||
return lcd; | |||||
end bmp_to_lcd; | |||||
-- close library | |||||
if integer(bcm2835_h.bcm2835_close) = 0 then | |||||
IO.Put_Line("Error while closing BCM2835 library"); | |||||
end if; | |||||
end if; | |||||
function which_byte (data : dword) return integer is | |||||
begin | |||||
case data is | |||||
when 16#000000FF# => | |||||
return 0; | |||||
when 16#0000FF00# => | |||||
return 1; | |||||
when 16#00FF0000# => | |||||
return 2; | |||||
when 16#FF000000# => | |||||
return 3; | |||||
when others => | |||||
return -1; | |||||
end case; | |||||
end which_byte; | |||||
end st7565lcd; | |||||
-- exception handling | |||||
exception | |||||
when e: cli_exception => | |||||
put_line(tool_info); | |||||
put_line(usage); | |||||
when e: bmp_exception => | |||||
put_line(tool_info); | |||||
put_line(bmp_error); | |||||
end raspilcd; |
@ -1,145 +0,0 @@ | |||||
with Ada.Text_IO; | |||||
with bcm2835_h; | |||||
with st7565lcd; | |||||
with Interfaces; use Interfaces; | |||||
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Streams.Stream_IO; | |||||
use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Streams.Stream_IO; | |||||
with Ada.Command_Line; use Ada.Command_Line; | |||||
procedure raspilcd is | |||||
-- shorter names for packages | |||||
package IO renames Ada.Text_IO; | |||||
package LCD renames st7565lcd; | |||||
package IOS renames Ada.Streams.Stream_IO; | |||||
-- stream.io definitions | |||||
My_File : IOS.FILE_TYPE; | |||||
My_File_Access : IOS.STREAM_ACCESS; | |||||
-- picture data | |||||
picture_header : LCD.t_bmp_header; | |||||
color_mask : LCD.t_color_mask; | |||||
picture_data : LCD.t_bmp_array (0 .. 128 * 64 - 1); | |||||
-- lcd pixel array | |||||
lcd_data : LCD.t_lcd_array; | |||||
-- exception handling | |||||
tool_info : string := "raspi-lcd version 0.1, (c) 2014 by tmeissner"; | |||||
usage : string := "usage: ./raspitest BMP-FILE (as root)"; | |||||
bmp_error : string := "error: malformed BMP-FILE (valid: 128x64, no compression, 32bpp)"; | |||||
cli_exception : exception; | |||||
bmp_exception : exception; | |||||
begin | |||||
-- no picture given | |||||
if Argument_Count /= 1 then | |||||
raise cli_exception; | |||||
end if; | |||||
-- open picture file | |||||
declare | |||||
filename : string := Argument (1); | |||||
begin | |||||
IOS.Open(My_File, In_File, filename); | |||||
My_File_Access := IOS.Stream(My_File); | |||||
end; | |||||
-- read bmp header | |||||
LCD.t_bmp_header'Read(My_File_Access, picture_header); | |||||
--Put_Line("Width: " & Integer'Image(picture_header.biWidth)); | |||||
--Put_Line("Height: " & Integer'Image(picture_header.biHeight)); | |||||
--Put_Line("Color Depth: " & Integer'Image(Integer(picture_header.biBitCount))); | |||||
--Put_Line("Compression: " & Integer'Image(Integer(picture_header.biCompression))); | |||||
-- check for valid bmp format | |||||
if (abs picture_header.biHeight /= 64 or picture_header.biWidth /= 128 or | |||||
(picture_header.biCompression /= 0 and picture_header.biCompression /= 3) or | |||||
picture_header.biBitCount /= 32) then | |||||
raise bmp_exception; | |||||
end if; | |||||
-- get color map if existing | |||||
if picture_header.biCompression = 3 then | |||||
LCD.t_color_mask'Read(My_File_Access, color_mask); | |||||
end if; | |||||
-- read in image data | |||||
if picture_header.biHeight < 0 then | |||||
-- top-down pixel matrix | |||||
for index in picture_data'range loop | |||||
if not IOS.End_Of_File(My_File) then | |||||
LCD.t_byte_array'Read(My_File_Access, picture_data(index)); | |||||
end if; | |||||
end loop; | |||||
else | |||||
-- bottom-top pixel matrix | |||||
for row in reverse 0 .. 63 loop | |||||
for column in 0 .. 127 loop | |||||
if not IOS.End_Of_File(My_File) then | |||||
LCD.t_byte_array'Read(My_File_Access, picture_data(row * 128 + column)); | |||||
end if; | |||||
end loop; | |||||
end loop; | |||||
end if; | |||||
-- close picture file | |||||
Ada.Streams.Stream_IO.Close(My_File); | |||||
-- convert bmp to lcd matrix | |||||
lcd_data := LCD.bmp_to_lcd(bmp => picture_data, color_mask => color_mask); | |||||
-- load bcm2835 lib | |||||
-- print picture and some text on lcd | |||||
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, picture => lcd_data); | |||||
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; | |||||
-- exception handling | |||||
exception | |||||
when e: cli_exception => | |||||
put_line(tool_info); | |||||
put_line(usage); | |||||
when e: bmp_exception => | |||||
put_line(tool_info); | |||||
put_line(bmp_error); | |||||
end raspilcd; |
@ -0,0 +1,175 @@ | |||||
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 st7565lcd 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; | |||||
-- display strings on the lcd at a given position | |||||
-- data is a string with any allowed range | |||||
-- for strings not beginning at 0 we have to decrement the index | |||||
-- variable for xpos by the value of the range begin, so we get | |||||
-- for xpos a range from (xpos + 0 .. xpos + number of char in string) | |||||
procedure lcd_ascii57_string (xpos : natural; ypos : natural; data : string) is | |||||
begin | |||||
for index in data'range loop | |||||
lcd_ascii57(xpos => xpos + (index - data'first) * 6, ypos => ypos, data => character'val(character'pos(data(index)))); | |||||
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))(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; picture : t_lcd_array) 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; | |||||
function bmp_to_lcd (bmp : t_bmp_array; color_mask : t_color_mask) return t_lcd_array is | |||||
lcd : t_lcd_array := (others => 16#00#); | |||||
logic : byte; | |||||
begin | |||||
for aussen in 0 .. 7 loop | |||||
logic := 16#01#; | |||||
for outdex in 0 .. 7 loop | |||||
for index in 0 .. 127 loop | |||||
if ((bmp(aussen * 1024 + outdex * 128 + index)(which_byte(color_mask.red)) or | |||||
bmp(aussen * 1024 + outdex * 128 + index)(which_byte(color_mask.green)) or | |||||
bmp(aussen * 1024 + outdex * 128 + index)(which_byte(color_mask.blue))) < 16#77#) then | |||||
lcd(aussen * 128 + index) := lcd(aussen * 128 + index) or logic; | |||||
end if; | |||||
end loop; | |||||
logic := Shift_Left(logic, 1); | |||||
end loop; | |||||
end loop; | |||||
return lcd; | |||||
end bmp_to_lcd; | |||||
function which_byte (data : dword) return integer is | |||||
begin | |||||
case data is | |||||
when 16#000000FF# => | |||||
return 0; | |||||
when 16#0000FF00# => | |||||
return 1; | |||||
when 16#00FF0000# => | |||||
return 2; | |||||
when 16#FF000000# => | |||||
return 3; | |||||
when others => | |||||
return -1; | |||||
end case; | |||||
end which_byte; | |||||
end st7565lcd; |