Skip to content

Instantly share code, notes, and snippets.

View Aunsiels's full-sized avatar
🤖
Reparing my droid

Julien Romero Aunsiels

🤖
Reparing my droid
View GitHub Profile
@Aunsiels
Aunsiels / cours1.adb
Last active August 29, 2015 14:07
Cours Ada stm32
with Ada.Real_Time; use Ada.Real_Time;
with Stm32.GPIO; use Stm32.GPIO;
with Stm32.RCC; use Stm32.RCC;
pragma Elaborate_All (Stm32.GPIO);
procedure Cours1 is
--Definir la Pin
Pin : constant Pin_Type := (GPIOD, 12);
begin
--Configurer la pin comme une pin de sortie
@Aunsiels
Aunsiels / cours2.adb
Last active August 29, 2015 14:07
Cours Ada stm32- GPIO
with Stm32.GPIO; use Stm32.GPIO;
with Stm32.RCC; use Stm32.RCC;
pragma Elaborate_All (Stm32.GPIO);
procedure Cours2 is
--Definir 2 pins : une pour l'emission et l autre pour la reception
Pin1 : constant Pin_Type := (GPIOD, 12);
Pin2 : constant Pin_Type := (GPIOA, 0);
Params : constant GPIO_Params := (Pins => (Mask => (0 => True, others => False)),
Mode => Mode_In,
@Aunsiels
Aunsiels / cours4.adb
Last active August 29, 2015 14:07
Cours Ada stm32- GPIO3
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);
@Aunsiels
Aunsiels / irqn_type.adb
Created October 12, 2014 16:08
IRQn_Type
--------------------------------------------
-- Cortex-M4 Processor Exceptions Numbers --
--------------------------------------------
-- 2 Non Maskable Interrupt
NonMaskableInt_IRQn : constant IRQn_Type := 2;
-- 4 Cortex-M4 Memory Management Interrupt
MemoryManagement_IRQn : constant IRQn_Type := 4;
-- 5 Cortex-M4 Bus Fault Interrupt
BusFault_IRQn : constant IRQn_Type := 5;
@Aunsiels
Aunsiels / button_interrupt.adb
Last active August 29, 2015 14:12
Button interrupt
with Stm32.Led; use Stm32.Led;
with Stm32.GPIO; use Stm32.GPIO;
with Stm32.RCC; use Stm32.RCC;
pragma Elaborate_All (Stm32.GPIO);
with Stm32.EXTI; use Stm32.EXTI;
pragma Elaborate_All (Stm32.EXTI);
with Stm32.SYSCFG; use Stm32.SYSCFG;
pragma Elaborate_All (Stm32.SYSCFG);
with Stm32.Defines; use Stm32.Defines;
@Aunsiels
Aunsiels / cours5.adb
Created January 5, 2015 13:02
Timer first example
with Stm32.Timer; use Stm32.Timer;
with Stm32.GPIO; use Stm32.GPIO;
with Stm32.RCC; use Stm32.RCC;
pragma Elaborate_All (Stm32.GPIO);
with Interfaces; use Interfaces;
procedure Cours5 is
--Configurer les parametres du timer
Params : constant Timer_Params :=
(Prescaler =>40000,
@Aunsiels
Aunsiels / cours6.adb
Created January 5, 2015 13:14
Timer interrupt
with Cours6incl; use Cours6incl;
procedure Cours6 is
begin
--executer procedure principale
run;
end Cours6;
with Stm32.Timer; use Stm32.Timer;
with Ada.Real_Time; use Ada.Real_Time;
with Stm32.GPIO; use Stm32.GPIO;
with Stm32.RCC; use Stm32.RCC;
pragma Elaborate_All (Stm32.GPIO);
with Interfaces; use Interfaces;
procedure Cours7 is
--Declaration des parametres du timer
Params_Timer : constant Timer_Params :=
with Stm32.USB; use Stm32.USB;
with Stm32.Defines; use Stm32.Defines;
with Stm32.ADC; use Stm32.ADC;
with Interfaces; use Interfaces;
procedure TestADC is
--Specific parameters.
Params : constant ADC_Params :=
(Resolution => Resolution_12b,
Scan_Conv_Mode => Disable,
with Stm32.USB; use Stm32.USB;
with Stm32.Defines; use Stm32.Defines;
with Stm32.ADC; use Stm32.ADC;
with Interfaces; use Interfaces;
pragma Elaborate_All(Stm32.ADC);
package body TestADC is
--Specific parameters.
Params : constant ADC_Params :=
(Resolution => Resolution_12b,