>< rename packages LTDS to LCD_TFT_Controller (reducing name clashes)

This commit is contained in:
Vovanium 2024-01-18 17:58:06 +03:00
parent df175cd543
commit f51f3d8034
5 changed files with 60 additions and 59 deletions

View File

@ -1,7 +1,7 @@
with STM32.LTDC;
use STM32.LTDC;
with Chip.LTDC;
use Chip.LTDC;
with STM32.LCD_TFT_Controller;
use STM32.LCD_TFT_Controller;
with Chip.LCD_TFT_Controller;
use Chip.LCD_TFT_Controller;
with Board.Frequencies;
package body Board.LCD.Controller is
@ -147,36 +147,36 @@ package body Board.LCD.Controller is
procedure Initialize_Timings is
begin
declare
R : Frame_Configuration_Register := LTDC_HW.SSCR;
R : Frame_Configuration_Register := LTDC.SSCR;
begin
R.VH := 2 - 1;
R.HW := 10 - 1;
LTDC_HW.SSCR := R;
LTDC.SSCR := R;
R := LTDC_HW.BPCR;
R := LTDC.BPCR;
R.VH := 4 - 1;
R.HW := 30 - 1;
LTDC_HW.BPCR := R;
LTDC.BPCR := R;
R := LTDC_HW.AWCR;
R := LTDC.AWCR;
R.VH := 324 - 1;
R.HW := 270 - 1;
LTDC_HW.AWCR := R;
LTDC.AWCR := R;
R := LTDC_HW.TWCR;
R := LTDC.TWCR;
R.VH := 328 - 1;
R.HW := 280 - 1;
LTDC_HW.TWCR := R;
LTDC.TWCR := R;
end;
declare
R : Global_Control_Register := LTDC_HW.GCR;
R : Global_Control_Register := LTDC.GCR;
begin
R.PCPOL := True_Polarity;
R.DEPOL := Active_Low;
R.VSPOL := Active_Low;
R.HSPOL := Active_Low;
LTDC_HW.GCR := R;
LTDC.GCR := R;
end;
end Initialize_Timings;
@ -199,25 +199,25 @@ package body Board.LCD.Controller is
-- Configure the background color
declare
R : Color_Register := LTDC_HW.BCCR;
R : Color_Register := LTDC.BCCR;
begin
R.R := 16#AA#;
R.G := 16#AA#;
R.B := 16#55#;
LTDC_HW.BCCR := R;
LTDC.BCCR := R;
end;
-- Configure the needed interrupts
-- Configure the Layer 1/2 parameters
-- Enable Layer 1/2 and the CLUT
-- Dithering and color keying
-- Reload the shadow registers to active register
LTDC_HW.SRCR := (IMR => True, others => <>);
LTDC.SRCR := (IMR => True, others => <>);
-- Enable LCD-TFT controller in the LTDC_GCR
declare
R : Global_Control_Register := LTDC_HW.GCR;
R : Global_Control_Register := LTDC.GCR;
begin
R.LTDCEN := True;
LTDC_HW.GCR := R;
LTDC.GCR := R;
end;
-- All layer parameters may be modified...
end Initialize;
@ -225,14 +225,14 @@ package body Board.LCD.Controller is
procedure Set_Background (R, G, B : Integer) is
begin
declare
C : Color_Register := LTDC_HW.BCCR;
C : Color_Register := LTDC.BCCR;
begin
C.R := R;
C.G := G;
C.B := B;
LTDC_HW.BCCR := C;
LTDC.BCCR := C;
end;
LTDC_HW.SRCR := (IMR => True, others => <>);
LTDC.SRCR := (IMR => True, others => <>);
end;
begin
Initialize;

View File

@ -1,8 +1,9 @@
with Chip.LTDC;
with Chip.LCD_TFT_Controller;
use Chip.LCD_TFT_Controller;
with STM32.Graphics;
with STM32.LTDC;
use STM32.LTDC;
with STM32.LCD_TFT_Controller;
use STM32.LCD_TFT_Controller;
with System.Storage_Elements;
use type System.Storage_Elements.Storage_Offset;
@ -16,67 +17,67 @@ procedure Init_Layer (Frame : access Pixel_Array) is
begin
declare
R : Layer_Horizontal_Position_Register := Chip.LTDC.LTDC_HW.L (1).WHPCR;
Offset : constant Integer := Chip.LTDC.LTDC_HW.BPCR.HW + 1;
R : Layer_Horizontal_Position_Register := LTDC.L (1).WHPCR;
Offset : constant Integer := LTDC.BPCR.HW + 1;
begin
R.WHSTPOS := 0 + Offset;
R.WHSPPOS := 240 + Offset - 1;
Chip.LTDC.LTDC_HW.L (1).WHPCR := R;
LTDC.L (1).WHPCR := R;
end;
declare
R : Layer_Vertical_Position_Register := Chip.LTDC.LTDC_HW.L (1).WVPCR;
Offset : constant Integer := Chip.LTDC.LTDC_HW.BPCR.VH + 1;
R : Layer_Vertical_Position_Register := LTDC.L (1).WVPCR;
Offset : constant Integer := LTDC.BPCR.VH + 1;
begin
R.WVSTPOS := 0 + Offset;
R.WVSPPOS := 320 + Offset - 1;
Chip.LTDC.LTDC_HW.L (1).WVPCR := R;
LTDC.L (1).WVPCR := R;
end;
declare
R : Pixel_Format_Configuration_Register := Chip.LTDC.LTDC_HW.L (1).PFCR;
R : Pixel_Format_Configuration_Register := LTDC.L (1).PFCR;
begin
R.PF := STM32.Graphics.RGB888;
Chip.LTDC.LTDC_HW.L (1).PFCR := R;
LTDC.L (1).PFCR := R;
end;
declare
C : Color_Register := Chip.LTDC.LTDC_HW.L (1).DCCR;
C : Color_Register := LTDC.L (1).DCCR;
begin
C.R := 128;
C.G := 0;
C.B := 128;
Chip.LTDC.LTDC_HW.L (1).DCCR := C;
LTDC.L (1).DCCR := C;
end;
Chip.LTDC.LTDC_HW.L (1).CACR := 255;
LTDC.L (1).CACR := 255;
declare
R : Layer_Blending_Factors_Config_Register := Chip.LTDC.LTDC_HW.L (1).BFCR;
R : Layer_Blending_Factors_Config_Register := LTDC.L (1).BFCR;
begin
R.BF1 := Constant_Alpha;
R.BF2 := One_Minus_Constant_Alpha;
Chip.LTDC.LTDC_HW.L (1).BFCR := R;
LTDC.L (1).BFCR := R;
end;
Chip.LTDC.LTDC_HW.L (1).CFBAR := Frame (0, 0)'Address;
LTDC.L (1).CFBAR := Frame (0, 0)'Address;
declare
R : Layer_Buffer_Length_Register := Chip.LTDC.LTDC_HW.L (1).CFBLR;
R : Layer_Buffer_Length_Register := LTDC.L (1).CFBLR;
begin
R.CFBP := Integer (Frame (1, 0)'Address - Frame (0, 0)'Address);
R.CFBLL := 240 * 3 + 3;
Chip.LTDC.LTDC_HW.L (1).CFBLR := R;
LTDC.L (1).CFBLR := R;
end;
Chip.LTDC.LTDC_HW.L (1).CFBLNR := 320;
LTDC.L (1).CFBLNR := 320;
declare
R : Layer_Control_Register := Chip.LTDC.LTDC_HW.L (1).CR;
R : Layer_Control_Register := LTDC.L (1).CR;
begin
R.LEN := True;
Chip.LTDC.LTDC_HW.L (1).CR := R;
LTDC.L (1).CR := R;
end;
Chip.LTDC.LTDC_HW.SRCR := (IMR => True, others => <>);
LTDC.SRCR := (IMR => True, others => <>);
end Init_Layer;

View File

@ -0,0 +1,12 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.LCD_TFT_Controller;
package STM32.F429.LCD_TFT_Controller is
package LTDC_Base renames STM32.LCD_TFT_Controller;
LTDC : LTDC_Base.LTDC_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.LTDC);
end STM32.F429.LCD_TFT_Controller;

View File

@ -1,12 +0,0 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.LTDC;
package STM32.F429.LTDC is
package Base renames STM32.LTDC;
LTDC_HW : Base.LTDC_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.LTDC);
end STM32.F429.LTDC;

View File

@ -1,6 +1,6 @@
with STM32.Graphics;
use STM32.Graphics;
package STM32.LTDC with Pure is
package STM32.LCD_TFT_Controller with Pure is
type Frame_Configuration_Register is record
VH : Integer range 0 .. 2**11 - 1;
@ -302,4 +302,4 @@ package STM32.LTDC with Pure is
L at 16#0080# range 0 .. 2 * 8 * 16#80# - 1;
end record;
end STM32.LTDC;
end STM32.LCD_TFT_Controller;