* GPIO is so often used so it is good to have short name for it. GPIO is ok.

This commit is contained in:
Vovanium 2024-01-23 15:10:16 +03:00
parent cdbe7b2c3f
commit 0535fd3f68
11 changed files with 40 additions and 40 deletions

View File

@ -1,5 +1,5 @@
with STM32.General_Purpose_IOs, STM32.Reset_and_Clock;
use STM32.General_Purpose_IOs, STM32.Reset_and_Clock;
with STM32.GPIO, STM32.Reset_and_Clock;
use STM32.GPIO, STM32.Reset_and_Clock;
package Board is

View File

@ -8,8 +8,8 @@ with ILI9341;
with Interfaces;
with STM32.General_Purpose_IOs.Ports;
use STM32.General_Purpose_IOs.Ports;
with STM32.GPIO.Ports;
use STM32.GPIO.Ports;
package body Board.LCD.SPI_IO is
package CSX is new GPIO_Port_Boolean (LCD.CSX_Port, LCD.CSX_Bit);

View File

@ -19,8 +19,7 @@ package Board.LCD is
SDA_Bit : constant Port_Bit_Number := 9;
SPI_Module : STM32.SPIs.SPI_Registers renames SPI5;
SPI_AF : STM32.General_Purpose_IOs.Alternate_Function
renames STM32.General_Purpose_IOs.Alternate_Functions.SPI5;
SPI_AF : STM32.GPIO.Alternate_Function renames STM32.GPIO.Alternate_Functions.SPI5;
SPI_RCC_EN : Boolean renames RCC.APB2ENR (Index.SPI5);
SPI_RCC_RST : Boolean renames RCC.APB2RSTR (Index.SPI5);

View File

@ -1,5 +1,5 @@
with STM32.General_Purpose_IOs, STM32.Reset_and_Clock;
use STM32.General_Purpose_IOs, STM32.Reset_and_Clock;
with STM32.GPIO, STM32.Reset_and_Clock;
use STM32.GPIO, STM32.Reset_and_Clock;
package Board is

View File

@ -1,5 +1,5 @@
with STM32.General_Purpose_IOs.Ports;
use STM32.General_Purpose_IOs.Ports;
with STM32.GPIO.Ports;
use STM32.GPIO.Ports;
with STM32.USARTs;
use STM32.USARTs;

View File

@ -1,9 +1,10 @@
with Board; use Board;
with STM32.Reset_and_Clock; use STM32.Reset_and_Clock;
with STM32.General_Purpose_IOs; use STM32.General_Purpose_IOs;
with STM32.General_Purpose_IOs.Ports; use STM32.General_Purpose_IOs.Ports;
with Ada.Real_Time; use Ada.Real_Time;
with STM32.Reset_and_Clock; use STM32.Reset_and_Clock;
with STM32.GPIO.Ports;
use STM32.GPIO.Ports, STM32.GPIO;
with Ada.Real_Time; use Ada.Real_Time;
procedure LED_Flasher is
Period: constant Time_Span := Milliseconds(250);

View File

@ -1,5 +1,5 @@
with STM32.General_Purpose_IOs.Ports;
use STM32.General_Purpose_IOs.Ports;
with STM32.GPIO.Ports;
use STM32.GPIO.Ports;
with Board; use Board;
with Board.UART.IO;
with Board.Memory; -- SDRAM initialization is here!
@ -71,19 +71,19 @@ begin
LED_RCC_EN := True;
LED.Set_MODER (STM32.General_Purpose_IOs.Output_Mode);
LED.Set_OTYPER (STM32.General_Purpose_IOs.Push_Pull_Type);
LED.Set_OSPEEDR (STM32.General_Purpose_IOs.Very_High_Speed);
LED.Set_PUPDR (STM32.General_Purpose_IOs.No_Pull);
LED.Set_MODER (STM32.GPIO.Output_Mode);
LED.Set_OTYPER (STM32.GPIO.Push_Pull_Type);
LED.Set_OSPEEDR (STM32.GPIO.Very_High_Speed);
LED.Set_PUPDR (STM32.GPIO.No_Pull);
LED.Set (not LED_On);
LED_2_RCC_EN := True;
LED_2.Set_MODER (STM32.General_Purpose_IOs.Output_Mode);
LED_2.Set_OTYPER (STM32.General_Purpose_IOs.Push_Pull_Type);
LED_2.Set_OSPEEDR (STM32.General_Purpose_IOs.Very_High_Speed);
LED_2.Set_PUPDR (STM32.General_Purpose_IOs.No_Pull);
LED_2.Set_MODER (STM32.GPIO.Output_Mode);
LED_2.Set_OTYPER (STM32.GPIO.Push_Pull_Type);
LED_2.Set_OSPEEDR (STM32.GPIO.Very_High_Speed);
LED_2.Set_PUPDR (STM32.GPIO.No_Pull);
LED_2.Set (not LED_2_On);

View File

@ -2,8 +2,8 @@ with Ada.Real_Time; use Ada.Real_Time;
with Board.LCD.SPI_IO;
use Board;
with STM32.General_Purpose_IOs.Ports;
use STM32.General_Purpose_IOs.Ports;
with STM32.GPIO.Ports;
use STM32.GPIO.Ports;
procedure SPI_LCD is
package LED is new GPIO_Port_Boolean(LED_Port, LED_Bit);
@ -24,19 +24,19 @@ begin
-- LED to see what's happen
LED_RCC_EN := True;
LED.Set_MODER (STM32.General_Purpose_IOs.Output_Mode);
LED.Set_OTYPER (STM32.General_Purpose_IOs.Push_Pull_Type);
LED.Set_OSPEEDR (STM32.General_Purpose_IOs.Very_High_Speed);
LED.Set_PUPDR (STM32.General_Purpose_IOs.No_Pull);
LED.Set_MODER (STM32.GPIO.Output_Mode);
LED.Set_OTYPER (STM32.GPIO.Push_Pull_Type);
LED.Set_OSPEEDR (STM32.GPIO.Very_High_Speed);
LED.Set_PUPDR (STM32.GPIO.No_Pull);
LED.Set (not LED_On);
LED_2_RCC_EN := True;
LED_2.Set_MODER (STM32.General_Purpose_IOs.Output_Mode);
LED_2.Set_OTYPER (STM32.General_Purpose_IOs.Push_Pull_Type);
LED_2.Set_OSPEEDR (STM32.General_Purpose_IOs.Very_High_Speed);
LED_2.Set_PUPDR (STM32.General_Purpose_IOs.No_Pull);
LED_2.Set_MODER (STM32.GPIO.Output_Mode);
LED_2.Set_OTYPER (STM32.GPIO.Push_Pull_Type);
LED_2.Set_OSPEEDR (STM32.GPIO.Very_High_Speed);
LED_2.Set_PUPDR (STM32.GPIO.No_Pull);
LED_2.Set (not LED_2_On);

View File

@ -1,4 +1,4 @@
package body STM32.General_Purpose_IOs.Ports is
package body STM32.GPIO.Ports is
package body GPIO_Port_Boolean is
@ -111,4 +111,4 @@ package body STM32.General_Purpose_IOs.Ports is
end;
end GPIO_Port_Modular;
end STM32.General_Purpose_IOs.Ports;
end STM32.GPIO.Ports;

View File

@ -1,4 +1,4 @@
package STM32.General_Purpose_IOs.Ports is
package STM32.GPIO.Ports is
-- Single GPIO pin
generic
@ -34,4 +34,4 @@ package STM32.General_Purpose_IOs.Ports is
procedure Set_AFR (Value : Alternate_Function) with Inline;
end GPIO_Port_Modular;
end STM32.General_Purpose_IOs.Ports;
end STM32.GPIO.Ports;

View File

@ -2,7 +2,7 @@ with STM32.Address_Map;
-- General Purpose IO and Pin Function Mapping
package STM32.General_Purpose_IOs is
package STM32.GPIO is
subtype Port_Bit_Number is Natural range 0 .. 15;
@ -210,4 +210,4 @@ package STM32.General_Purpose_IOs is
GPIOJ : aliased GPIO_Registers with Volatile, Import, Address => Address_Map.GPIOJ;
GPIOK : aliased GPIO_Registers with Volatile, Import, Address => Address_Map.GPIOK;
end STM32.General_Purpose_IOs;
end STM32.GPIO;