Last active
August 29, 2015 14:07
-
-
Save Aunsiels/5d88078be1c23dafd4e5 to your computer and use it in GitHub Desktop.
Cours Ada stm32- GPIO3
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
with Ada.Real_Time; use Ada.Real_Time; | |
package body Cours4 is | |
--Corps de la tache | |
task body Blink is | |
begin | |
--faire clignoter une led | |
Setup_Out_Pin(Pin.all); | |
loop | |
Set_Pin(Pin.all,True); | |
delay until Clock + To_Time_Span (0.5); | |
Set_Pin(Pin.all,False); | |
delay until Clock + To_Time_Span (0.5); | |
end loop; | |
end Blink; | |
--une boucle de faisant rien d'autre qu'attendre | |
procedure rien is | |
begin | |
loop | |
delay until Clock + To_Time_Span (1.0); | |
end loop; | |
end rien; | |
end Cours4; |
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
with Stm32.RCC; use Stm32.RCC; | |
with Stm32.GPIO; use Stm32.GPIO; | |
pragma Elaborate_All (Stm32.GPIO); | |
package Cours4 is | |
--Definition d'une task avec une priority de 20 | |
task type Blink (Pin : access Pin_Type) is | |
pragma Priority (20); | |
end Blink; | |
--Declarer procedure et pins | |
procedure rien; | |
Pin0 : aliased Pin_Type := (GPIOD, 12); | |
Pin1 : aliased Pin_Type := (GPIOD, 13); | |
Blk1 : Blink(Pin1'Access); | |
Blk0 : Blink(Pin0'Access); | |
end Cours4; |
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
with Cours4; | |
pragma Warnings (Off, Cours4); | |
procedure Cours4Main is | |
begin | |
loop | |
--Appeler la boucle de cours4 | |
Cours4.rien; | |
end loop; | |
end Cours4Main; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment