Skip to content

Commit

Permalink
compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
stangassinger committed Mar 28, 2020
1 parent 2dfe65f commit 8d497ff
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 71 deletions.
4 changes: 2 additions & 2 deletions example/src/blinky.adb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
with Driver; pragma Unreferenced (Driver);
-- with Driver; pragma Unreferenced (Driver);
-- The Driver package contains the task that actually controls the app so
-- although it is not referenced directly in the main procedure, we need it
-- in the closure of the context clauses so that it will be included in the
Expand All @@ -22,7 +22,7 @@ begin
STM32.Board.Initialize_LEDs;
-- Ada.Text_IO.Put_Line ("xxxxxxxxx");
loop
-- Toggle (All_LEDs);
STM32.Board.Toggle ( STM32.Board.Green_LED);
-- Ada.Text_IO.Put_Line ("bbbbbb");
Ada.Text_IO.Put_Line ("Y: " & Integer'Image (count));
count := count + 1;
Expand Down
2 changes: 1 addition & 1 deletion example/src/stm32-board.ads
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package STM32.Board is

-- procedure Turn_On (This : in out User_LED) renames STM32.GPIO.Set;
-- procedure Turn_Off (This : in out User_LED) renames STM32.GPIO.Clear;
-- procedure Toggle (This : in out User_LED) renames STM32.GPIO.Toggle;
procedure Toggle (This : in out User_LED) renames STM32.GPIO.Toggle;
--
-- procedure All_LEDs_Off with Inline;
-- procedure All_LEDs_On with Inline;
Expand Down
124 changes: 62 additions & 62 deletions example/src/stm32-gpio.adb
Original file line number Diff line number Diff line change
Expand Up @@ -354,41 +354,41 @@ package body STM32.GPIO is
-- Configure_IO --
------------------

procedure Configure_IO
(This : GPIO_Point;
Config : GPIO_Port_Configuration)
is
Index : constant GPIO_Pin_Index := GPIO_Pin'Pos (This.Pin);
begin
This.Periph.MODER.Arr (Index) := Pin_IO_Modes'Enum_Rep (Config.Mode);
This.Periph.PUPDR.Arr (Index) := Internal_Pin_Resistors'Enum_Rep (Config.Resistors);

case Config.Mode is
when Mode_In | Mode_Analog =>
null;
when Mode_Out =>
This.Periph.OTYPER.OT.Arr (Index) := Config.Output_Type = Open_Drain;
This.Periph.OSPEEDR.Arr (Index) := Pin_Output_Speeds'Enum_Rep (Config.Speed);
when Mode_AF =>
This.Periph.OTYPER.OT.Arr (Index) := Config.AF_Output_Type = Open_Drain;
This.Periph.OSPEEDR.Arr (Index) := Pin_Output_Speeds'Enum_Rep (Config.AF_Speed);
Configure_Alternate_Function (This, Config.AF);
end case;
end Configure_IO;
-- procedure Configure_IO
-- (This : GPIO_Point;
-- Config : GPIO_Port_Configuration)
-- is
-- Index : constant GPIO_Pin_Index := GPIO_Pin'Pos (This.Pin);
-- begin
-- This.Periph.MODER.Arr (Index) := Pin_IO_Modes'Enum_Rep (Config.Mode);
-- This.Periph.PUPDR.Arr (Index) := Internal_Pin_Resistors'Enum_Rep (Config.Resistors);
--
-- case Config.Mode is
-- when Mode_In | Mode_Analog =>
-- null;
-- when Mode_Out =>
-- This.Periph.OTYPER.OT.Arr (Index) := Config.Output_Type = Open_Drain;
-- This.Periph.OSPEEDR.Arr (Index) := Pin_Output_Speeds'Enum_Rep (Config.Speed);
-- when Mode_AF =>
-- This.Periph.OTYPER.OT.Arr (Index) := Config.AF_Output_Type = Open_Drain;
-- This.Periph.OSPEEDR.Arr (Index) := Pin_Output_Speeds'Enum_Rep (Config.AF_Speed);
-- Configure_Alternate_Function (This, Config.AF);
-- end case;
-- end Configure_IO;

------------------
-- Configure_IO --
------------------

procedure Configure_IO
(Points : GPIO_Points;
Config : GPIO_Port_Configuration)
is
begin
for Point of Points loop
Point.Configure_IO (Config);
end loop;
end Configure_IO;
-- procedure Configure_IO
-- (Points : GPIO_Points;
-- Config : GPIO_Port_Configuration)
-- is
-- begin
-- for Point of Points loop
-- Point.Configure_IO (Config);
-- end loop;
-- end Configure_IO;

----------------------------------
-- Configure_Alternate_Function --
Expand Down Expand Up @@ -425,47 +425,47 @@ package body STM32.GPIO is
-- Interrupt_Line_Number --
---------------------------

function Interrupt_Line_Number
(This : GPIO_Point) return EXTI.External_Line_Number
is
begin
return EXTI.External_Line_Number'Val (GPIO_Pin'Pos (This.Pin));
end Interrupt_Line_Number;
-- function Interrupt_Line_Number
-- (This : GPIO_Point) return EXTI.External_Line_Number
-- is
-- begin
-- return EXTI.External_Line_Number'Val (GPIO_Pin'Pos (This.Pin));
-- end Interrupt_Line_Number;

-----------------------
-- Configure_Trigger --
-----------------------

procedure Configure_Trigger
(This : GPIO_Point;
Trigger : EXTI.External_Triggers)
is
use STM32.EXTI;
Line : constant External_Line_Number := External_Line_Number'Val (GPIO_Pin'Pos (This.Pin));
use STM32.SYSCFG, STM32.RCC;
begin
SYSCFG_Clock_Enable;

Connect_External_Interrupt (This);
if Trigger in Interrupt_Triggers then
Enable_External_Interrupt (Line, Trigger);
else
Enable_External_Event (Line, Trigger);
end if;
end Configure_Trigger;
-- procedure Configure_Trigger
-- (This : GPIO_Point;
-- Trigger : EXTI.External_Triggers)
-- is
-- use STM32.EXTI;
-- Line : constant External_Line_Number := External_Line_Number'Val (GPIO_Pin'Pos (This.Pin));
-- use STM32.SYSCFG, STM32.RCC;
-- begin
-- SYSCFG_Clock_Enable;
--
-- Connect_External_Interrupt (This);
-- if Trigger in Interrupt_Triggers then
-- Enable_External_Interrupt (Line, Trigger);
-- else
-- Enable_External_Event (Line, Trigger);
-- end if;
-- end Configure_Trigger;

-----------------------
-- Configure_Trigger --
-----------------------

procedure Configure_Trigger
(Points : GPIO_Points;
Trigger : EXTI.External_Triggers)
is
begin
for Point of Points loop
Point.Configure_Trigger (Trigger);
end loop;
end Configure_Trigger;
-- procedure Configure_Trigger
-- (Points : GPIO_Points;
-- Trigger : EXTI.External_Triggers)
-- is
-- begin
-- for Point of Points loop
-- Point.Configure_Trigger (Trigger);
-- end loop;
-- end Configure_Trigger;

end STM32.GPIO;
12 changes: 6 additions & 6 deletions example/src/stm32-gpio.ads
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ package STM32.GPIO is
function Locked (This : GPIO_Point) return Boolean
with Inline;

procedure Configure_IO
(This : GPIO_Point;
Config : GPIO_Port_Configuration);
-- procedure Configure_IO
-- (This : GPIO_Point;
-- Config : GPIO_Port_Configuration);
-- For Point.Pin on the Point.Port.all, configures the
-- characteristics specified by Config

Expand Down Expand Up @@ -264,9 +264,9 @@ package STM32.GPIO is
-- For the given GPIO port, locks the current configuration of Pin until
-- the MCU is reset.

procedure Configure_IO
(Points : GPIO_Points;
Config : GPIO_Port_Configuration);
-- procedure Configure_IO
-- (Points : GPIO_Points;
-- Config : GPIO_Port_Configuration);
-- For Point.Pin on the Point.Port.all, configures the
-- characteristics specified by Config
-- GSt no Exti defined now
Expand Down

0 comments on commit 8d497ff

Please sign in to comment.