Skip to content

Commit

Permalink
Add GUI.ScreenBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
masonticehurst committed Feb 10, 2024
1 parent e5bc72b commit aaa506c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
11 changes: 6 additions & 5 deletions eRINA_STM32F7/src/rina/debug.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
with Bitmapped_Drawing;
with STM32.Board;
with GUI;

package body Debug is

Expand Down Expand Up @@ -32,7 +33,7 @@ package body Debug is

-- Draw debug prefix
Bitmapped_Drawing.Draw_String
(Buffer => STM32.Board.Display.Hidden_Buffer (1).all,
(Buffer => GUI.ScreenBuffer.all,
Start =>
GUI.Scale
((CURRENT_CONSOLE_POSITION.X, CURRENT_CONSOLE_POSITION.Y)),
Expand All @@ -41,7 +42,7 @@ package body Debug is

-- Draw actual message text
Bitmapped_Drawing.Draw_String
(Buffer => STM32.Board.Display.Hidden_Buffer (1).all,
(Buffer => GUI.ScreenBuffer.all,
Start =>
GUI.Scale
((CURRENT_CONSOLE_POSITION.X +
Expand Down Expand Up @@ -72,14 +73,14 @@ package body Debug is
Height => FONT_HEIGHT);
begin
HAL.Bitmap.Copy_Rect
(Src_Buffer => STM32.Board.Display.Hidden_Buffer (1).all,
(Src_Buffer => GUI.ScreenBuffer.all,
Src_Pt => srcToPoint,
Dst_Buffer => STM32.Board.Display.Hidden_Buffer (1).all,
Dst_Buffer => GUI.ScreenBuffer.all,
Dst_Pt => dstToPoint, Width => GUI.Board_Resolution.Width,
Height => FONT_HEIGHT, Synchronous => True);
if DeleteSrc then
HAL.Bitmap.Fill_Rect
(Buffer => STM32.Board.Display.Hidden_Buffer (1).all,
(Buffer => GUI.ScreenBuffer.all,
Area => srcRect);
end if;
STM32.Board.Display.Update_Layer (1, True);
Expand Down
1 change: 0 additions & 1 deletion eRINA_STM32F7/src/rina/debug.ads
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
with HAL.Bitmap;
with BMP_Fonts;
with GUI;

package Debug is
type Debug is (Error, Warning, Info);
Expand Down
10 changes: 7 additions & 3 deletions eRINA_STM32F7/src/rina/gui.adb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
with Bitmapped_Drawing;
with HAL.Bitmap;
with STM32.Board;
with STM32.RNG.Interrupts;

package body GUI is

function ScreenBuffer return HAL.Bitmap.Any_Bitmap_Buffer is
begin
return STM32.Board.Display.Hidden_Buffer (1);
end ScreenBuffer;

function Scale (Point : in HAL.Bitmap.Point) return HAL.Bitmap.Point is
begin
if STM32.Board.LCD_Natural_Width > Board_Resolution.Width then
Expand All @@ -17,7 +21,7 @@ package body GUI is
procedure Print (Msg : in String; Pos : in HAL.Bitmap.Point) is
begin
Bitmapped_Drawing.Draw_String
(Buffer => STM32.Board.Display.Hidden_Buffer (1).all,
(Buffer => ScreenBuffer.all,
Start => Scale ((Pos.X, Pos.Y)),
Msg => Msg,
Font => BMP_Fonts.Font8x8,
Expand All @@ -28,7 +32,7 @@ package body GUI is
end Print;

procedure Initialize (Title : in String) is
Title_Location : HAL.Bitmap.Point := (80, 10);
Title_Location : constant HAL.Bitmap.Point := (80, 10);
begin
STM32.RNG.Interrupts.Initialize_RNG;
STM32.Board.Display.Initialize;
Expand Down
4 changes: 1 addition & 3 deletions eRINA_STM32F7/src/rina/gui.ads
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
with BMP_Fonts;
with HAL.Bitmap;
with STM32.Board;

package GUI is
pragma Warnings (Off);
Expand All @@ -16,8 +15,7 @@ package GUI is

Board_Resolution : Size := (480, 272);

Screen_Buffer : HAL.Bitmap.Any_Bitmap_Buffer renames STM32.Board.Display.Hidden_Buffer (1);

function ScreenBuffer return HAL.Bitmap.Any_Bitmap_Buffer;
procedure Initialize (Title : in String);
procedure Print (Msg : in String; Pos : in HAL.Bitmap.Point);

Expand Down
4 changes: 2 additions & 2 deletions eRINA_STM32F7/src/rina/textures.adb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package body Textures is
begin
for Row in 0 .. Textures.Texture_Height - 1 loop
for Column in 0 .. Textures.Texture_Width - 1 loop
GUI.Screen_Buffer.Set_Source
GUI.ScreenBuffer.Set_Source
(Bitmap_Color_Conversion.Word_To_Bitmap_Color
(HAL.Bitmap.ARGB_1555, HAL.UInt32 (T (Row) (Column))));
GUI.Screen_Buffer.Set_Pixel
GUI.ScreenBuffer.Set_Pixel
((Pos.X + Row, Pos.Y + Column));
end loop;
end loop;
Expand Down

0 comments on commit aaa506c

Please sign in to comment.