-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into CDAP_Protobuf
- Loading branch information
Showing
13 changed files
with
178 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
with Bitmapped_Drawing; | ||
with HAL.Bitmap; | ||
with STM32.Board; | ||
with STM32.RNG.Interrupts; | ||
|
||
|
||
package body GUI is | ||
pragma Warnings (Off); | ||
|
||
CONSOLE_STARTING_POINT : HAL.Bitmap.Point := (0, 100); | ||
CURRENT_CONSOLE_POSITION : HAL.Bitmap.Point := (0, 100); | ||
FONT_HEIGHT : Natural := BMP_Fonts.Char_Height(Font => Large_Font); | ||
|
||
|
||
function Scale (Point : in HAL.Bitmap.Point) return HAL.Bitmap.Point; | ||
|
||
function Scale (Point : in HAL.Bitmap.Point) return HAL.Bitmap.Point is | ||
begin | ||
if STM32.Board.LCD_Natural_Width > 480 then | ||
return (Point.X * 800 / 480, Point.Y * 480 / 272); | ||
else | ||
return Point; | ||
end if; | ||
end Scale; | ||
|
||
procedure Print (X : in Natural; Y : in Natural; Msg : in String) is | ||
begin | ||
Bitmapped_Drawing.Draw_String (Buffer => STM32.Board.Display.Hidden_Buffer (1).all, | ||
Start => Scale ((X,Y)), | ||
Msg => Msg, | ||
Font => Large_Font, | ||
Foreground => Foreground, | ||
Background => Background); | ||
end Print; | ||
|
||
procedure Initialize (Title : in String) is | ||
begin | ||
STM32.RNG.Interrupts.Initialize_RNG; | ||
STM32.Board.Display.Initialize; | ||
STM32.Board.Display.Initialize_Layer (1, HAL.Bitmap.ARGB_1555); | ||
Print(0, 0, Title); | ||
end Initialize; | ||
|
||
-- Probably a cleaner way to do this | ||
procedure PrintToConsole(Msg : in String) is | ||
currentLine : Natural := (CURRENT_CONSOLE_POSITION.Y - 100) / FONT_HEIGHT; -- zero indexed | ||
begin | ||
if currentLine = 14 then --make dynamic | ||
declare | ||
iterator : Integer := 1; | ||
begin | ||
while iterator < 13 loop --make dynamic | ||
CopyLine(iterator, iterator - 1, false); | ||
iterator := iterator + 1; | ||
end loop; | ||
CopyLine(13, 12, True); --make dynamic | ||
end; | ||
CURRENT_CONSOLE_POSITION.Y := CURRENT_CONSOLE_POSITION.Y - FONT_HEIGHT; | ||
Print(CURRENT_CONSOLE_POSITION.X, CURRENT_CONSOLE_POSITION.Y, Msg); | ||
CURRENT_CONSOLE_POSITION.Y := CURRENT_CONSOLE_POSITION.Y + FONT_HEIGHT; | ||
|
||
else | ||
Print(CURRENT_CONSOLE_POSITION.X, CURRENT_CONSOLE_POSITION.Y, Msg); | ||
CURRENT_CONSOLE_POSITION.Y := CURRENT_CONSOLE_POSITION.Y + FONT_HEIGHT; | ||
end if; | ||
|
||
STM32.Board.Display.Update_Layer(1, True); | ||
end PrintToConsole; | ||
|
||
|
||
procedure CopyLine(SrcLineNumber : in Natural; DstLineNumer : in Natural; DeleteSrc : in Boolean) is | ||
srcToPoint : HAL.Bitmap.Point := (0, (CONSOLE_STARTING_POINT.Y + (FONT_HEIGHT * SrcLineNumber))); | ||
dstToPoint : HAL.Bitmap.Point := (0, (CONSOLE_STARTING_POINT.Y + (FONT_HEIGHT * DstLineNumer))); | ||
srcRect : HAL.Bitmap.Rect := (Position => srcToPoint, Width => 480, Height => FONT_HEIGHT); -- dont hardcode 480 | ||
begin | ||
HAL.Bitmap.Copy_Rect(Src_Buffer => STM32.Board.Display.Hidden_Buffer (1).all, Src_Pt => srcToPoint, Dst_Buffer => STM32.Board.Display.Hidden_Buffer (1).all, Dst_Pt => dstToPoint, Width => 480, Height => FONT_HEIGHT, Synchronous => True); | ||
if DeleteSrc then | ||
HAL.Bitmap.Fill_Rect(Buffer => STM32.Board.Display.Hidden_Buffer (1).all, Area => srcRect); | ||
end if; | ||
STM32.Board.Display.Update_Layer(1, True); | ||
end CopyLine; | ||
|
||
|
||
end GUI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
with BMP_Fonts; | ||
with HAL.Bitmap; | ||
package GUI is | ||
pragma Warnings(Off); | ||
|
||
Large_Font : BMP_Fonts.BMP_Font := BMP_Fonts.Font12x12; | ||
Foreground : HAL.Bitmap.Bitmap_Color := HAL.Bitmap.White; | ||
Background : HAL.Bitmap.Bitmap_Color := HAL.Bitmap.Black; | ||
|
||
procedure Print (X : in Natural; Y : in Natural; Msg : in String); | ||
|
||
procedure Initialize (Title : in String); | ||
|
||
procedure PrintToConsole(Msg : in String); | ||
|
||
procedure CopyLine(SrcLineNumber : in Natural; DstLineNumer : in Natural; DeleteSrc : in Boolean); | ||
end GUI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters