ajout commentaire

This commit is contained in:
Revol Eliot 2023-06-02 14:59:59 +02:00
parent f71754fe69
commit 8c94e3b2c1
21 changed files with 8975 additions and 3094 deletions

View file

@ -1,345 +1,345 @@
/** /**
* Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR) * Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR)
* *
* GPIO - ADC - Sequenceur - System Timer - PWM - 72 MHz * GPIO - ADC - Sequenceur - System Timer - PWM - 72 MHz
* Modifs : * Modifs :
* enlèvement de tout ce qui est inutile dans le .h * enlèvement de tout ce qui est inutile dans le .h
* ajout de fonctions GPIO dans le .c pour utilisation en ASM ou en C : * ajout de fonctions GPIO dans le .c pour utilisation en ASM ou en C :
* - GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche) * - GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche)
* - GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche) * - GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche)
* *
* ajout d'une fonction qui impose une valeur de PWM (TIM3_CCR3) * ajout d'une fonction qui impose une valeur de PWM (TIM3_CCR3)
* PWM_Set_Value_On_TIM3_C3( int Val) * PWM_Set_Value_On_TIM3_C3( int Val)
* permet en ASM ou en C de fixer la valeur de PWM * permet en ASM ou en C de fixer la valeur de PWM
* Ajout de commentaires * Ajout de commentaires
*/ */
#ifndef DRIVERJEULASER_H__ #ifndef DRIVERJEULASER_H__
#define DRIVERJEULASER_H__ #define DRIVERJEULASER_H__
#include "stm32f10x.h" #include "stm32f10x.h"
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- CONFIGURATION CLOCK DU STM32 -------------------------------------- //--------------------- CONFIGURATION CLOCK DU STM32 --------------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure l'ensemble des horloges du uC * @brief Configure l'ensemble des horloges du uC
* @note horloge systeme (config statique a 72 MHz pour le STM32F103) * @note horloge systeme (config statique a 72 MHz pour le STM32F103)
* @param None * @param None
* @retval None * @retval None
*/ */
void CLOCK_Configure(void); void CLOCK_Configure(void);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LES TIMERS GENERAL PURPOSE TIM1 à TIM 4 ------------------------------ //--------------------- LES TIMERS GENERAL PURPOSE TIM1 à TIM 4 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure un Timer TIM1 à TIM4 avec une périodicité donnée * @brief Configure un Timer TIM1 à TIM4 avec une périodicité donnée
* @note L' horloge des 4 timers a une fréquence de 72MHz * @note L' horloge des 4 timers a une fréquence de 72MHz
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param Durée_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Durée_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
void Timer_1234_Init_ff( TIM_TypeDef *Timer, u32 Duree_ticks ); void Timer_1234_Init_ff( TIM_TypeDef *Timer, u32 Duree_ticks );
/** /**
* Macros de base pour utiliser les timers * Macros de base pour utiliser les timers
*/ */
// bloque le timer // bloque le timer
#define Bloque_Timer(Timer) Timer->CR1=(Timer->CR1)&~(1<<0) #define Bloque_Timer(Timer) Timer->CR1=(Timer->CR1)&~(1<<0)
// Lance timer // Lance timer
#define Run_Timer(Timer) Timer->CR1=(Timer->CR1)|(1<<0) #define Run_Timer(Timer) Timer->CR1=(Timer->CR1)|(1<<0)
/** /**
* @brief Associe une fonction d'interruption (callback) lors du débordement d'un timer * @brief Associe une fonction d'interruption (callback) lors du débordement d'un timer
* @note * @note
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min) * @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min)
* @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption * @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption
* @retval None * @retval None
*/ */
void Active_IT_Debordement_Timer( TIM_TypeDef *Timer, char Prio, void (*IT_function)(void) ); void Active_IT_Debordement_Timer( TIM_TypeDef *Timer, char Prio, void (*IT_function)(void) );
//********************************************************************************************************* //*********************************************************************************************************
//--------------------- PWM TIM1 to TIM 4 ------------------------------ //--------------------- PWM TIM1 to TIM 4 ------------------------------
//********************************************************************************************************* //*********************************************************************************************************
/** /**
* @brief Configure un timer en PWM * @brief Configure un timer en PWM
* @note * @note
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param voie : un des 4 canaux possibles 1 à 4. * @param voie : un des 4 canaux possibles 1 à 4.
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval Retourne la période en tick (normalement la même que le param d'entrée sauf si PSC utilisé * @retval Retourne la période en tick (normalement la même que le param d'entrée sauf si PSC utilisé
*/ */
unsigned short int PWM_Init_ff( TIM_TypeDef *Timer, char Voie, u32 Periode_ticks ); unsigned short int PWM_Init_ff( TIM_TypeDef *Timer, char Voie, u32 Periode_ticks );
/** /**
* @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif
* est donc : rcy = Thaut_ticks / Periode_ticks * est donc : rcy = Thaut_ticks / Periode_ticks
* @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3 * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3
* @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks
* @retval None * @retval None
*/ */
void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks); void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------ //--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure le timer Systick avec une périodicité donnée * @brief Configure le timer Systick avec une périodicité donnée
* @note Ce timer ne peut servir qu'à créer des temporisations ou générer des interruption * @note Ce timer ne peut servir qu'à créer des temporisations ou générer des interruption
* ce n'est pas à proprement parler un périphérique, il fait partie du Cortex M3 * ce n'est pas à proprement parler un périphérique, il fait partie du Cortex M3
* Ce timer est un 24 bits * Ce timer est un 24 bits
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour établir la périodicité * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour établir la périodicité
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
void Systick_Period_ff( unsigned int Periode_ticks ); void Systick_Period_ff( unsigned int Periode_ticks );
/** /**
* @brief Associe une fonction d'interruption (callback) lors du débordement du Systick * @brief Associe une fonction d'interruption (callback) lors du débordement du Systick
* @note * @note
* @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min) * @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min)
* @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption * @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption
* @retval None * @retval None
*/ */
void Systick_Prio_IT( char Prio, void (*Systick_function)(void) ); void Systick_Prio_IT( char Prio, void (*Systick_function)(void) );
/** /**
* Macros de base pour utiliser le Systick * Macros de base pour utiliser le Systick
*/ */
#define SysTick_On ((SysTick->CTRL)=(SysTick->CTRL)|1<<0) #define SysTick_On ((SysTick->CTRL)=(SysTick->CTRL)|1<<0)
#define SysTick_Off ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<0)) #define SysTick_Off ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<0))
#define SysTick_Enable_IT ((SysTick->CTRL)=(SysTick->CTRL)|1<<1) #define SysTick_Enable_IT ((SysTick->CTRL)=(SysTick->CTRL)|1<<1)
#define SysTick_Disable_IT ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<1)) #define SysTick_Disable_IT ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<1))
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------ //--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Active l'ADC du STM32, configure la durée de prélèvement de l'échantillon (temps * @brief Active l'ADC du STM32, configure la durée de prélèvement de l'échantillon (temps
* de fermeture du switch d'acquisition * de fermeture du switch d'acquisition
* @note * @note
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Duree_Ech_ticks : dirée de fermeture du switch d'échantillonnage en Tick d'horloge CPU * @param Duree_Ech_ticks : dirée de fermeture du switch d'échantillonnage en Tick d'horloge CPU
* exemple pour 1µs on choisira 72. * exemple pour 1µs on choisira 72.
* @retval Nombre de Tick réellement pris en compte * @retval Nombre de Tick réellement pris en compte
*/ */
unsigned int Init_TimingADC_ActiveADC_ff( ADC_TypeDef * ADC, u32 Duree_Ech_ticks ); unsigned int Init_TimingADC_ActiveADC_ff( ADC_TypeDef * ADC, u32 Duree_Ech_ticks );
/** /**
* @brief Sélectionne la voie à convertir * @brief Sélectionne la voie à convertir
* @note Attention, la voie va de 0 à 15 et n'est pas directement lié au n°de GPIO * @note Attention, la voie va de 0 à 15 et n'est pas directement lié au n°de GPIO
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Voie_ADC : 1 à 15 * @param Voie_ADC : 1 à 15
* @retval None * @retval None
*/ */
void Single_Channel_ADC( ADC_TypeDef * ADC, char Voie_ADC ); void Single_Channel_ADC( ADC_TypeDef * ADC, char Voie_ADC );
/** /**
* @brief Permet lier le déclenchement au débordement d'un timer, spécifie également * @brief Permet lier le déclenchement au débordement d'un timer, spécifie également
* la période de débordement du timer * la période de débordement du timer
* @note pas besoin de régler le timer avec une autre fonction dédiée timer * @note pas besoin de régler le timer avec une autre fonction dédiée timer
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Source : indique le timer qui déclenche l'ADC choix dans les define ci-dessous * @param Source : indique le timer qui déclenche l'ADC choix dans les define ci-dessous
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
// param pour Source : // param pour Source :
#define TIM1_CC1 0 #define TIM1_CC1 0
#define TIM1_CC2 1 #define TIM1_CC2 1
#define TIM1_CC3 2 #define TIM1_CC3 2
#define TIM2_CC2 3 #define TIM2_CC2 3
#define TIM4_CC4 5 #define TIM4_CC4 5
void Init_Conversion_On_Trig_Timer_ff( ADC_TypeDef * ADC, char Source, u32 Periode_ticks ); void Init_Conversion_On_Trig_Timer_ff( ADC_TypeDef * ADC, char Source, u32 Periode_ticks );
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- ANALOG INPUT ADC & DMA ------------------------------ //--------------------- ANALOG INPUT ADC & DMA ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Permer de lier l'ADC à un tableau en RAM pour une DMA * @brief Permer de lier l'ADC à un tableau en RAM pour une DMA
* @note * @note
* @param Circ : circular. Si '0', en fin de DMA le ptr d'@ reste inchangé * @param Circ : circular. Si '0', en fin de DMA le ptr d'@ reste inchangé
* si '1' le ptr d'@ se recale à celle du début. * si '1' le ptr d'@ se recale à celle du début.
* @param Ptr_Table_DMA : contient l'@ de début de zone RAM à écrire * @param Ptr_Table_DMA : contient l'@ de début de zone RAM à écrire
* @retval None * @retval None
*/ */
void Init_ADC1_DMA1(char Circ, short int *Ptr_Table_DMA); void Init_ADC1_DMA1(char Circ, short int *Ptr_Table_DMA);
/** /**
* @brief Lance une DMA sur le nombre de points spécifie. Les resultats seront stockes * @brief Lance une DMA sur le nombre de points spécifie. Les resultats seront stockes
* dans la zone de RAM écrite est indiquée lors de l'appel de la fonction Init_ADC1_DMA1 * dans la zone de RAM écrite est indiquée lors de l'appel de la fonction Init_ADC1_DMA1
* @note * @note
* @param NbEchDMA est le nombre d'échantillons à stocker. * @param NbEchDMA est le nombre d'échantillons à stocker.
* @retval None * @retval None
*/ */
void Start_DMA1( u16 NbEchDMA ); void Start_DMA1( u16 NbEchDMA );
// arret DMA // arret DMA
#define Stop_DMA1 DMA1_Channel1->CCR =(DMA1_Channel1->CCR) &~0x1; #define Stop_DMA1 DMA1_Channel1->CCR =(DMA1_Channel1->CCR) &~0x1;
/** /**
* @brief Attend la fin d'un cycle de DMA. la duree depend de la periode d'acquisition * @brief Attend la fin d'un cycle de DMA. la duree depend de la periode d'acquisition
* et du nombre d'echantillons * et du nombre d'echantillons
* @note fonction d'attente (bloquante) * @note fonction d'attente (bloquante)
* @param None * @param None
* @retval None * @retval None
*/ */
void Wait_On_End_Of_DMA1(void); void Wait_On_End_Of_DMA1(void);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- GPIO ------------------------------ //--------------------- GPIO ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Initialisation d'un GPIO (A à C), pin x. * @brief Initialisation d'un GPIO (A à C), pin x.
* peut être configuré : * peut être configuré :
* -> Input ou output * -> Input ou output
* -> architecture technologique (push-pull, open drain...) * -> architecture technologique (push-pull, open drain...)
* @note * @note
* @param Port : GPIOA, GPIOB, GPIOC * @param Port : GPIOA, GPIOB, GPIOC
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @param Sens : INPUT ou OUTPUT * @param Sens : INPUT ou OUTPUT
* @param Techno : voir define ci dessous * @param Techno : voir define ci dessous
* @retval 1 erreur, 0 si OK * @retval 1 erreur, 0 si OK
*/ */
// Sens // Sens
#define INPUT 'i' #define INPUT 'i'
#define OUTPUT 'o' #define OUTPUT 'o'
// Techno pour pin en entrée (INPUT) // Techno pour pin en entrée (INPUT)
#define ANALOG 0 #define ANALOG 0
#define INPUT_FLOATING 1 #define INPUT_FLOATING 1
#define INPUT_PULL_DOWN_UP 2 #define INPUT_PULL_DOWN_UP 2
// Techno pour pin en sortie (OUTPUT) // Techno pour pin en sortie (OUTPUT)
#define OUTPUT_PPULL 0 #define OUTPUT_PPULL 0
#define OUTPUT_OPDRAIN 1 #define OUTPUT_OPDRAIN 1
#define ALT_PPULL 2 #define ALT_PPULL 2
#define ALT_OPDRAIN 3 #define ALT_OPDRAIN 3
// Exemple : // Exemple :
// Port_IO_Init(GPIOB, 8, OUTPUT, OUTPUT_PPULL); // Port_IO_Init(GPIOB, 8, OUTPUT, OUTPUT_PPULL);
// Place le bit 8 du port B en sortie Push-pull // Place le bit 8 du port B en sortie Push-pull
char GPIO_Configure(GPIO_TypeDef * Port, int Broche, int Sens, int Techno); char GPIO_Configure(GPIO_TypeDef * Port, int Broche, int Sens, int Techno);
/** /**
* @brief Mise à 1 d'une broche GPIO * @brief Mise à 1 d'une broche GPIO
* @note Une fonction par GPIO * @note Une fonction par GPIO
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @retval None * @retval None
*/ */
void GPIOA_Set(char Broche); void GPIOA_Set(char Broche);
void GPIOB_Set(char Broche); void GPIOB_Set(char Broche);
void GPIOC_Set(char Broche); void GPIOC_Set(char Broche);
/** /**
* @brief Mise à 0 d'une broche GPIO * @brief Mise à 0 d'une broche GPIO
* @note Une fonction par GPIO * @note Une fonction par GPIO
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @retval None * @retval None
*/ */
void GPIOA_Clear(char Broche); void GPIOA_Clear(char Broche);
void GPIOB_Clear(char Broche); void GPIOB_Clear(char Broche);
void GPIOC_Clear(char Broche); void GPIOC_Clear(char Broche);
#endif #endif

View file

@ -1,56 +1,56 @@
; Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR) ; Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR)
; Accès en aux fonctions suivantes : ; Accès en aux fonctions suivantes :
; GPIO : ; GPIO :
; GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche) ; GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche)
; GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche) ; GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche)
; PWM : ; PWM :
;/** ;/**
; * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif ; * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif
; * est donc : rcy = Thaut_ticks / Periode_ticks ; * est donc : rcy = Thaut_ticks / Periode_ticks
; * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3 ; * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3
; * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks ; * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks
; * @retval None ; * @retval None
; */ ; */
;void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks); ;void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks);
import PWM_Set_Value_TIM3_Ch3 import PWM_Set_Value_TIM3_Ch3
;/** ;/**
; * @brief Mise à 1 d'une broche GPIO ; * @brief Mise à 1 d'une broche GPIO
; * @note Une fonction par GPIO ; * @note Une fonction par GPIO
; * @param Broche : 0 à 15 ; * @param Broche : 0 à 15
; * @retval None ; * @retval None
; */ ; */
;void GPIOA_Set(char Broche); ;void GPIOA_Set(char Broche);
import GPIOA_Set import GPIOA_Set
;void GPIOB_Set(char Broche); ;void GPIOB_Set(char Broche);
import GPIOB_Set import GPIOB_Set
;void GPIOC_Set(char Broche); ;void GPIOC_Set(char Broche);
import GPIOC_Set import GPIOC_Set
;/** ;/**
; * @brief Mise à 0 d'une broche GPIO ; * @brief Mise à 0 d'une broche GPIO
; * @note Une fonction par GPIO ; * @note Une fonction par GPIO
; * @param Broche : 0 à 15 ; * @param Broche : 0 à 15
; * @retval None ; * @retval None
; */ ; */
;void GPIOA_Clear(char Broche); ;void GPIOA_Clear(char Broche);
import GPIOA_Clear import GPIOA_Clear
;void GPIOB_Clear(char Broche); ;void GPIOB_Clear(char Broche);
import GPIOB_Clear import GPIOB_Clear
;void GPIOC_Clear(char Broche); ;void GPIOC_Clear(char Broche);
import GPIOC_Clear import GPIOC_Clear
end end

View file

@ -1,205 +1,205 @@
PRESERVE8 PRESERVE8
THUMB THUMB
;include DriverJeuLaser.inc ;include DriverJeuLaser.inc
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
area mesdata,data,readonly area mesdata,data,readonly
;Section RAM (read write): ;Section RAM (read write):
area maram,data,readwrite area maram,data,readwrite
extern LeSignal extern LeSignal
export DFT_ModuleAuCarre export DFT_ModuleAuCarre
export TabCos export TabCos
; =============================================================================================== ; ===============================================================================================
;Section ROM code (read only) : ;Section ROM code (read only) :
area moncode,code,readonly area moncode,code,readonly
; écrire le code ici ; écrire le code ici
DFT_ModuleAuCarre proc DFT_ModuleAuCarre proc
push{lr,r4,r5,r6,r7,r8,r9} push{lr,r4,r5,r6,r7,r8,r9}
mov r2,#0 mov r2,#0
mov r3,#0 mov r3,#0
mov r9,#0 mov r9,#0
boucle cmp r2,#63 boucle cmp r2,#63
bgt fin_boucle bgt fin_boucle
lsl r5,r2,#1 lsl r5,r2,#1
;ldr r0,=LeSignal ;ldr r0,=LeSignal
ldrsh r4,[r0,r5] ldrsh r4,[r0,r5]
ldr r6, =TabCos ldr r6, =TabCos
ldr r7, =TabSin ldr r7, =TabSin
;mul r5, r5, r1 ;mul r5, r5, r1
mul r5, r1 mul r5, r1
and r5, #127 and r5, #127
ldrsh r6,[r6,r5] ldrsh r6,[r6,r5]
ldrsh r7,[r7,r5] ldrsh r7,[r7,r5]
mul r5, r6, r4 mul r5, r6, r4
mul r8, r7, r4 mul r8, r7, r4
add r3, r5 add r3, r5
add r9, r8 add r9, r8
add r2, #1 add r2, #1
b boucle b boucle
fin_boucle fin_boucle
mov r0,r3 ;correspond à Re(X(k)) mov r0,r3 ;correspond à Re(X(k))
mov r1,r9 ;correspond à Im(X(k)) mov r1,r9 ;correspond à Im(X(k))
smull r2,r3,r0, r0 smull r2,r3,r0, r0
smull r4,r5,r1, r1 smull r4,r5,r1, r1
adds r0,r2,r4 adds r0,r2,r4
adc r1, r3, r5 adc r1, r3, r5
mov r0,r1 mov r0,r1
pop{pc,r4,r5,r6,r7,r8,r9} pop{pc,r4,r5,r6,r7,r8,r9}
endp endp
;Section ROM code (read only) : ;Section ROM code (read only) :
AREA Trigo, DATA, READONLY AREA Trigo, DATA, READONLY
; codage fractionnaire 1.15 ; codage fractionnaire 1.15
TabCos TabCos
DCW 32767 ; 0 0x7fff 0.99997 DCW 32767 ; 0 0x7fff 0.99997
DCW 32610 ; 1 0x7f62 0.99518 DCW 32610 ; 1 0x7f62 0.99518
DCW 32138 ; 2 0x7d8a 0.98077 DCW 32138 ; 2 0x7d8a 0.98077
DCW 31357 ; 3 0x7a7d 0.95694 DCW 31357 ; 3 0x7a7d 0.95694
DCW 30274 ; 4 0x7642 0.92389 DCW 30274 ; 4 0x7642 0.92389
DCW 28899 ; 5 0x70e3 0.88193 DCW 28899 ; 5 0x70e3 0.88193
DCW 27246 ; 6 0x6a6e 0.83148 DCW 27246 ; 6 0x6a6e 0.83148
DCW 25330 ; 7 0x62f2 0.77301 DCW 25330 ; 7 0x62f2 0.77301
DCW 23170 ; 8 0x5a82 0.70709 DCW 23170 ; 8 0x5a82 0.70709
DCW 20788 ; 9 0x5134 0.63440 DCW 20788 ; 9 0x5134 0.63440
DCW 18205 ; 10 0x471d 0.55557 DCW 18205 ; 10 0x471d 0.55557
DCW 15447 ; 11 0x3c57 0.47141 DCW 15447 ; 11 0x3c57 0.47141
DCW 12540 ; 12 0x30fc 0.38269 DCW 12540 ; 12 0x30fc 0.38269
DCW 9512 ; 13 0x2528 0.29028 DCW 9512 ; 13 0x2528 0.29028
DCW 6393 ; 14 0x18f9 0.19510 DCW 6393 ; 14 0x18f9 0.19510
DCW 3212 ; 15 0x0c8c 0.09802 DCW 3212 ; 15 0x0c8c 0.09802
DCW 0 ; 16 0x0000 0.00000 DCW 0 ; 16 0x0000 0.00000
DCW -3212 ; 17 0xf374 -0.09802 DCW -3212 ; 17 0xf374 -0.09802
DCW -6393 ; 18 0xe707 -0.19510 DCW -6393 ; 18 0xe707 -0.19510
DCW -9512 ; 19 0xdad8 -0.29028 DCW -9512 ; 19 0xdad8 -0.29028
DCW -12540 ; 20 0xcf04 -0.38269 DCW -12540 ; 20 0xcf04 -0.38269
DCW -15447 ; 21 0xc3a9 -0.47141 DCW -15447 ; 21 0xc3a9 -0.47141
DCW -18205 ; 22 0xb8e3 -0.55557 DCW -18205 ; 22 0xb8e3 -0.55557
DCW -20788 ; 23 0xaecc -0.63440 DCW -20788 ; 23 0xaecc -0.63440
DCW -23170 ; 24 0xa57e -0.70709 DCW -23170 ; 24 0xa57e -0.70709
DCW -25330 ; 25 0x9d0e -0.77301 DCW -25330 ; 25 0x9d0e -0.77301
DCW -27246 ; 26 0x9592 -0.83148 DCW -27246 ; 26 0x9592 -0.83148
DCW -28899 ; 27 0x8f1d -0.88193 DCW -28899 ; 27 0x8f1d -0.88193
DCW -30274 ; 28 0x89be -0.92389 DCW -30274 ; 28 0x89be -0.92389
DCW -31357 ; 29 0x8583 -0.95694 DCW -31357 ; 29 0x8583 -0.95694
DCW -32138 ; 30 0x8276 -0.98077 DCW -32138 ; 30 0x8276 -0.98077
DCW -32610 ; 31 0x809e -0.99518 DCW -32610 ; 31 0x809e -0.99518
DCW -32768 ; 32 0x8000 -1.00000 DCW -32768 ; 32 0x8000 -1.00000
DCW -32610 ; 33 0x809e -0.99518 DCW -32610 ; 33 0x809e -0.99518
DCW -32138 ; 34 0x8276 -0.98077 DCW -32138 ; 34 0x8276 -0.98077
DCW -31357 ; 35 0x8583 -0.95694 DCW -31357 ; 35 0x8583 -0.95694
DCW -30274 ; 36 0x89be -0.92389 DCW -30274 ; 36 0x89be -0.92389
DCW -28899 ; 37 0x8f1d -0.88193 DCW -28899 ; 37 0x8f1d -0.88193
DCW -27246 ; 38 0x9592 -0.83148 DCW -27246 ; 38 0x9592 -0.83148
DCW -25330 ; 39 0x9d0e -0.77301 DCW -25330 ; 39 0x9d0e -0.77301
DCW -23170 ; 40 0xa57e -0.70709 DCW -23170 ; 40 0xa57e -0.70709
DCW -20788 ; 41 0xaecc -0.63440 DCW -20788 ; 41 0xaecc -0.63440
DCW -18205 ; 42 0xb8e3 -0.55557 DCW -18205 ; 42 0xb8e3 -0.55557
DCW -15447 ; 43 0xc3a9 -0.47141 DCW -15447 ; 43 0xc3a9 -0.47141
DCW -12540 ; 44 0xcf04 -0.38269 DCW -12540 ; 44 0xcf04 -0.38269
DCW -9512 ; 45 0xdad8 -0.29028 DCW -9512 ; 45 0xdad8 -0.29028
DCW -6393 ; 46 0xe707 -0.19510 DCW -6393 ; 46 0xe707 -0.19510
DCW -3212 ; 47 0xf374 -0.09802 DCW -3212 ; 47 0xf374 -0.09802
DCW 0 ; 48 0x0000 0.00000 DCW 0 ; 48 0x0000 0.00000
DCW 3212 ; 49 0x0c8c 0.09802 DCW 3212 ; 49 0x0c8c 0.09802
DCW 6393 ; 50 0x18f9 0.19510 DCW 6393 ; 50 0x18f9 0.19510
DCW 9512 ; 51 0x2528 0.29028 DCW 9512 ; 51 0x2528 0.29028
DCW 12540 ; 52 0x30fc 0.38269 DCW 12540 ; 52 0x30fc 0.38269
DCW 15447 ; 53 0x3c57 0.47141 DCW 15447 ; 53 0x3c57 0.47141
DCW 18205 ; 54 0x471d 0.55557 DCW 18205 ; 54 0x471d 0.55557
DCW 20788 ; 55 0x5134 0.63440 DCW 20788 ; 55 0x5134 0.63440
DCW 23170 ; 56 0x5a82 0.70709 DCW 23170 ; 56 0x5a82 0.70709
DCW 25330 ; 57 0x62f2 0.77301 DCW 25330 ; 57 0x62f2 0.77301
DCW 27246 ; 58 0x6a6e 0.83148 DCW 27246 ; 58 0x6a6e 0.83148
DCW 28899 ; 59 0x70e3 0.88193 DCW 28899 ; 59 0x70e3 0.88193
DCW 30274 ; 60 0x7642 0.92389 DCW 30274 ; 60 0x7642 0.92389
DCW 31357 ; 61 0x7a7d 0.95694 DCW 31357 ; 61 0x7a7d 0.95694
DCW 32138 ; 62 0x7d8a 0.98077 DCW 32138 ; 62 0x7d8a 0.98077
DCW 32610 ; 63 0x7f62 0.99518 DCW 32610 ; 63 0x7f62 0.99518
TabSin TabSin
DCW 0 ; 0 0x0000 0.00000 DCW 0 ; 0 0x0000 0.00000
DCW 3212 ; 1 0x0c8c 0.09802 DCW 3212 ; 1 0x0c8c 0.09802
DCW 6393 ; 2 0x18f9 0.19510 DCW 6393 ; 2 0x18f9 0.19510
DCW 9512 ; 3 0x2528 0.29028 DCW 9512 ; 3 0x2528 0.29028
DCW 12540 ; 4 0x30fc 0.38269 DCW 12540 ; 4 0x30fc 0.38269
DCW 15447 ; 5 0x3c57 0.47141 DCW 15447 ; 5 0x3c57 0.47141
DCW 18205 ; 6 0x471d 0.55557 DCW 18205 ; 6 0x471d 0.55557
DCW 20788 ; 7 0x5134 0.63440 DCW 20788 ; 7 0x5134 0.63440
DCW 23170 ; 8 0x5a82 0.70709 DCW 23170 ; 8 0x5a82 0.70709
DCW 25330 ; 9 0x62f2 0.77301 DCW 25330 ; 9 0x62f2 0.77301
DCW 27246 ; 10 0x6a6e 0.83148 DCW 27246 ; 10 0x6a6e 0.83148
DCW 28899 ; 11 0x70e3 0.88193 DCW 28899 ; 11 0x70e3 0.88193
DCW 30274 ; 12 0x7642 0.92389 DCW 30274 ; 12 0x7642 0.92389
DCW 31357 ; 13 0x7a7d 0.95694 DCW 31357 ; 13 0x7a7d 0.95694
DCW 32138 ; 14 0x7d8a 0.98077 DCW 32138 ; 14 0x7d8a 0.98077
DCW 32610 ; 15 0x7f62 0.99518 DCW 32610 ; 15 0x7f62 0.99518
DCW 32767 ; 16 0x7fff 0.99997 DCW 32767 ; 16 0x7fff 0.99997
DCW 32610 ; 17 0x7f62 0.99518 DCW 32610 ; 17 0x7f62 0.99518
DCW 32138 ; 18 0x7d8a 0.98077 DCW 32138 ; 18 0x7d8a 0.98077
DCW 31357 ; 19 0x7a7d 0.95694 DCW 31357 ; 19 0x7a7d 0.95694
DCW 30274 ; 20 0x7642 0.92389 DCW 30274 ; 20 0x7642 0.92389
DCW 28899 ; 21 0x70e3 0.88193 DCW 28899 ; 21 0x70e3 0.88193
DCW 27246 ; 22 0x6a6e 0.83148 DCW 27246 ; 22 0x6a6e 0.83148
DCW 25330 ; 23 0x62f2 0.77301 DCW 25330 ; 23 0x62f2 0.77301
DCW 23170 ; 24 0x5a82 0.70709 DCW 23170 ; 24 0x5a82 0.70709
DCW 20788 ; 25 0x5134 0.63440 DCW 20788 ; 25 0x5134 0.63440
DCW 18205 ; 26 0x471d 0.55557 DCW 18205 ; 26 0x471d 0.55557
DCW 15447 ; 27 0x3c57 0.47141 DCW 15447 ; 27 0x3c57 0.47141
DCW 12540 ; 28 0x30fc 0.38269 DCW 12540 ; 28 0x30fc 0.38269
DCW 9512 ; 29 0x2528 0.29028 DCW 9512 ; 29 0x2528 0.29028
DCW 6393 ; 30 0x18f9 0.19510 DCW 6393 ; 30 0x18f9 0.19510
DCW 3212 ; 31 0x0c8c 0.09802 DCW 3212 ; 31 0x0c8c 0.09802
DCW 0 ; 32 0x0000 0.00000 DCW 0 ; 32 0x0000 0.00000
DCW -3212 ; 33 0xf374 -0.09802 DCW -3212 ; 33 0xf374 -0.09802
DCW -6393 ; 34 0xe707 -0.19510 DCW -6393 ; 34 0xe707 -0.19510
DCW -9512 ; 35 0xdad8 -0.29028 DCW -9512 ; 35 0xdad8 -0.29028
DCW -12540 ; 36 0xcf04 -0.38269 DCW -12540 ; 36 0xcf04 -0.38269
DCW -15447 ; 37 0xc3a9 -0.47141 DCW -15447 ; 37 0xc3a9 -0.47141
DCW -18205 ; 38 0xb8e3 -0.55557 DCW -18205 ; 38 0xb8e3 -0.55557
DCW -20788 ; 39 0xaecc -0.63440 DCW -20788 ; 39 0xaecc -0.63440
DCW -23170 ; 40 0xa57e -0.70709 DCW -23170 ; 40 0xa57e -0.70709
DCW -25330 ; 41 0x9d0e -0.77301 DCW -25330 ; 41 0x9d0e -0.77301
DCW -27246 ; 42 0x9592 -0.83148 DCW -27246 ; 42 0x9592 -0.83148
DCW -28899 ; 43 0x8f1d -0.88193 DCW -28899 ; 43 0x8f1d -0.88193
DCW -30274 ; 44 0x89be -0.92389 DCW -30274 ; 44 0x89be -0.92389
DCW -31357 ; 45 0x8583 -0.95694 DCW -31357 ; 45 0x8583 -0.95694
DCW -32138 ; 46 0x8276 -0.98077 DCW -32138 ; 46 0x8276 -0.98077
DCW -32610 ; 47 0x809e -0.99518 DCW -32610 ; 47 0x809e -0.99518
DCW -32768 ; 48 0x8000 -1.00000 DCW -32768 ; 48 0x8000 -1.00000
DCW -32610 ; 49 0x809e -0.99518 DCW -32610 ; 49 0x809e -0.99518
DCW -32138 ; 50 0x8276 -0.98077 DCW -32138 ; 50 0x8276 -0.98077
DCW -31357 ; 51 0x8583 -0.95694 DCW -31357 ; 51 0x8583 -0.95694
DCW -30274 ; 52 0x89be -0.92389 DCW -30274 ; 52 0x89be -0.92389
DCW -28899 ; 53 0x8f1d -0.88193 DCW -28899 ; 53 0x8f1d -0.88193
DCW -27246 ; 54 0x9592 -0.83148 DCW -27246 ; 54 0x9592 -0.83148
DCW -25330 ; 55 0x9d0e -0.77301 DCW -25330 ; 55 0x9d0e -0.77301
DCW -23170 ; 56 0xa57e -0.70709 DCW -23170 ; 56 0xa57e -0.70709
DCW -20788 ; 57 0xaecc -0.63440 DCW -20788 ; 57 0xaecc -0.63440
DCW -18205 ; 58 0xb8e3 -0.55557 DCW -18205 ; 58 0xb8e3 -0.55557
DCW -15447 ; 59 0xc3a9 -0.47141 DCW -15447 ; 59 0xc3a9 -0.47141
DCW -12540 ; 60 0xcf04 -0.38269 DCW -12540 ; 60 0xcf04 -0.38269
DCW -9512 ; 61 0xdad8 -0.29028 DCW -9512 ; 61 0xdad8 -0.29028
DCW -6393 ; 62 0xe707 -0.19510 DCW -6393 ; 62 0xe707 -0.19510
DCW -3212 ; 63 0xf374 -0.09802 DCW -3212 ; 63 0xf374 -0.09802
END END

View file

@ -1,72 +1,72 @@
#include "DriverJeuLaser.h" #include "DriverJeuLaser.h"
#include <stdio.h> #include <stdio.h>
extern int DFT_ModuleAuCarre(short int* Signal64ech, char k); extern int DFT_ModuleAuCarre(short int* Signal64ech, char k);
extern short int LeSignal[]; extern short int LeSignal[];
//int result; //int result;
int dft[64]; int dft[64];
short int dma_buf[64]; short int dma_buf[64];
void callback() { void callback() {
Start_DMA1(64); Start_DMA1(64);
Wait_On_End_Of_DMA1(); Wait_On_End_Of_DMA1();
//int somme=0; //int somme=0;
for (int i=1;i<64;i++) { for (int i=1;i<64;i++) {
dft[i] = DFT_ModuleAuCarre(&(dma_buf[0]),i); dft[i] = DFT_ModuleAuCarre(&(dma_buf[0]),i);
//somme+=dft[i]; //somme+=dft[i];
} }
Stop_DMA1; Stop_DMA1;
} }
int main(void) int main(void)
{ {
// =========================================================================== // ===========================================================================
// ============= INIT PERIPH (faites qu'une seule fois) ===================== // ============= INIT PERIPH (faites qu'une seule fois) =====================
// =========================================================================== // ===========================================================================
//int result = DFT_ModuleAuCarre(&(LeSignal[0]),1); //int result = DFT_ModuleAuCarre(&(LeSignal[0]),1);
//printf("le résultat : %d \n", result); //printf("le résultat : %d \n", result);
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
CLOCK_Configure(); CLOCK_Configure();
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
PWM_Init_ff(TIM2,3,720); PWM_Init_ff(TIM2,3,720);
Init_TimingADC_ActiveADC_ff(ADC1,72); Init_TimingADC_ActiveADC_ff(ADC1,72);
Single_Channel_ADC( ADC1, 2 ); Single_Channel_ADC( ADC1, 2 );
Init_Conversion_On_Trig_Timer_ff( ADC1, TIM2_CC2, 225 ); Init_Conversion_On_Trig_Timer_ff( ADC1, TIM2_CC2, 225 );
Init_ADC1_DMA1( 0, &(dma_buf[0]) ); Init_ADC1_DMA1( 0, &(dma_buf[0]) );
Systick_Period_ff(5*72*1000); Systick_Period_ff(5*72*1000);
Systick_Prio_IT(0,callback); Systick_Prio_IT(0,callback);
SysTick_Enable_IT; SysTick_Enable_IT;
SysTick_On; SysTick_On;
//============================================================================ //============================================================================
while (1) while (1)
{ {
} }
} }

View file

@ -1,335 +1,335 @@
;******************** (C) COPYRIGHT 2011 STMicroelectronics ******************** ;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
;* File Name : startup_stm32f10x_md.s ;* File Name : startup_stm32f10x_md.s
;* Author : MCD Application Team ;* Author : MCD Application Team
;* Version : V3.5.0 ;* Version : V3.5.0
;* Date : 11-March-2011 ;* Date : 11-March-2011
;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM ;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM
;* toolchain. ;* toolchain.
;* This module performs: ;* This module performs:
;* - Set the initial SP ;* - Set the initial SP
;* - Set the initial PC == Reset_Handler ;* - Set the initial PC == Reset_Handler
;* - Set the vector table entries with the exceptions ISR address ;* - Set the vector table entries with the exceptions ISR address
;* - Configure the clock system ;* - Configure the clock system
;* - Branches to __main in the C library (which eventually ;* - Branches to __main in the C library (which eventually
;* calls main()). ;* calls main()).
;* After Reset the CortexM3 processor is in Thread mode, ;* After Reset the CortexM3 processor is in Thread mode,
;* priority is Privileged, and the Stack is set to Main. ;* priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>> ;* <<< Use Configuration Wizard in Context Menu >>>
;******************************************************************************* ;*******************************************************************************
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS ; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. ; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, ; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE ; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING ; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
;******************************************************************************* ;*******************************************************************************
; Amount of memory (in bytes) allocated for Stack ; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs ; Tailor this value to your application needs
; <h> Stack Configuration ; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h> ; </h>
Stack_Size EQU 0x00000400 Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3 AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size Stack_Mem SPACE Stack_Size
__initial_sp __initial_sp
; <h> Heap Configuration ; <h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h> ; </h>
Heap_Size EQU 0x00000200 Heap_Size EQU 0x00000200
AREA HEAP, NOINIT, READWRITE, ALIGN=3 AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base __heap_base
Heap_Mem SPACE Heap_Size Heap_Mem SPACE Heap_Size
__heap_limit __heap_limit
PRESERVE8 PRESERVE8
THUMB THUMB
; Vector Table Mapped to Address 0 at Reset ; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY AREA RESET, DATA, READONLY
EXPORT __Vectors EXPORT __Vectors
EXPORT __Vectors_End EXPORT __Vectors_End
EXPORT __Vectors_Size EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack __Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler DCD SysTick_Handler ; SysTick Handler
; External Interrupts ; External Interrupts
DCD WWDG_IRQHandler ; Window Watchdog DCD WWDG_IRQHandler ; Window Watchdog
DCD PVD_IRQHandler ; PVD through EXTI Line detect DCD PVD_IRQHandler ; PVD through EXTI Line detect
DCD TAMPER_IRQHandler ; Tamper DCD TAMPER_IRQHandler ; Tamper
DCD RTC_IRQHandler ; RTC DCD RTC_IRQHandler ; RTC
DCD FLASH_IRQHandler ; Flash DCD FLASH_IRQHandler ; Flash
DCD RCC_IRQHandler ; RCC DCD RCC_IRQHandler ; RCC
DCD EXTI0_IRQHandler ; EXTI Line 0 DCD EXTI0_IRQHandler ; EXTI Line 0
DCD EXTI1_IRQHandler ; EXTI Line 1 DCD EXTI1_IRQHandler ; EXTI Line 1
DCD EXTI2_IRQHandler ; EXTI Line 2 DCD EXTI2_IRQHandler ; EXTI Line 2
DCD EXTI3_IRQHandler ; EXTI Line 3 DCD EXTI3_IRQHandler ; EXTI Line 3
DCD EXTI4_IRQHandler ; EXTI Line 4 DCD EXTI4_IRQHandler ; EXTI Line 4
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2 DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3 DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4 DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5 DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6 DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7 DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
DCD ADC1_2_IRQHandler ; ADC1_2 DCD ADC1_2_IRQHandler ; ADC1_2
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0 DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_RX1_IRQHandler ; CAN1 RX1
DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD CAN1_SCE_IRQHandler ; CAN1 SCE
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5 DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
DCD TIM1_BRK_IRQHandler ; TIM1 Break DCD TIM1_BRK_IRQHandler ; TIM1 Break
DCD TIM1_UP_IRQHandler ; TIM1 Update DCD TIM1_UP_IRQHandler ; TIM1 Update
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
DCD TIM2_IRQHandler ; TIM2 DCD TIM2_IRQHandler ; TIM2
DCD TIM3_IRQHandler ; TIM3 DCD TIM3_IRQHandler ; TIM3
DCD TIM4_IRQHandler ; TIM4 DCD TIM4_IRQHandler ; TIM4
DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_EV_IRQHandler ; I2C1 Event
DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C1_ER_IRQHandler ; I2C1 Error
DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_EV_IRQHandler ; I2C2 Event
DCD I2C2_ER_IRQHandler ; I2C2 Error DCD I2C2_ER_IRQHandler ; I2C2 Error
DCD SPI1_IRQHandler ; SPI1 DCD SPI1_IRQHandler ; SPI1
DCD SPI2_IRQHandler ; SPI2 DCD SPI2_IRQHandler ; SPI2
DCD USART1_IRQHandler ; USART1 DCD USART1_IRQHandler ; USART1
DCD USART2_IRQHandler ; USART2 DCD USART2_IRQHandler ; USART2
DCD USART3_IRQHandler ; USART3 DCD USART3_IRQHandler ; USART3
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10 DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
__Vectors_End __Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors __Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY AREA |.text|, CODE, READONLY
; Reset handler ; Reset handler
Reset_Handler PROC Reset_Handler PROC
EXPORT Reset_Handler [WEAK] EXPORT Reset_Handler [WEAK]
IMPORT __main IMPORT __main
LDR R0, =SystemInit LDR R0, =SystemInit
BLX R0 BLX R0
; ;
; Enable UsageFault, MemFault and Busfault interrupts ; Enable UsageFault, MemFault and Busfault interrupts
; ;
_SHCSR EQU 0xE000ED24 ; SHCSR is located at address 0xE000ED24 _SHCSR EQU 0xE000ED24 ; SHCSR is located at address 0xE000ED24
LDR.W R0, =_SHCSR LDR.W R0, =_SHCSR
LDR R1, [R0] ; Read CPACR LDR R1, [R0] ; Read CPACR
ORR R1, R1, #(0x7 << 16) ; Set bits 16,17,18 to enable usagefault, busfault, memfault interrupts ORR R1, R1, #(0x7 << 16) ; Set bits 16,17,18 to enable usagefault, busfault, memfault interrupts
STR R1, [R0] ; Write back the modified value to the CPACR STR R1, [R0] ; Write back the modified value to the CPACR
DSB ; Wait for store to complete DSB ; Wait for store to complete
; ;
; Set priority grouping (PRIGROUP) in AIRCR to 3 (16 levels for group priority and 0 for subpriority) ; Set priority grouping (PRIGROUP) in AIRCR to 3 (16 levels for group priority and 0 for subpriority)
; ;
_AIRCR EQU 0xE000ED0C _AIRCR EQU 0xE000ED0C
_AIRCR_VAL EQU 0x05FA0300 _AIRCR_VAL EQU 0x05FA0300
LDR.W R0, =_AIRCR LDR.W R0, =_AIRCR
LDR.W R1, =_AIRCR_VAL LDR.W R1, =_AIRCR_VAL
STR R1,[R0] STR R1,[R0]
; ;
; Finaly, jump to main function (void main (void)) ; Finaly, jump to main function (void main (void))
; ;
LDR R0, =__main LDR R0, =__main
BX R0 BX R0
ENDP ENDP
SystemInit PROC SystemInit PROC
EXPORT SystemInit [WEAK] EXPORT SystemInit [WEAK]
BX LR BX LR
ENDP ENDP
; Dummy Exception Handlers (infinite loops which can be modified) ; Dummy Exception Handlers (infinite loops which can be modified)
NMI_Handler PROC NMI_Handler PROC
EXPORT NMI_Handler [WEAK] EXPORT NMI_Handler [WEAK]
B . B .
ENDP ENDP
HardFault_Handler\ HardFault_Handler\
PROC PROC
EXPORT HardFault_Handler [WEAK] EXPORT HardFault_Handler [WEAK]
B . B .
ENDP ENDP
MemManage_Handler\ MemManage_Handler\
PROC PROC
EXPORT MemManage_Handler [WEAK] EXPORT MemManage_Handler [WEAK]
B . B .
ENDP ENDP
BusFault_Handler\ BusFault_Handler\
PROC PROC
EXPORT BusFault_Handler [WEAK] EXPORT BusFault_Handler [WEAK]
B . B .
ENDP ENDP
UsageFault_Handler\ UsageFault_Handler\
PROC PROC
EXPORT UsageFault_Handler [WEAK] EXPORT UsageFault_Handler [WEAK]
B . B .
ENDP ENDP
SVC_Handler PROC SVC_Handler PROC
EXPORT SVC_Handler [WEAK] EXPORT SVC_Handler [WEAK]
B . B .
ENDP ENDP
DebugMon_Handler\ DebugMon_Handler\
PROC PROC
EXPORT DebugMon_Handler [WEAK] EXPORT DebugMon_Handler [WEAK]
B . B .
ENDP ENDP
PendSV_Handler PROC PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK] EXPORT PendSV_Handler [WEAK]
B . B .
ENDP ENDP
SysTick_Handler PROC SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK] EXPORT SysTick_Handler [WEAK]
B . B .
ENDP ENDP
Default_Handler PROC Default_Handler PROC
EXPORT WWDG_IRQHandler [WEAK] EXPORT WWDG_IRQHandler [WEAK]
EXPORT PVD_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK]
EXPORT TAMPER_IRQHandler [WEAK] EXPORT TAMPER_IRQHandler [WEAK]
EXPORT RTC_IRQHandler [WEAK] EXPORT RTC_IRQHandler [WEAK]
EXPORT FLASH_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK]
EXPORT RCC_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK]
EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK]
EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK]
EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK]
EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK]
EXPORT EXTI4_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK]
EXPORT DMA1_Channel1_IRQHandler [WEAK] EXPORT DMA1_Channel1_IRQHandler [WEAK]
EXPORT DMA1_Channel2_IRQHandler [WEAK] EXPORT DMA1_Channel2_IRQHandler [WEAK]
EXPORT DMA1_Channel3_IRQHandler [WEAK] EXPORT DMA1_Channel3_IRQHandler [WEAK]
EXPORT DMA1_Channel4_IRQHandler [WEAK] EXPORT DMA1_Channel4_IRQHandler [WEAK]
EXPORT DMA1_Channel5_IRQHandler [WEAK] EXPORT DMA1_Channel5_IRQHandler [WEAK]
EXPORT DMA1_Channel6_IRQHandler [WEAK] EXPORT DMA1_Channel6_IRQHandler [WEAK]
EXPORT DMA1_Channel7_IRQHandler [WEAK] EXPORT DMA1_Channel7_IRQHandler [WEAK]
EXPORT ADC1_2_IRQHandler [WEAK] EXPORT ADC1_2_IRQHandler [WEAK]
EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK] EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK] EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK]
EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK]
EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK]
EXPORT TIM1_BRK_IRQHandler [WEAK] EXPORT TIM1_BRK_IRQHandler [WEAK]
EXPORT TIM1_UP_IRQHandler [WEAK] EXPORT TIM1_UP_IRQHandler [WEAK]
EXPORT TIM1_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK]
EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK]
EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK]
EXPORT TIM4_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK]
EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK]
EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK]
EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK]
EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK]
EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK]
EXPORT SPI2_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK]
EXPORT USART1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK]
EXPORT USART2_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK]
EXPORT USART3_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK]
EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK]
EXPORT RTCAlarm_IRQHandler [WEAK] EXPORT RTCAlarm_IRQHandler [WEAK]
EXPORT USBWakeUp_IRQHandler [WEAK] EXPORT USBWakeUp_IRQHandler [WEAK]
WWDG_IRQHandler WWDG_IRQHandler
PVD_IRQHandler PVD_IRQHandler
TAMPER_IRQHandler TAMPER_IRQHandler
RTC_IRQHandler RTC_IRQHandler
FLASH_IRQHandler FLASH_IRQHandler
RCC_IRQHandler RCC_IRQHandler
EXTI0_IRQHandler EXTI0_IRQHandler
EXTI1_IRQHandler EXTI1_IRQHandler
EXTI2_IRQHandler EXTI2_IRQHandler
EXTI3_IRQHandler EXTI3_IRQHandler
EXTI4_IRQHandler EXTI4_IRQHandler
DMA1_Channel1_IRQHandler DMA1_Channel1_IRQHandler
DMA1_Channel2_IRQHandler DMA1_Channel2_IRQHandler
DMA1_Channel3_IRQHandler DMA1_Channel3_IRQHandler
DMA1_Channel4_IRQHandler DMA1_Channel4_IRQHandler
DMA1_Channel5_IRQHandler DMA1_Channel5_IRQHandler
DMA1_Channel6_IRQHandler DMA1_Channel6_IRQHandler
DMA1_Channel7_IRQHandler DMA1_Channel7_IRQHandler
ADC1_2_IRQHandler ADC1_2_IRQHandler
USB_HP_CAN1_TX_IRQHandler USB_HP_CAN1_TX_IRQHandler
USB_LP_CAN1_RX0_IRQHandler USB_LP_CAN1_RX0_IRQHandler
CAN1_RX1_IRQHandler CAN1_RX1_IRQHandler
CAN1_SCE_IRQHandler CAN1_SCE_IRQHandler
EXTI9_5_IRQHandler EXTI9_5_IRQHandler
TIM1_BRK_IRQHandler TIM1_BRK_IRQHandler
TIM1_UP_IRQHandler TIM1_UP_IRQHandler
TIM1_TRG_COM_IRQHandler TIM1_TRG_COM_IRQHandler
TIM1_CC_IRQHandler TIM1_CC_IRQHandler
TIM2_IRQHandler TIM2_IRQHandler
TIM3_IRQHandler TIM3_IRQHandler
TIM4_IRQHandler TIM4_IRQHandler
I2C1_EV_IRQHandler I2C1_EV_IRQHandler
I2C1_ER_IRQHandler I2C1_ER_IRQHandler
I2C2_EV_IRQHandler I2C2_EV_IRQHandler
I2C2_ER_IRQHandler I2C2_ER_IRQHandler
SPI1_IRQHandler SPI1_IRQHandler
SPI2_IRQHandler SPI2_IRQHandler
USART1_IRQHandler USART1_IRQHandler
USART2_IRQHandler USART2_IRQHandler
USART3_IRQHandler USART3_IRQHandler
EXTI15_10_IRQHandler EXTI15_10_IRQHandler
RTCAlarm_IRQHandler RTCAlarm_IRQHandler
USBWakeUp_IRQHandler USBWakeUp_IRQHandler
B . B .
ENDP ENDP
ALIGN ALIGN
;******************************************************************************* ;*******************************************************************************
; User Stack and Heap initialization ; User Stack and Heap initialization
;******************************************************************************* ;*******************************************************************************
IF :DEF:__MICROLIB IF :DEF:__MICROLIB
EXPORT __initial_sp EXPORT __initial_sp
EXPORT __heap_base EXPORT __heap_base
EXPORT __heap_limit EXPORT __heap_limit
ELSE ELSE
IMPORT __use_two_region_memory IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap EXPORT __user_initial_stackheap
__user_initial_stackheap __user_initial_stackheap
LDR R0, = Heap_Mem LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size) LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size) LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem LDR R3, = Stack_Mem
BX LR BX LR
ALIGN ALIGN
ENDIF ENDIF
END END
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE***** ;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****

View file

@ -1,78 +1,78 @@
/* Fichier devant contenir l'ensemble de fichiers utiles pour le projet LaserQuest /* Fichier devant contenir l'ensemble de fichiers utiles pour le projet LaserQuest
et qui concenent l'affichage sur la valise */ et qui concenent l'affichage sur la valise */
/* mais non disponible en version source pour les étudiants. */ /* mais non disponible en version source pour les étudiants. */
#ifndef _AFFICHAGE_VALISE_H__ #ifndef _AFFICHAGE_VALISE_H__
#define _AFFICHAGE_VALISE_H__ #define _AFFICHAGE_VALISE_H__
#include "stm32f10x.h" #include "stm32f10x.h"
/** /**
* @brief Initialise les périphériques nécessaires à l'affichage sur la Mallette * @brief Initialise les périphériques nécessaires à l'affichage sur la Mallette
* et gère la cible active. S'utilise aussi avec les ùmodules affichages simple (pas de mallette) * et gère la cible active. S'utilise aussi avec les ùmodules affichages simple (pas de mallette)
* @note Utilise TIM1, PA5, PA6 pour les cibles, PC7 à PC9 pour SPI émulé * @note Utilise TIM1, PA5, PA6 pour les cibles, PC7 à PC9 pour SPI émulé
* utilise aussi une interruption sut TIM1, prio 8. * utilise aussi une interruption sut TIM1, prio 8.
* @param none * @param none
* @retval None * @retval None
*/ */
void Init_Affichage(void); void Init_Affichage(void);
/** /**
* @brief Prépare l'affichage 2 digit sur l'afficheur demandé * @brief Prépare l'affichage 2 digit sur l'afficheur demandé
* @note Exemple : Prepare_Afficheur(2, 99); * @note Exemple : Prepare_Afficheur(2, 99);
* prépare l'affichage de la valeur 99 sur l'afficheur n°2 * prépare l'affichage de la valeur 99 sur l'afficheur n°2
* L'action est différée à l'exécution de Mise_A_Jour_Afficheurs_LED() * L'action est différée à l'exécution de Mise_A_Jour_Afficheurs_LED()
* @param char Aff : de 1 à 4 ; char Valeur de 0 à 99 * @param char Aff : de 1 à 4 ; char Valeur de 0 à 99
* @retval None * @retval None
*/ */
void Prepare_Afficheur(char Aff, char Valeur); void Prepare_Afficheur(char Aff, char Valeur);
void Prepare_Set_Point_Unite(char Aff); void Prepare_Set_Point_Unite(char Aff);
void Prepare_Clear_Point_Unite(char Aff); void Prepare_Clear_Point_Unite(char Aff);
/** /**
* @brief Prépare l'allumage de la LED demandée * @brief Prépare l'allumage de la LED demandée
* @note Exemple : Prepare_Set_LED(LED_Cible_2); * @note Exemple : Prepare_Set_LED(LED_Cible_2);
* prépare l'allumage de la LED correspondant à la cible n°2 * prépare l'allumage de la LED correspondant à la cible n°2
* L'action est différée à l'exécution de Mise_A_Jour_Afficheurs_LED() * L'action est différée à l'exécution de Mise_A_Jour_Afficheurs_LED()
* @param voir #define ci-dessous * @param voir #define ci-dessous
* @retval None * @retval None
*/ */
void Prepare_Set_LED(char LED); void Prepare_Set_LED(char LED);
void Prepare_Clear_LED(char LED); void Prepare_Clear_LED(char LED);
/** /**
* @brief Effectue l'action d'écriture dans le module d'affichage * @brief Effectue l'action d'écriture dans le module d'affichage
* à partir de tout ce qui a é préparé auparavant. * à partir de tout ce qui a é préparé auparavant.
* @note * @note
* @param None * @param None
* @retval None * @retval None
*/ */
void Mise_A_Jour_Afficheurs_LED(void); void Mise_A_Jour_Afficheurs_LED(void);
/** /**
* @brief Spécifie le capteut actif, à savoir celui effectivement relié * @brief Spécifie le capteut actif, à savoir celui effectivement relié
* aux sorties disponibles sur la malette * aux sorties disponibles sur la malette
* @note Exemple : Choix_Capteur(1) * @note Exemple : Choix_Capteur(1)
* @param 1 à 4 * @param 1 à 4
* @retval None * @retval None
*/ */
void Choix_Capteur(char Capteur); void Choix_Capteur(char Capteur);
// define utile pour la fonction Prepare_Set_LED et Prepare_Clear_LED // define utile pour la fonction Prepare_Set_LED et Prepare_Clear_LED
#define LED_LCD_R 5 #define LED_LCD_R 5
#define LED_LCD_V 4 #define LED_LCD_V 4
#define LED_Cible_4 3 #define LED_Cible_4 3
#define LED_Cible_3 2 #define LED_Cible_3 2
#define LED_Cible_2 1 #define LED_Cible_2 1
#define LED_Cible_1 0 #define LED_Cible_1 0
#endif #endif

View file

@ -1,345 +1,345 @@
/** /**
* Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR) * Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR)
* *
* GPIO - ADC - Sequenceur - System Timer - PWM - 72 MHz * GPIO - ADC - Sequenceur - System Timer - PWM - 72 MHz
* Modifs : * Modifs :
* enlèvement de tout ce qui est inutile dans le .h * enlèvement de tout ce qui est inutile dans le .h
* ajout de fonctions GPIO dans le .c pour utilisation en ASM ou en C : * ajout de fonctions GPIO dans le .c pour utilisation en ASM ou en C :
* - GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche) * - GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche)
* - GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche) * - GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche)
* *
* ajout d'une fonction qui impose une valeur de PWM (TIM3_CCR3) * ajout d'une fonction qui impose une valeur de PWM (TIM3_CCR3)
* PWM_Set_Value_On_TIM3_C3( int Val) * PWM_Set_Value_On_TIM3_C3( int Val)
* permet en ASM ou en C de fixer la valeur de PWM * permet en ASM ou en C de fixer la valeur de PWM
* Ajout de commentaires * Ajout de commentaires
*/ */
#ifndef DRIVERJEULASER_H__ #ifndef DRIVERJEULASER_H__
#define DRIVERJEULASER_H__ #define DRIVERJEULASER_H__
#include "stm32f10x.h" #include "stm32f10x.h"
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- CONFIGURATION CLOCK DU STM32 -------------------------------------- //--------------------- CONFIGURATION CLOCK DU STM32 --------------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure l'ensemble des horloges du uC * @brief Configure l'ensemble des horloges du uC
* @note horloge systeme (config statique a 72 MHz pour le STM32F103) * @note horloge systeme (config statique a 72 MHz pour le STM32F103)
* @param None * @param None
* @retval None * @retval None
*/ */
void CLOCK_Configure(void); void CLOCK_Configure(void);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LES TIMERS GENERAL PURPOSE TIM1 à TIM 4 ------------------------------ //--------------------- LES TIMERS GENERAL PURPOSE TIM1 à TIM 4 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure un Timer TIM1 à TIM4 avec une périodicité donnée * @brief Configure un Timer TIM1 à TIM4 avec une périodicité donnée
* @note L' horloge des 4 timers a une fréquence de 72MHz * @note L' horloge des 4 timers a une fréquence de 72MHz
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param Durée_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Durée_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
void Timer_1234_Init_ff( TIM_TypeDef *Timer, u32 Duree_ticks ); void Timer_1234_Init_ff( TIM_TypeDef *Timer, u32 Duree_ticks );
/** /**
* Macros de base pour utiliser les timers * Macros de base pour utiliser les timers
*/ */
// bloque le timer // bloque le timer
#define Bloque_Timer(Timer) Timer->CR1=(Timer->CR1)&~(1<<0) #define Bloque_Timer(Timer) Timer->CR1=(Timer->CR1)&~(1<<0)
// Lance timer // Lance timer
#define Run_Timer(Timer) Timer->CR1=(Timer->CR1)|(1<<0) #define Run_Timer(Timer) Timer->CR1=(Timer->CR1)|(1<<0)
/** /**
* @brief Associe une fonction d'interruption (callback) lors du débordement d'un timer * @brief Associe une fonction d'interruption (callback) lors du débordement d'un timer
* @note * @note
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min) * @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min)
* @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption * @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption
* @retval None * @retval None
*/ */
void Active_IT_Debordement_Timer( TIM_TypeDef *Timer, char Prio, void (*IT_function)(void) ); void Active_IT_Debordement_Timer( TIM_TypeDef *Timer, char Prio, void (*IT_function)(void) );
//********************************************************************************************************* //*********************************************************************************************************
//--------------------- PWM TIM1 to TIM 4 ------------------------------ //--------------------- PWM TIM1 to TIM 4 ------------------------------
//********************************************************************************************************* //*********************************************************************************************************
/** /**
* @brief Configure un timer en PWM * @brief Configure un timer en PWM
* @note * @note
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param voie : un des 4 canaux possibles 1 à 4. * @param voie : un des 4 canaux possibles 1 à 4.
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval Retourne la période en tick (normalement la même que le param d'entrée sauf si PSC utilisé * @retval Retourne la période en tick (normalement la même que le param d'entrée sauf si PSC utilisé
*/ */
unsigned short int PWM_Init_ff( TIM_TypeDef *Timer, char Voie, u32 Periode_ticks ); unsigned short int PWM_Init_ff( TIM_TypeDef *Timer, char Voie, u32 Periode_ticks );
/** /**
* @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif
* est donc : rcy = Thaut_ticks / Periode_ticks * est donc : rcy = Thaut_ticks / Periode_ticks
* @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3 * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3
* @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks
* @retval None * @retval None
*/ */
void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks); void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------ //--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure le timer Systick avec une périodicité donnée * @brief Configure le timer Systick avec une périodicité donnée
* @note Ce timer ne peut servir qu'à créer des temporisations ou générer des interruption * @note Ce timer ne peut servir qu'à créer des temporisations ou générer des interruption
* ce n'est pas à proprement parler un périphérique, il fait partie du Cortex M3 * ce n'est pas à proprement parler un périphérique, il fait partie du Cortex M3
* Ce timer est un 24 bits * Ce timer est un 24 bits
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour établir la périodicité * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour établir la périodicité
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
void Systick_Period_ff( unsigned int Periode_ticks ); void Systick_Period_ff( unsigned int Periode_ticks );
/** /**
* @brief Associe une fonction d'interruption (callback) lors du débordement du Systick * @brief Associe une fonction d'interruption (callback) lors du débordement du Systick
* @note * @note
* @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min) * @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min)
* @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption * @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption
* @retval None * @retval None
*/ */
void Systick_Prio_IT( char Prio, void (*Systick_function)(void) ); void Systick_Prio_IT( char Prio, void (*Systick_function)(void) );
/** /**
* Macros de base pour utiliser le Systick * Macros de base pour utiliser le Systick
*/ */
#define SysTick_On ((SysTick->CTRL)=(SysTick->CTRL)|1<<0) #define SysTick_On ((SysTick->CTRL)=(SysTick->CTRL)|1<<0)
#define SysTick_Off ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<0)) #define SysTick_Off ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<0))
#define SysTick_Enable_IT ((SysTick->CTRL)=(SysTick->CTRL)|1<<1) #define SysTick_Enable_IT ((SysTick->CTRL)=(SysTick->CTRL)|1<<1)
#define SysTick_Disable_IT ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<1)) #define SysTick_Disable_IT ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<1))
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------ //--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Active l'ADC du STM32, configure la durée de prélèvement de l'échantillon (temps * @brief Active l'ADC du STM32, configure la durée de prélèvement de l'échantillon (temps
* de fermeture du switch d'acquisition * de fermeture du switch d'acquisition
* @note * @note
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Duree_Ech_ticks : dirée de fermeture du switch d'échantillonnage en Tick d'horloge CPU * @param Duree_Ech_ticks : dirée de fermeture du switch d'échantillonnage en Tick d'horloge CPU
* exemple pour 1µs on choisira 72. * exemple pour 1µs on choisira 72.
* @retval Nombre de Tick réellement pris en compte * @retval Nombre de Tick réellement pris en compte
*/ */
unsigned int Init_TimingADC_ActiveADC_ff( ADC_TypeDef * ADC, u32 Duree_Ech_ticks ); unsigned int Init_TimingADC_ActiveADC_ff( ADC_TypeDef * ADC, u32 Duree_Ech_ticks );
/** /**
* @brief Sélectionne la voie à convertir * @brief Sélectionne la voie à convertir
* @note Attention, la voie va de 0 à 15 et n'est pas directement lié au n°de GPIO * @note Attention, la voie va de 0 à 15 et n'est pas directement lié au n°de GPIO
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Voie_ADC : 1 à 15 * @param Voie_ADC : 1 à 15
* @retval None * @retval None
*/ */
void Single_Channel_ADC( ADC_TypeDef * ADC, char Voie_ADC ); void Single_Channel_ADC( ADC_TypeDef * ADC, char Voie_ADC );
/** /**
* @brief Permet lier le déclenchement au débordement d'un timer, spécifie également * @brief Permet lier le déclenchement au débordement d'un timer, spécifie également
* la période de débordement du timer * la période de débordement du timer
* @note pas besoin de régler le timer avec une autre fonction dédiée timer * @note pas besoin de régler le timer avec une autre fonction dédiée timer
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Source : indique le timer qui déclenche l'ADC choix dans les define ci-dessous * @param Source : indique le timer qui déclenche l'ADC choix dans les define ci-dessous
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
// param pour Source : // param pour Source :
#define TIM1_CC1 0 #define TIM1_CC1 0
#define TIM1_CC2 1 #define TIM1_CC2 1
#define TIM1_CC3 2 #define TIM1_CC3 2
#define TIM2_CC2 3 #define TIM2_CC2 3
#define TIM4_CC4 5 #define TIM4_CC4 5
void Init_Conversion_On_Trig_Timer_ff( ADC_TypeDef * ADC, char Source, u32 Periode_ticks ); void Init_Conversion_On_Trig_Timer_ff( ADC_TypeDef * ADC, char Source, u32 Periode_ticks );
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- ANALOG INPUT ADC & DMA ------------------------------ //--------------------- ANALOG INPUT ADC & DMA ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Permer de lier l'ADC à un tableau en RAM pour une DMA * @brief Permer de lier l'ADC à un tableau en RAM pour une DMA
* @note * @note
* @param Circ : circular. Si '0', en fin de DMA le ptr d'@ reste inchangé * @param Circ : circular. Si '0', en fin de DMA le ptr d'@ reste inchangé
* si '1' le ptr d'@ se recale à celle du début. * si '1' le ptr d'@ se recale à celle du début.
* @param Ptr_Table_DMA : contient l'@ de début de zone RAM à écrire * @param Ptr_Table_DMA : contient l'@ de début de zone RAM à écrire
* @retval None * @retval None
*/ */
void Init_ADC1_DMA1(char Circ, short int *Ptr_Table_DMA); void Init_ADC1_DMA1(char Circ, short int *Ptr_Table_DMA);
/** /**
* @brief Lance une DMA sur le nombre de points spécifie. Les resultats seront stockes * @brief Lance une DMA sur le nombre de points spécifie. Les resultats seront stockes
* dans la zone de RAM écrite est indiquée lors de l'appel de la fonction Init_ADC1_DMA1 * dans la zone de RAM écrite est indiquée lors de l'appel de la fonction Init_ADC1_DMA1
* @note * @note
* @param NbEchDMA est le nombre d'échantillons à stocker. * @param NbEchDMA est le nombre d'échantillons à stocker.
* @retval None * @retval None
*/ */
void Start_DMA1( u16 NbEchDMA ); void Start_DMA1( u16 NbEchDMA );
// arret DMA // arret DMA
#define Stop_DMA1 DMA1_Channel1->CCR =(DMA1_Channel1->CCR) &~0x1; #define Stop_DMA1 DMA1_Channel1->CCR =(DMA1_Channel1->CCR) &~0x1;
/** /**
* @brief Attend la fin d'un cycle de DMA. la duree depend de la periode d'acquisition * @brief Attend la fin d'un cycle de DMA. la duree depend de la periode d'acquisition
* et du nombre d'echantillons * et du nombre d'echantillons
* @note fonction d'attente (bloquante) * @note fonction d'attente (bloquante)
* @param None * @param None
* @retval None * @retval None
*/ */
void Wait_On_End_Of_DMA1(void); void Wait_On_End_Of_DMA1(void);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- GPIO ------------------------------ //--------------------- GPIO ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Initialisation d'un GPIO (A à C), pin x. * @brief Initialisation d'un GPIO (A à C), pin x.
* peut être configuré : * peut être configuré :
* -> Input ou output * -> Input ou output
* -> architecture technologique (push-pull, open drain...) * -> architecture technologique (push-pull, open drain...)
* @note * @note
* @param Port : GPIOA, GPIOB, GPIOC * @param Port : GPIOA, GPIOB, GPIOC
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @param Sens : INPUT ou OUTPUT * @param Sens : INPUT ou OUTPUT
* @param Techno : voir define ci dessous * @param Techno : voir define ci dessous
* @retval 1 erreur, 0 si OK * @retval 1 erreur, 0 si OK
*/ */
// Sens // Sens
#define INPUT 'i' #define INPUT 'i'
#define OUTPUT 'o' #define OUTPUT 'o'
// Techno pour pin en entrée (INPUT) // Techno pour pin en entrée (INPUT)
#define ANALOG 0 #define ANALOG 0
#define INPUT_FLOATING 1 #define INPUT_FLOATING 1
#define INPUT_PULL_DOWN_UP 2 #define INPUT_PULL_DOWN_UP 2
// Techno pour pin en sortie (OUTPUT) // Techno pour pin en sortie (OUTPUT)
#define OUTPUT_PPULL 0 #define OUTPUT_PPULL 0
#define OUTPUT_OPDRAIN 1 #define OUTPUT_OPDRAIN 1
#define ALT_PPULL 2 #define ALT_PPULL 2
#define ALT_OPDRAIN 3 #define ALT_OPDRAIN 3
// Exemple : // Exemple :
// Port_IO_Init(GPIOB, 8, OUTPUT, OUTPUT_PPULL); // Port_IO_Init(GPIOB, 8, OUTPUT, OUTPUT_PPULL);
// Place le bit 8 du port B en sortie Push-pull // Place le bit 8 du port B en sortie Push-pull
char GPIO_Configure(GPIO_TypeDef * Port, int Broche, int Sens, int Techno); char GPIO_Configure(GPIO_TypeDef * Port, int Broche, int Sens, int Techno);
/** /**
* @brief Mise à 1 d'une broche GPIO * @brief Mise à 1 d'une broche GPIO
* @note Une fonction par GPIO * @note Une fonction par GPIO
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @retval None * @retval None
*/ */
void GPIOA_Set(char Broche); void GPIOA_Set(char Broche);
void GPIOB_Set(char Broche); void GPIOB_Set(char Broche);
void GPIOC_Set(char Broche); void GPIOC_Set(char Broche);
/** /**
* @brief Mise à 0 d'une broche GPIO * @brief Mise à 0 d'une broche GPIO
* @note Une fonction par GPIO * @note Une fonction par GPIO
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @retval None * @retval None
*/ */
void GPIOA_Clear(char Broche); void GPIOA_Clear(char Broche);
void GPIOB_Clear(char Broche); void GPIOB_Clear(char Broche);
void GPIOC_Clear(char Broche); void GPIOC_Clear(char Broche);
#endif #endif

View file

@ -1,56 +1,56 @@
; Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR) ; Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR)
; Accès en aux fonctions suivantes : ; Accès en aux fonctions suivantes :
; GPIO : ; GPIO :
; GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche) ; GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche)
; GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche) ; GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche)
; PWM : ; PWM :
;/** ;/**
; * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif ; * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif
; * est donc : rcy = Thaut_ticks / Periode_ticks ; * est donc : rcy = Thaut_ticks / Periode_ticks
; * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3 ; * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3
; * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks ; * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks
; * @retval None ; * @retval None
; */ ; */
;void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks); ;void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks);
import PWM_Set_Value_TIM3_Ch3 import PWM_Set_Value_TIM3_Ch3
;/** ;/**
; * @brief Mise à 1 d'une broche GPIO ; * @brief Mise à 1 d'une broche GPIO
; * @note Une fonction par GPIO ; * @note Une fonction par GPIO
; * @param Broche : 0 à 15 ; * @param Broche : 0 à 15
; * @retval None ; * @retval None
; */ ; */
;void GPIOA_Set(char Broche); ;void GPIOA_Set(char Broche);
import GPIOA_Set import GPIOA_Set
;void GPIOB_Set(char Broche); ;void GPIOB_Set(char Broche);
import GPIOB_Set import GPIOB_Set
;void GPIOC_Set(char Broche); ;void GPIOC_Set(char Broche);
import GPIOC_Set import GPIOC_Set
;/** ;/**
; * @brief Mise à 0 d'une broche GPIO ; * @brief Mise à 0 d'une broche GPIO
; * @note Une fonction par GPIO ; * @note Une fonction par GPIO
; * @param Broche : 0 à 15 ; * @param Broche : 0 à 15
; * @retval None ; * @retval None
; */ ; */
;void GPIOA_Clear(char Broche); ;void GPIOA_Clear(char Broche);
import GPIOA_Clear import GPIOA_Clear
;void GPIOB_Clear(char Broche); ;void GPIOB_Clear(char Broche);
import GPIOB_Clear import GPIOB_Clear
;void GPIOC_Clear(char Broche); ;void GPIOC_Clear(char Broche);
import GPIOC_Clear import GPIOC_Clear
end end

View file

@ -1,206 +1,227 @@
PRESERVE8 PRESERVE8
THUMB THUMB
;include DriverJeuLaser.inc ;include DriverJeuLaser.inc
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
area mesdata,data,readonly area mesdata,data,readonly
;Section RAM (read write): ;Section RAM (read write):
area maram,data,readwrite area maram,data,readwrite
extern LeSignal extern LeSignal
export DFT_ModuleAuCarre export DFT_ModuleAuCarre
export TabCos export TabCos
; =============================================================================================== ; ===============================================================================================
;Section ROM code (read only) : ;Section ROM code (read only) :
area moncode,code,readonly area moncode,code,readonly
; écrire le code ici ; écrire le code ici
DFT_ModuleAuCarre proc ; r0 = tableau dft (tab_dft)
push{lr,r4-r9} ; r1 = indice k (fréquence calculée)
mov r2,#0
mov r3,#0 ; int DFT_ModuleAuCarre(short* tab_dft, int k)
mov r9,#0 DFT_ModuleAuCarre proc
boucle cmp r2,#63 push{lr,r4,r5,r6,r7,r8,r9}
bgt fin_boucle ;int i = 0
lsl r5,r2,#1 mov r2,#0
;ldr r0,=LeSignal ;int partie_relle= 0
ldrsh r4,[r0,r5] mov r3,#0
ldr r6, =TabCos ;int partie_imaginaire = 0
ldr r7, =TabSin mov r9,#0
;mul r5, r5, r1 ;for(i=0;i<64;i++) {
;mul r8, r1, r2 boucle cmp r2,#63
mul r5, r1 bgt fin_boucle
and r5, #127 ;int j = i*2
ldrsh r6,[r6,r5] lsl r5,r2,#1 ;indice utilisé pour le tableau de la dft (décallé de 1 car short)
ldrsh r7,[r7,r5] ;int dft_val = tab_dft[j]
mul r5, r6, r4 ldrsh r4,[r0,r5] ;lecture dans le tableau de dft
mul r8, r7, r4 ldr r6, =TabCos ; adresse de tabcos
add r3, r5 ldr r7, =TabSin ; adresse de tabsin
add r9, r8 ;j = (j*k)%64 (on calcul l'indice correspondant dans le tableau tabcos et tabsin pour le calcul de la dft
add r2, #1 mul r5, r1
b boucle and r5, #127
fin_boucle ; int icos = TabCos[j]
mov r0,r3 ;correspond à Re(X(k)) ldrsh r6,[r6,r5]
mov r1,r9 ;correspond à Im(X(k)) ; int isin = TabSin[j]
smull r2,r3,r0, r0 ldrsh r7,[r7,r5]
smull r4,r5,r1, r1 ; int res_cos = icos*dft_val
adds r0,r2,r4 mul r5, r6, r4
adc r1, r3, r5 ; int res_sin = isin*dft_val
mul r8, r7, r4
mov r0,r1
;partie_relle += res cos
pop{pc,r4-r9} add r3, r5
endp ;partie_imaginaire += res_sin
add r9, r8
add r2, #1
;Section ROM code (read only) : b boucle
AREA Trigo, DATA, READONLY ;}
; codage fractionnaire 1.15 ;//A la fin de la boucle, r3 contient Re(X(k) et r9 contient Im(X(k)
TabCos fin_boucle
DCW 32767 ; 0 0x7fff 0.99997 mov r0,r3 ;correspond à Re(X(k))
DCW 32610 ; 1 0x7f62 0.99518 mov r1,r9 ;correspond à Im(X(k))
DCW 32138 ; 2 0x7d8a 0.98077 ; int re_carre = (partie_relle)^2
DCW 31357 ; 3 0x7a7d 0.95694 smull r2,r3,r0, r0
DCW 30274 ; 4 0x7642 0.92389 ; int im_carre = (partie_imaginaire)^2
DCW 28899 ; 5 0x70e3 0.88193 smull r4,r5,r1, r1
DCW 27246 ; 6 0x6a6e 0.83148 ; int resultat_final = re_carre+im_carre
DCW 25330 ; 7 0x62f2 0.77301 adds r0,r2,r4 ; partie basse (moins intéressante)
DCW 23170 ; 8 0x5a82 0.70709 adc r1, r3, r5 ; partie haute du la somme finale (intéressante car contient chiffre avant virgule
DCW 20788 ; 9 0x5134 0.63440
DCW 18205 ; 10 0x471d 0.55557 mov r0,r1
DCW 15447 ; 11 0x3c57 0.47141
DCW 12540 ; 12 0x30fc 0.38269 pop{pc,r4,r5,r6,r7,r8,r9}
DCW 9512 ; 13 0x2528 0.29028 endp
DCW 6393 ; 14 0x18f9 0.19510
DCW 3212 ; 15 0x0c8c 0.09802
DCW 0 ; 16 0x0000 0.00000
DCW -3212 ; 17 0xf374 -0.09802 ;Section ROM code (read only) :
DCW -6393 ; 18 0xe707 -0.19510 AREA Trigo, DATA, READONLY
DCW -9512 ; 19 0xdad8 -0.29028 ; codage fractionnaire 1.15
DCW -12540 ; 20 0xcf04 -0.38269 TabCos
DCW -15447 ; 21 0xc3a9 -0.47141 DCW 32767 ; 0 0x7fff 0.99997
DCW -18205 ; 22 0xb8e3 -0.55557 DCW 32610 ; 1 0x7f62 0.99518
DCW -20788 ; 23 0xaecc -0.63440 DCW 32138 ; 2 0x7d8a 0.98077
DCW -23170 ; 24 0xa57e -0.70709 DCW 31357 ; 3 0x7a7d 0.95694
DCW -25330 ; 25 0x9d0e -0.77301 DCW 30274 ; 4 0x7642 0.92389
DCW -27246 ; 26 0x9592 -0.83148 DCW 28899 ; 5 0x70e3 0.88193
DCW -28899 ; 27 0x8f1d -0.88193 DCW 27246 ; 6 0x6a6e 0.83148
DCW -30274 ; 28 0x89be -0.92389 DCW 25330 ; 7 0x62f2 0.77301
DCW -31357 ; 29 0x8583 -0.95694 DCW 23170 ; 8 0x5a82 0.70709
DCW -32138 ; 30 0x8276 -0.98077 DCW 20788 ; 9 0x5134 0.63440
DCW -32610 ; 31 0x809e -0.99518 DCW 18205 ; 10 0x471d 0.55557
DCW -32768 ; 32 0x8000 -1.00000 DCW 15447 ; 11 0x3c57 0.47141
DCW -32610 ; 33 0x809e -0.99518 DCW 12540 ; 12 0x30fc 0.38269
DCW -32138 ; 34 0x8276 -0.98077 DCW 9512 ; 13 0x2528 0.29028
DCW -31357 ; 35 0x8583 -0.95694 DCW 6393 ; 14 0x18f9 0.19510
DCW -30274 ; 36 0x89be -0.92389 DCW 3212 ; 15 0x0c8c 0.09802
DCW -28899 ; 37 0x8f1d -0.88193 DCW 0 ; 16 0x0000 0.00000
DCW -27246 ; 38 0x9592 -0.83148 DCW -3212 ; 17 0xf374 -0.09802
DCW -25330 ; 39 0x9d0e -0.77301 DCW -6393 ; 18 0xe707 -0.19510
DCW -23170 ; 40 0xa57e -0.70709 DCW -9512 ; 19 0xdad8 -0.29028
DCW -20788 ; 41 0xaecc -0.63440 DCW -12540 ; 20 0xcf04 -0.38269
DCW -18205 ; 42 0xb8e3 -0.55557 DCW -15447 ; 21 0xc3a9 -0.47141
DCW -15447 ; 43 0xc3a9 -0.47141 DCW -18205 ; 22 0xb8e3 -0.55557
DCW -12540 ; 44 0xcf04 -0.38269 DCW -20788 ; 23 0xaecc -0.63440
DCW -9512 ; 45 0xdad8 -0.29028 DCW -23170 ; 24 0xa57e -0.70709
DCW -6393 ; 46 0xe707 -0.19510 DCW -25330 ; 25 0x9d0e -0.77301
DCW -3212 ; 47 0xf374 -0.09802 DCW -27246 ; 26 0x9592 -0.83148
DCW 0 ; 48 0x0000 0.00000 DCW -28899 ; 27 0x8f1d -0.88193
DCW 3212 ; 49 0x0c8c 0.09802 DCW -30274 ; 28 0x89be -0.92389
DCW 6393 ; 50 0x18f9 0.19510 DCW -31357 ; 29 0x8583 -0.95694
DCW 9512 ; 51 0x2528 0.29028 DCW -32138 ; 30 0x8276 -0.98077
DCW 12540 ; 52 0x30fc 0.38269 DCW -32610 ; 31 0x809e -0.99518
DCW 15447 ; 53 0x3c57 0.47141 DCW -32768 ; 32 0x8000 -1.00000
DCW 18205 ; 54 0x471d 0.55557 DCW -32610 ; 33 0x809e -0.99518
DCW 20788 ; 55 0x5134 0.63440 DCW -32138 ; 34 0x8276 -0.98077
DCW 23170 ; 56 0x5a82 0.70709 DCW -31357 ; 35 0x8583 -0.95694
DCW 25330 ; 57 0x62f2 0.77301 DCW -30274 ; 36 0x89be -0.92389
DCW 27246 ; 58 0x6a6e 0.83148 DCW -28899 ; 37 0x8f1d -0.88193
DCW 28899 ; 59 0x70e3 0.88193 DCW -27246 ; 38 0x9592 -0.83148
DCW 30274 ; 60 0x7642 0.92389 DCW -25330 ; 39 0x9d0e -0.77301
DCW 31357 ; 61 0x7a7d 0.95694 DCW -23170 ; 40 0xa57e -0.70709
DCW 32138 ; 62 0x7d8a 0.98077 DCW -20788 ; 41 0xaecc -0.63440
DCW 32610 ; 63 0x7f62 0.99518 DCW -18205 ; 42 0xb8e3 -0.55557
TabSin DCW -15447 ; 43 0xc3a9 -0.47141
DCW 0 ; 0 0x0000 0.00000 DCW -12540 ; 44 0xcf04 -0.38269
DCW 3212 ; 1 0x0c8c 0.09802 DCW -9512 ; 45 0xdad8 -0.29028
DCW 6393 ; 2 0x18f9 0.19510 DCW -6393 ; 46 0xe707 -0.19510
DCW 9512 ; 3 0x2528 0.29028 DCW -3212 ; 47 0xf374 -0.09802
DCW 12540 ; 4 0x30fc 0.38269 DCW 0 ; 48 0x0000 0.00000
DCW 15447 ; 5 0x3c57 0.47141 DCW 3212 ; 49 0x0c8c 0.09802
DCW 18205 ; 6 0x471d 0.55557 DCW 6393 ; 50 0x18f9 0.19510
DCW 20788 ; 7 0x5134 0.63440 DCW 9512 ; 51 0x2528 0.29028
DCW 23170 ; 8 0x5a82 0.70709 DCW 12540 ; 52 0x30fc 0.38269
DCW 25330 ; 9 0x62f2 0.77301 DCW 15447 ; 53 0x3c57 0.47141
DCW 27246 ; 10 0x6a6e 0.83148 DCW 18205 ; 54 0x471d 0.55557
DCW 28899 ; 11 0x70e3 0.88193 DCW 20788 ; 55 0x5134 0.63440
DCW 30274 ; 12 0x7642 0.92389 DCW 23170 ; 56 0x5a82 0.70709
DCW 31357 ; 13 0x7a7d 0.95694 DCW 25330 ; 57 0x62f2 0.77301
DCW 32138 ; 14 0x7d8a 0.98077 DCW 27246 ; 58 0x6a6e 0.83148
DCW 32610 ; 15 0x7f62 0.99518 DCW 28899 ; 59 0x70e3 0.88193
DCW 32767 ; 16 0x7fff 0.99997 DCW 30274 ; 60 0x7642 0.92389
DCW 32610 ; 17 0x7f62 0.99518 DCW 31357 ; 61 0x7a7d 0.95694
DCW 32138 ; 18 0x7d8a 0.98077 DCW 32138 ; 62 0x7d8a 0.98077
DCW 31357 ; 19 0x7a7d 0.95694 DCW 32610 ; 63 0x7f62 0.99518
DCW 30274 ; 20 0x7642 0.92389 TabSin
DCW 28899 ; 21 0x70e3 0.88193 DCW 0 ; 0 0x0000 0.00000
DCW 27246 ; 22 0x6a6e 0.83148 DCW 3212 ; 1 0x0c8c 0.09802
DCW 25330 ; 23 0x62f2 0.77301 DCW 6393 ; 2 0x18f9 0.19510
DCW 23170 ; 24 0x5a82 0.70709 DCW 9512 ; 3 0x2528 0.29028
DCW 20788 ; 25 0x5134 0.63440 DCW 12540 ; 4 0x30fc 0.38269
DCW 18205 ; 26 0x471d 0.55557 DCW 15447 ; 5 0x3c57 0.47141
DCW 15447 ; 27 0x3c57 0.47141 DCW 18205 ; 6 0x471d 0.55557
DCW 12540 ; 28 0x30fc 0.38269 DCW 20788 ; 7 0x5134 0.63440
DCW 9512 ; 29 0x2528 0.29028 DCW 23170 ; 8 0x5a82 0.70709
DCW 6393 ; 30 0x18f9 0.19510 DCW 25330 ; 9 0x62f2 0.77301
DCW 3212 ; 31 0x0c8c 0.09802 DCW 27246 ; 10 0x6a6e 0.83148
DCW 0 ; 32 0x0000 0.00000 DCW 28899 ; 11 0x70e3 0.88193
DCW -3212 ; 33 0xf374 -0.09802 DCW 30274 ; 12 0x7642 0.92389
DCW -6393 ; 34 0xe707 -0.19510 DCW 31357 ; 13 0x7a7d 0.95694
DCW -9512 ; 35 0xdad8 -0.29028 DCW 32138 ; 14 0x7d8a 0.98077
DCW -12540 ; 36 0xcf04 -0.38269 DCW 32610 ; 15 0x7f62 0.99518
DCW -15447 ; 37 0xc3a9 -0.47141 DCW 32767 ; 16 0x7fff 0.99997
DCW -18205 ; 38 0xb8e3 -0.55557 DCW 32610 ; 17 0x7f62 0.99518
DCW -20788 ; 39 0xaecc -0.63440 DCW 32138 ; 18 0x7d8a 0.98077
DCW -23170 ; 40 0xa57e -0.70709 DCW 31357 ; 19 0x7a7d 0.95694
DCW -25330 ; 41 0x9d0e -0.77301 DCW 30274 ; 20 0x7642 0.92389
DCW -27246 ; 42 0x9592 -0.83148 DCW 28899 ; 21 0x70e3 0.88193
DCW -28899 ; 43 0x8f1d -0.88193 DCW 27246 ; 22 0x6a6e 0.83148
DCW -30274 ; 44 0x89be -0.92389 DCW 25330 ; 23 0x62f2 0.77301
DCW -31357 ; 45 0x8583 -0.95694 DCW 23170 ; 24 0x5a82 0.70709
DCW -32138 ; 46 0x8276 -0.98077 DCW 20788 ; 25 0x5134 0.63440
DCW -32610 ; 47 0x809e -0.99518 DCW 18205 ; 26 0x471d 0.55557
DCW -32768 ; 48 0x8000 -1.00000 DCW 15447 ; 27 0x3c57 0.47141
DCW -32610 ; 49 0x809e -0.99518 DCW 12540 ; 28 0x30fc 0.38269
DCW -32138 ; 50 0x8276 -0.98077 DCW 9512 ; 29 0x2528 0.29028
DCW -31357 ; 51 0x8583 -0.95694 DCW 6393 ; 30 0x18f9 0.19510
DCW -30274 ; 52 0x89be -0.92389 DCW 3212 ; 31 0x0c8c 0.09802
DCW -28899 ; 53 0x8f1d -0.88193 DCW 0 ; 32 0x0000 0.00000
DCW -27246 ; 54 0x9592 -0.83148 DCW -3212 ; 33 0xf374 -0.09802
DCW -25330 ; 55 0x9d0e -0.77301 DCW -6393 ; 34 0xe707 -0.19510
DCW -23170 ; 56 0xa57e -0.70709 DCW -9512 ; 35 0xdad8 -0.29028
DCW -20788 ; 57 0xaecc -0.63440 DCW -12540 ; 36 0xcf04 -0.38269
DCW -18205 ; 58 0xb8e3 -0.55557 DCW -15447 ; 37 0xc3a9 -0.47141
DCW -15447 ; 59 0xc3a9 -0.47141 DCW -18205 ; 38 0xb8e3 -0.55557
DCW -12540 ; 60 0xcf04 -0.38269 DCW -20788 ; 39 0xaecc -0.63440
DCW -9512 ; 61 0xdad8 -0.29028 DCW -23170 ; 40 0xa57e -0.70709
DCW -6393 ; 62 0xe707 -0.19510 DCW -25330 ; 41 0x9d0e -0.77301
DCW -3212 ; 63 0xf374 -0.09802 DCW -27246 ; 42 0x9592 -0.83148
DCW -28899 ; 43 0x8f1d -0.88193
DCW -30274 ; 44 0x89be -0.92389
DCW -31357 ; 45 0x8583 -0.95694
DCW -32138 ; 46 0x8276 -0.98077
DCW -32610 ; 47 0x809e -0.99518
DCW -32768 ; 48 0x8000 -1.00000
DCW -32610 ; 49 0x809e -0.99518
DCW -32138 ; 50 0x8276 -0.98077
DCW -31357 ; 51 0x8583 -0.95694
DCW -30274 ; 52 0x89be -0.92389
DCW -28899 ; 53 0x8f1d -0.88193
DCW -27246 ; 54 0x9592 -0.83148
DCW -25330 ; 55 0x9d0e -0.77301
DCW -23170 ; 56 0xa57e -0.70709
DCW -20788 ; 57 0xaecc -0.63440
DCW -18205 ; 58 0xb8e3 -0.55557
DCW -15447 ; 59 0xc3a9 -0.47141
DCW -12540 ; 60 0xcf04 -0.38269
DCW -9512 ; 61 0xdad8 -0.29028
DCW -6393 ; 62 0xe707 -0.19510
DCW -3212 ; 63 0xf374 -0.09802
END END

View file

@ -1,33 +1,33 @@
#include "DriverJeuLaser.h" #include "DriverJeuLaser.h"
#include <stdio.h> #include <stdio.h>
extern int DFT_ModuleAuCarre(short int* Signal64ech, char k); extern int DFT_ModuleAuCarre(short int* Signal64ech, char k);
extern short int LeSignal[]; extern short int LeSignal[];
int result; int result;
int main(void) int main(void)
{ {
// =========================================================================== // ===========================================================================
// ============= INIT PERIPH (faites qu'une seule fois) ===================== // ============= INIT PERIPH (faites qu'une seule fois) =====================
// =========================================================================== // ===========================================================================
//printf("le résultat : %d \n", result); //printf("le résultat : %d \n", result);
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
CLOCK_Configure(); CLOCK_Configure();
result = DFT_ModuleAuCarre(&(LeSignal[0]),1); result = DFT_ModuleAuCarre(&(LeSignal[0]),1);
//============================================================================ //============================================================================
while (1) while (1)
{ {
} }
} }

View file

@ -1,335 +1,335 @@
;******************** (C) COPYRIGHT 2011 STMicroelectronics ******************** ;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
;* File Name : startup_stm32f10x_md.s ;* File Name : startup_stm32f10x_md.s
;* Author : MCD Application Team ;* Author : MCD Application Team
;* Version : V3.5.0 ;* Version : V3.5.0
;* Date : 11-March-2011 ;* Date : 11-March-2011
;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM ;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM
;* toolchain. ;* toolchain.
;* This module performs: ;* This module performs:
;* - Set the initial SP ;* - Set the initial SP
;* - Set the initial PC == Reset_Handler ;* - Set the initial PC == Reset_Handler
;* - Set the vector table entries with the exceptions ISR address ;* - Set the vector table entries with the exceptions ISR address
;* - Configure the clock system ;* - Configure the clock system
;* - Branches to __main in the C library (which eventually ;* - Branches to __main in the C library (which eventually
;* calls main()). ;* calls main()).
;* After Reset the CortexM3 processor is in Thread mode, ;* After Reset the CortexM3 processor is in Thread mode,
;* priority is Privileged, and the Stack is set to Main. ;* priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>> ;* <<< Use Configuration Wizard in Context Menu >>>
;******************************************************************************* ;*******************************************************************************
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS ; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. ; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, ; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE ; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING ; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
;******************************************************************************* ;*******************************************************************************
; Amount of memory (in bytes) allocated for Stack ; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs ; Tailor this value to your application needs
; <h> Stack Configuration ; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h> ; </h>
Stack_Size EQU 0x00000400 Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3 AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size Stack_Mem SPACE Stack_Size
__initial_sp __initial_sp
; <h> Heap Configuration ; <h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h> ; </h>
Heap_Size EQU 0x00000200 Heap_Size EQU 0x00000200
AREA HEAP, NOINIT, READWRITE, ALIGN=3 AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base __heap_base
Heap_Mem SPACE Heap_Size Heap_Mem SPACE Heap_Size
__heap_limit __heap_limit
PRESERVE8 PRESERVE8
THUMB THUMB
; Vector Table Mapped to Address 0 at Reset ; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY AREA RESET, DATA, READONLY
EXPORT __Vectors EXPORT __Vectors
EXPORT __Vectors_End EXPORT __Vectors_End
EXPORT __Vectors_Size EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack __Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler DCD SysTick_Handler ; SysTick Handler
; External Interrupts ; External Interrupts
DCD WWDG_IRQHandler ; Window Watchdog DCD WWDG_IRQHandler ; Window Watchdog
DCD PVD_IRQHandler ; PVD through EXTI Line detect DCD PVD_IRQHandler ; PVD through EXTI Line detect
DCD TAMPER_IRQHandler ; Tamper DCD TAMPER_IRQHandler ; Tamper
DCD RTC_IRQHandler ; RTC DCD RTC_IRQHandler ; RTC
DCD FLASH_IRQHandler ; Flash DCD FLASH_IRQHandler ; Flash
DCD RCC_IRQHandler ; RCC DCD RCC_IRQHandler ; RCC
DCD EXTI0_IRQHandler ; EXTI Line 0 DCD EXTI0_IRQHandler ; EXTI Line 0
DCD EXTI1_IRQHandler ; EXTI Line 1 DCD EXTI1_IRQHandler ; EXTI Line 1
DCD EXTI2_IRQHandler ; EXTI Line 2 DCD EXTI2_IRQHandler ; EXTI Line 2
DCD EXTI3_IRQHandler ; EXTI Line 3 DCD EXTI3_IRQHandler ; EXTI Line 3
DCD EXTI4_IRQHandler ; EXTI Line 4 DCD EXTI4_IRQHandler ; EXTI Line 4
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2 DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3 DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4 DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5 DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6 DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7 DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
DCD ADC1_2_IRQHandler ; ADC1_2 DCD ADC1_2_IRQHandler ; ADC1_2
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0 DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_RX1_IRQHandler ; CAN1 RX1
DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD CAN1_SCE_IRQHandler ; CAN1 SCE
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5 DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
DCD TIM1_BRK_IRQHandler ; TIM1 Break DCD TIM1_BRK_IRQHandler ; TIM1 Break
DCD TIM1_UP_IRQHandler ; TIM1 Update DCD TIM1_UP_IRQHandler ; TIM1 Update
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
DCD TIM2_IRQHandler ; TIM2 DCD TIM2_IRQHandler ; TIM2
DCD TIM3_IRQHandler ; TIM3 DCD TIM3_IRQHandler ; TIM3
DCD TIM4_IRQHandler ; TIM4 DCD TIM4_IRQHandler ; TIM4
DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_EV_IRQHandler ; I2C1 Event
DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C1_ER_IRQHandler ; I2C1 Error
DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_EV_IRQHandler ; I2C2 Event
DCD I2C2_ER_IRQHandler ; I2C2 Error DCD I2C2_ER_IRQHandler ; I2C2 Error
DCD SPI1_IRQHandler ; SPI1 DCD SPI1_IRQHandler ; SPI1
DCD SPI2_IRQHandler ; SPI2 DCD SPI2_IRQHandler ; SPI2
DCD USART1_IRQHandler ; USART1 DCD USART1_IRQHandler ; USART1
DCD USART2_IRQHandler ; USART2 DCD USART2_IRQHandler ; USART2
DCD USART3_IRQHandler ; USART3 DCD USART3_IRQHandler ; USART3
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10 DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
__Vectors_End __Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors __Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY AREA |.text|, CODE, READONLY
; Reset handler ; Reset handler
Reset_Handler PROC Reset_Handler PROC
EXPORT Reset_Handler [WEAK] EXPORT Reset_Handler [WEAK]
IMPORT __main IMPORT __main
LDR R0, =SystemInit LDR R0, =SystemInit
BLX R0 BLX R0
; ;
; Enable UsageFault, MemFault and Busfault interrupts ; Enable UsageFault, MemFault and Busfault interrupts
; ;
_SHCSR EQU 0xE000ED24 ; SHCSR is located at address 0xE000ED24 _SHCSR EQU 0xE000ED24 ; SHCSR is located at address 0xE000ED24
LDR.W R0, =_SHCSR LDR.W R0, =_SHCSR
LDR R1, [R0] ; Read CPACR LDR R1, [R0] ; Read CPACR
ORR R1, R1, #(0x7 << 16) ; Set bits 16,17,18 to enable usagefault, busfault, memfault interrupts ORR R1, R1, #(0x7 << 16) ; Set bits 16,17,18 to enable usagefault, busfault, memfault interrupts
STR R1, [R0] ; Write back the modified value to the CPACR STR R1, [R0] ; Write back the modified value to the CPACR
DSB ; Wait for store to complete DSB ; Wait for store to complete
; ;
; Set priority grouping (PRIGROUP) in AIRCR to 3 (16 levels for group priority and 0 for subpriority) ; Set priority grouping (PRIGROUP) in AIRCR to 3 (16 levels for group priority and 0 for subpriority)
; ;
_AIRCR EQU 0xE000ED0C _AIRCR EQU 0xE000ED0C
_AIRCR_VAL EQU 0x05FA0300 _AIRCR_VAL EQU 0x05FA0300
LDR.W R0, =_AIRCR LDR.W R0, =_AIRCR
LDR.W R1, =_AIRCR_VAL LDR.W R1, =_AIRCR_VAL
STR R1,[R0] STR R1,[R0]
; ;
; Finaly, jump to main function (void main (void)) ; Finaly, jump to main function (void main (void))
; ;
LDR R0, =__main LDR R0, =__main
BX R0 BX R0
ENDP ENDP
SystemInit PROC SystemInit PROC
EXPORT SystemInit [WEAK] EXPORT SystemInit [WEAK]
BX LR BX LR
ENDP ENDP
; Dummy Exception Handlers (infinite loops which can be modified) ; Dummy Exception Handlers (infinite loops which can be modified)
NMI_Handler PROC NMI_Handler PROC
EXPORT NMI_Handler [WEAK] EXPORT NMI_Handler [WEAK]
B . B .
ENDP ENDP
HardFault_Handler\ HardFault_Handler\
PROC PROC
EXPORT HardFault_Handler [WEAK] EXPORT HardFault_Handler [WEAK]
B . B .
ENDP ENDP
MemManage_Handler\ MemManage_Handler\
PROC PROC
EXPORT MemManage_Handler [WEAK] EXPORT MemManage_Handler [WEAK]
B . B .
ENDP ENDP
BusFault_Handler\ BusFault_Handler\
PROC PROC
EXPORT BusFault_Handler [WEAK] EXPORT BusFault_Handler [WEAK]
B . B .
ENDP ENDP
UsageFault_Handler\ UsageFault_Handler\
PROC PROC
EXPORT UsageFault_Handler [WEAK] EXPORT UsageFault_Handler [WEAK]
B . B .
ENDP ENDP
SVC_Handler PROC SVC_Handler PROC
EXPORT SVC_Handler [WEAK] EXPORT SVC_Handler [WEAK]
B . B .
ENDP ENDP
DebugMon_Handler\ DebugMon_Handler\
PROC PROC
EXPORT DebugMon_Handler [WEAK] EXPORT DebugMon_Handler [WEAK]
B . B .
ENDP ENDP
PendSV_Handler PROC PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK] EXPORT PendSV_Handler [WEAK]
B . B .
ENDP ENDP
SysTick_Handler PROC SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK] EXPORT SysTick_Handler [WEAK]
B . B .
ENDP ENDP
Default_Handler PROC Default_Handler PROC
EXPORT WWDG_IRQHandler [WEAK] EXPORT WWDG_IRQHandler [WEAK]
EXPORT PVD_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK]
EXPORT TAMPER_IRQHandler [WEAK] EXPORT TAMPER_IRQHandler [WEAK]
EXPORT RTC_IRQHandler [WEAK] EXPORT RTC_IRQHandler [WEAK]
EXPORT FLASH_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK]
EXPORT RCC_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK]
EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK]
EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK]
EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK]
EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK]
EXPORT EXTI4_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK]
EXPORT DMA1_Channel1_IRQHandler [WEAK] EXPORT DMA1_Channel1_IRQHandler [WEAK]
EXPORT DMA1_Channel2_IRQHandler [WEAK] EXPORT DMA1_Channel2_IRQHandler [WEAK]
EXPORT DMA1_Channel3_IRQHandler [WEAK] EXPORT DMA1_Channel3_IRQHandler [WEAK]
EXPORT DMA1_Channel4_IRQHandler [WEAK] EXPORT DMA1_Channel4_IRQHandler [WEAK]
EXPORT DMA1_Channel5_IRQHandler [WEAK] EXPORT DMA1_Channel5_IRQHandler [WEAK]
EXPORT DMA1_Channel6_IRQHandler [WEAK] EXPORT DMA1_Channel6_IRQHandler [WEAK]
EXPORT DMA1_Channel7_IRQHandler [WEAK] EXPORT DMA1_Channel7_IRQHandler [WEAK]
EXPORT ADC1_2_IRQHandler [WEAK] EXPORT ADC1_2_IRQHandler [WEAK]
EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK] EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK] EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK]
EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK]
EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK]
EXPORT TIM1_BRK_IRQHandler [WEAK] EXPORT TIM1_BRK_IRQHandler [WEAK]
EXPORT TIM1_UP_IRQHandler [WEAK] EXPORT TIM1_UP_IRQHandler [WEAK]
EXPORT TIM1_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK]
EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK]
EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK]
EXPORT TIM4_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK]
EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK]
EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK]
EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK]
EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK]
EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK]
EXPORT SPI2_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK]
EXPORT USART1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK]
EXPORT USART2_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK]
EXPORT USART3_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK]
EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK]
EXPORT RTCAlarm_IRQHandler [WEAK] EXPORT RTCAlarm_IRQHandler [WEAK]
EXPORT USBWakeUp_IRQHandler [WEAK] EXPORT USBWakeUp_IRQHandler [WEAK]
WWDG_IRQHandler WWDG_IRQHandler
PVD_IRQHandler PVD_IRQHandler
TAMPER_IRQHandler TAMPER_IRQHandler
RTC_IRQHandler RTC_IRQHandler
FLASH_IRQHandler FLASH_IRQHandler
RCC_IRQHandler RCC_IRQHandler
EXTI0_IRQHandler EXTI0_IRQHandler
EXTI1_IRQHandler EXTI1_IRQHandler
EXTI2_IRQHandler EXTI2_IRQHandler
EXTI3_IRQHandler EXTI3_IRQHandler
EXTI4_IRQHandler EXTI4_IRQHandler
DMA1_Channel1_IRQHandler DMA1_Channel1_IRQHandler
DMA1_Channel2_IRQHandler DMA1_Channel2_IRQHandler
DMA1_Channel3_IRQHandler DMA1_Channel3_IRQHandler
DMA1_Channel4_IRQHandler DMA1_Channel4_IRQHandler
DMA1_Channel5_IRQHandler DMA1_Channel5_IRQHandler
DMA1_Channel6_IRQHandler DMA1_Channel6_IRQHandler
DMA1_Channel7_IRQHandler DMA1_Channel7_IRQHandler
ADC1_2_IRQHandler ADC1_2_IRQHandler
USB_HP_CAN1_TX_IRQHandler USB_HP_CAN1_TX_IRQHandler
USB_LP_CAN1_RX0_IRQHandler USB_LP_CAN1_RX0_IRQHandler
CAN1_RX1_IRQHandler CAN1_RX1_IRQHandler
CAN1_SCE_IRQHandler CAN1_SCE_IRQHandler
EXTI9_5_IRQHandler EXTI9_5_IRQHandler
TIM1_BRK_IRQHandler TIM1_BRK_IRQHandler
TIM1_UP_IRQHandler TIM1_UP_IRQHandler
TIM1_TRG_COM_IRQHandler TIM1_TRG_COM_IRQHandler
TIM1_CC_IRQHandler TIM1_CC_IRQHandler
TIM2_IRQHandler TIM2_IRQHandler
TIM3_IRQHandler TIM3_IRQHandler
TIM4_IRQHandler TIM4_IRQHandler
I2C1_EV_IRQHandler I2C1_EV_IRQHandler
I2C1_ER_IRQHandler I2C1_ER_IRQHandler
I2C2_EV_IRQHandler I2C2_EV_IRQHandler
I2C2_ER_IRQHandler I2C2_ER_IRQHandler
SPI1_IRQHandler SPI1_IRQHandler
SPI2_IRQHandler SPI2_IRQHandler
USART1_IRQHandler USART1_IRQHandler
USART2_IRQHandler USART2_IRQHandler
USART3_IRQHandler USART3_IRQHandler
EXTI15_10_IRQHandler EXTI15_10_IRQHandler
RTCAlarm_IRQHandler RTCAlarm_IRQHandler
USBWakeUp_IRQHandler USBWakeUp_IRQHandler
B . B .
ENDP ENDP
ALIGN ALIGN
;******************************************************************************* ;*******************************************************************************
; User Stack and Heap initialization ; User Stack and Heap initialization
;******************************************************************************* ;*******************************************************************************
IF :DEF:__MICROLIB IF :DEF:__MICROLIB
EXPORT __initial_sp EXPORT __initial_sp
EXPORT __heap_base EXPORT __heap_base
EXPORT __heap_limit EXPORT __heap_limit
ELSE ELSE
IMPORT __use_two_region_memory IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap EXPORT __user_initial_stackheap
__user_initial_stackheap __user_initial_stackheap
LDR R0, = Heap_Mem LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size) LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size) LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem LDR R3, = Stack_Mem
BX LR BX LR
ALIGN ALIGN
ENDIF ENDIF
END END
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE***** ;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****

View file

@ -1,7 +1,7 @@
PRESERVE8 PRESERVE8
THUMB THUMB
include DriverJeuLaser.inc include .\Driver\DriverJeuLaser.inc
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
@ -63,46 +63,44 @@ StartSon proc
pop {pc} pop {pc}
endp endp
;CallbackSon mov r0,=Son ;CallbackSon mov r0,=Son
CallbackSon proc CallbackSon proc
; On récupère l'adresse du tableau Son et de l'index ; On récupère l'adresse du tableau Son et de l'index
push {lr} push {lr}
ldr r0,=Son ldr r0,=Son ;contient l'adresse du tableau Son
ldr r2,=Index ldr r2,=Index
ldr r3,[r2] ldr r3,[r2] ;contient la valeur de Index
; if(index < LongueurSon) ; if(index < LongueurSon)
push {r0} push {r0}
ldr r0,=LongueurSon ldr r0,=LongueurSon
cmp r0, r2 cmp r0, r2
bge exit bge exit ; on quitte dans le cas contraire
pop{r0} pop{r0}
; sortieSon = (Son[index] +decalage)*echelle ; sortieSon = (Son[index] +decalage)*echelle
; On lit Son[index] ldrsh r1, [r0,r3,lsl #1] ;r1 contient Son[Index]
ldrsh r1, [r0,r3,lsl #1] ldr r0,=SortieSon ;r0 contient l'adresse de la variable SortieSon où on lira le son
ldr r0,=SortieSon
;mise à echelle ;mise à echelle
push {r0,r2,r3} push {r0,r2,r3}
; Variable décalage ; Variable décalage
mov r3,#1 mov r3,#1
lsl r0,r3,#15 lsl r0,r3,#15
add r1,r1,r0 add r1,r1,r0 ;ajout de decalage à Son[index]
;Calcul mise à l'échelle (719/2^16) ;Calcul mise à l'échelle (719/2^16)
ldr r2,=Res ldr r2,=Res ; Res contient 719
ldrh r2,[r2] ldrh r2,[r2] ; on met 719 dans r2
mul r1,r1,r2 mul r1,r1,r2 ; on multiplie 719 par (Son[Index]+decalage) dans r1
lsr r1,r1,#16 lsr r1,r1,#16 ; on divise par 2^16 dans r1
pop {r0,r2,r3} pop {r0,r2,r3}
;fin mise à échelle ;fin mise à échelle
strh r1,[r0] ; On écrit cette valeur dans SortieSon strh r1,[r0] ; On écrit cette valeur dans SortieSon
mov r0,r1 mov r0,r1 ; r0 contient la valeur de SortieSon (donnée en argument de la fonction suivante)
bl PWM_Set_Value_TIM3_Ch3 bl PWM_Set_Value_TIM3_Ch3
; index += 1; ; index += 1;
add r3,r3,#1 add r3,r3,#1
str r3,[r2] ; On ajoute 2 à l'index str r3,[r2] ; On ajoute 2 à l'index
@ -110,4 +108,5 @@ exit pop {pc}
endp endp
END END

View file

@ -0,0 +1,78 @@
/* Fichier devant contenir l'ensemble de fichiers utiles pour le projet LaserQuest
et qui concenent l'affichage sur la valise */
/* mais non disponible en version source pour les étudiants. */
#ifndef _AFFICHAGE_VALISE_H__
#define _AFFICHAGE_VALISE_H__
#include "stm32f10x.h"
/**
* @brief Initialise les périphériques nécessaires à l'affichage sur la Mallette
* et gère la cible active. S'utilise aussi avec les ùmodules affichages simple (pas de mallette)
* @note Utilise TIM1, PA5, PA6 pour les cibles, PC7 à PC9 pour SPI émulé
* utilise aussi une interruption sut TIM1, prio 8.
* @param none
* @retval None
*/
void Init_Affichage(void);
/**
* @brief Prépare l'affichage 2 digit sur l'afficheur demandé
* @note Exemple : Prepare_Afficheur(2, 99);
* prépare l'affichage de la valeur 99 sur l'afficheur n°2
* L'action est différée à l'exécution de Mise_A_Jour_Afficheurs_LED()
* @param char Aff : de 1 à 4 ; char Valeur de 0 à 99
* @retval None
*/
void Prepare_Afficheur(char Aff, char Valeur);
void Prepare_Set_Point_Unite(char Aff);
void Prepare_Clear_Point_Unite(char Aff);
/**
* @brief Prépare l'allumage de la LED demandée
* @note Exemple : Prepare_Set_LED(LED_Cible_2);
* prépare l'allumage de la LED correspondant à la cible n°2
* L'action est différée à l'exécution de Mise_A_Jour_Afficheurs_LED()
* @param voir #define ci-dessous
* @retval None
*/
void Prepare_Set_LED(char LED);
void Prepare_Clear_LED(char LED);
/**
* @brief Effectue l'action d'écriture dans le module d'affichage
* à partir de tout ce qui a é préparé auparavant.
* @note
* @param None
* @retval None
*/
void Mise_A_Jour_Afficheurs_LED(void);
/**
* @brief Spécifie le capteut actif, à savoir celui effectivement relié
* aux sorties disponibles sur la malette
* @note Exemple : Choix_Capteur(1)
* @param 1 à 4
* @retval None
*/
void Choix_Capteur(char Capteur);
// define utile pour la fonction Prepare_Set_LED et Prepare_Clear_LED
#define LED_LCD_R 5
#define LED_LCD_V 4
#define LED_Cible_4 3
#define LED_Cible_3 2
#define LED_Cible_2 1
#define LED_Cible_1 0
#endif

View file

@ -1,345 +1,345 @@
/** /**
* Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR) * Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR)
* *
* GPIO - ADC - Sequenceur - System Timer - PWM - 72 MHz * GPIO - ADC - Sequenceur - System Timer - PWM - 72 MHz
* Modifs : * Modifs :
* enlèvement de tout ce qui est inutile dans le .h * enlèvement de tout ce qui est inutile dans le .h
* ajout de fonctions GPIO dans le .c pour utilisation en ASM ou en C : * ajout de fonctions GPIO dans le .c pour utilisation en ASM ou en C :
* - GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche) * - GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche)
* - GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche) * - GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche)
* *
* ajout d'une fonction qui impose une valeur de PWM (TIM3_CCR3) * ajout d'une fonction qui impose une valeur de PWM (TIM3_CCR3)
* PWM_Set_Value_On_TIM3_C3( int Val) * PWM_Set_Value_On_TIM3_C3( int Val)
* permet en ASM ou en C de fixer la valeur de PWM * permet en ASM ou en C de fixer la valeur de PWM
* Ajout de commentaires * Ajout de commentaires
*/ */
#ifndef DRIVERJEULASER_H__ #ifndef DRIVERJEULASER_H__
#define DRIVERJEULASER_H__ #define DRIVERJEULASER_H__
#include "stm32f10x.h" #include "stm32f10x.h"
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- CONFIGURATION CLOCK DU STM32 -------------------------------------- //--------------------- CONFIGURATION CLOCK DU STM32 --------------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure l'ensemble des horloges du uC * @brief Configure l'ensemble des horloges du uC
* @note horloge systeme (config statique a 72 MHz pour le STM32F103) * @note horloge systeme (config statique a 72 MHz pour le STM32F103)
* @param None * @param None
* @retval None * @retval None
*/ */
void CLOCK_Configure(void); void CLOCK_Configure(void);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LES TIMERS GENERAL PURPOSE TIM1 à TIM 4 ------------------------------ //--------------------- LES TIMERS GENERAL PURPOSE TIM1 à TIM 4 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure un Timer TIM1 à TIM4 avec une périodicité donnée * @brief Configure un Timer TIM1 à TIM4 avec une périodicité donnée
* @note L' horloge des 4 timers a une fréquence de 72MHz * @note L' horloge des 4 timers a une fréquence de 72MHz
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param Durée_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Durée_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
void Timer_1234_Init_ff( TIM_TypeDef *Timer, u32 Duree_ticks ); void Timer_1234_Init_ff( TIM_TypeDef *Timer, u32 Duree_ticks );
/** /**
* Macros de base pour utiliser les timers * Macros de base pour utiliser les timers
*/ */
// bloque le timer // bloque le timer
#define Bloque_Timer(Timer) Timer->CR1=(Timer->CR1)&~(1<<0) #define Bloque_Timer(Timer) Timer->CR1=(Timer->CR1)&~(1<<0)
// Lance timer // Lance timer
#define Run_Timer(Timer) Timer->CR1=(Timer->CR1)|(1<<0) #define Run_Timer(Timer) Timer->CR1=(Timer->CR1)|(1<<0)
/** /**
* @brief Associe une fonction d'interruption (callback) lors du débordement d'un timer * @brief Associe une fonction d'interruption (callback) lors du débordement d'un timer
* @note * @note
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min) * @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min)
* @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption * @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption
* @retval None * @retval None
*/ */
void Active_IT_Debordement_Timer( TIM_TypeDef *Timer, char Prio, void (*IT_function)(void) ); void Active_IT_Debordement_Timer( TIM_TypeDef *Timer, char Prio, void (*IT_function)(void) );
//********************************************************************************************************* //*********************************************************************************************************
//--------------------- PWM TIM1 to TIM 4 ------------------------------ //--------------------- PWM TIM1 to TIM 4 ------------------------------
//********************************************************************************************************* //*********************************************************************************************************
/** /**
* @brief Configure un timer en PWM * @brief Configure un timer en PWM
* @note * @note
* @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4 * @param *Timer = TIM1 ou TIM2 ou TIM3 ou TIM4
* @param voie : un des 4 canaux possibles 1 à 4. * @param voie : un des 4 canaux possibles 1 à 4.
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval Retourne la période en tick (normalement la même que le param d'entrée sauf si PSC utilisé * @retval Retourne la période en tick (normalement la même que le param d'entrée sauf si PSC utilisé
*/ */
unsigned short int PWM_Init_ff( TIM_TypeDef *Timer, char Voie, u32 Periode_ticks ); unsigned short int PWM_Init_ff( TIM_TypeDef *Timer, char Voie, u32 Periode_ticks );
/** /**
* @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif
* est donc : rcy = Thaut_ticks / Periode_ticks * est donc : rcy = Thaut_ticks / Periode_ticks
* @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3 * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3
* @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks
* @retval None * @retval None
*/ */
void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks); void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------ //--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Configure le timer Systick avec une périodicité donnée * @brief Configure le timer Systick avec une périodicité donnée
* @note Ce timer ne peut servir qu'à créer des temporisations ou générer des interruption * @note Ce timer ne peut servir qu'à créer des temporisations ou générer des interruption
* ce n'est pas à proprement parler un périphérique, il fait partie du Cortex M3 * ce n'est pas à proprement parler un périphérique, il fait partie du Cortex M3
* Ce timer est un 24 bits * Ce timer est un 24 bits
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour établir la périodicité * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour établir la périodicité
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
void Systick_Period_ff( unsigned int Periode_ticks ); void Systick_Period_ff( unsigned int Periode_ticks );
/** /**
* @brief Associe une fonction d'interruption (callback) lors du débordement du Systick * @brief Associe une fonction d'interruption (callback) lors du débordement du Systick
* @note * @note
* @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min) * @param Prio : niveau de priorité de l'interruption (0 -> priorité max, 15 -> priorité min)
* @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption * @param IT_function : le nom de la fonction Callback à appeler lors de l'interruption
* @retval None * @retval None
*/ */
void Systick_Prio_IT( char Prio, void (*Systick_function)(void) ); void Systick_Prio_IT( char Prio, void (*Systick_function)(void) );
/** /**
* Macros de base pour utiliser le Systick * Macros de base pour utiliser le Systick
*/ */
#define SysTick_On ((SysTick->CTRL)=(SysTick->CTRL)|1<<0) #define SysTick_On ((SysTick->CTRL)=(SysTick->CTRL)|1<<0)
#define SysTick_Off ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<0)) #define SysTick_Off ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<0))
#define SysTick_Enable_IT ((SysTick->CTRL)=(SysTick->CTRL)|1<<1) #define SysTick_Enable_IT ((SysTick->CTRL)=(SysTick->CTRL)|1<<1)
#define SysTick_Disable_IT ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<1)) #define SysTick_Disable_IT ((SysTick->CTRL)=(SysTick->CTRL)& ~(1<<1))
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------ //--------------------- LE SYSTICK TIMER, Part of Cortex M3 ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Active l'ADC du STM32, configure la durée de prélèvement de l'échantillon (temps * @brief Active l'ADC du STM32, configure la durée de prélèvement de l'échantillon (temps
* de fermeture du switch d'acquisition * de fermeture du switch d'acquisition
* @note * @note
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Duree_Ech_ticks : dirée de fermeture du switch d'échantillonnage en Tick d'horloge CPU * @param Duree_Ech_ticks : dirée de fermeture du switch d'échantillonnage en Tick d'horloge CPU
* exemple pour 1µs on choisira 72. * exemple pour 1µs on choisira 72.
* @retval Nombre de Tick réellement pris en compte * @retval Nombre de Tick réellement pris en compte
*/ */
unsigned int Init_TimingADC_ActiveADC_ff( ADC_TypeDef * ADC, u32 Duree_Ech_ticks ); unsigned int Init_TimingADC_ActiveADC_ff( ADC_TypeDef * ADC, u32 Duree_Ech_ticks );
/** /**
* @brief Sélectionne la voie à convertir * @brief Sélectionne la voie à convertir
* @note Attention, la voie va de 0 à 15 et n'est pas directement lié au n°de GPIO * @note Attention, la voie va de 0 à 15 et n'est pas directement lié au n°de GPIO
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Voie_ADC : 1 à 15 * @param Voie_ADC : 1 à 15
* @retval None * @retval None
*/ */
void Single_Channel_ADC( ADC_TypeDef * ADC, char Voie_ADC ); void Single_Channel_ADC( ADC_TypeDef * ADC, char Voie_ADC );
/** /**
* @brief Permet lier le déclenchement au débordement d'un timer, spécifie également * @brief Permet lier le déclenchement au débordement d'un timer, spécifie également
* la période de débordement du timer * la période de débordement du timer
* @note pas besoin de régler le timer avec une autre fonction dédiée timer * @note pas besoin de régler le timer avec une autre fonction dédiée timer
* @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2 * @param ADC : précise de quel ADC il s'agit, ADC1 ou ADC2
* @param Source : indique le timer qui déclenche l'ADC choix dans les define ci-dessous * @param Source : indique le timer qui déclenche l'ADC choix dans les define ci-dessous
* @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer * @param Periode_ticks : nombre de pas (tick) comptés à 72 MHz pour faire déborder le timer
* La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000 * La période de débordement du Timer est donc T = Durée_ticks * Tck, avec Tck = 1/72 000 000
* @retval None * @retval None
*/ */
// param pour Source : // param pour Source :
#define TIM1_CC1 0 #define TIM1_CC1 0
#define TIM1_CC2 1 #define TIM1_CC2 1
#define TIM1_CC3 2 #define TIM1_CC3 2
#define TIM2_CC2 3 #define TIM2_CC2 3
#define TIM4_CC4 5 #define TIM4_CC4 5
void Init_Conversion_On_Trig_Timer_ff( ADC_TypeDef * ADC, char Source, u32 Periode_ticks ); void Init_Conversion_On_Trig_Timer_ff( ADC_TypeDef * ADC, char Source, u32 Periode_ticks );
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- ANALOG INPUT ADC & DMA ------------------------------ //--------------------- ANALOG INPUT ADC & DMA ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Permer de lier l'ADC à un tableau en RAM pour une DMA * @brief Permer de lier l'ADC à un tableau en RAM pour une DMA
* @note * @note
* @param Circ : circular. Si '0', en fin de DMA le ptr d'@ reste inchangé * @param Circ : circular. Si '0', en fin de DMA le ptr d'@ reste inchangé
* si '1' le ptr d'@ se recale à celle du début. * si '1' le ptr d'@ se recale à celle du début.
* @param Ptr_Table_DMA : contient l'@ de début de zone RAM à écrire * @param Ptr_Table_DMA : contient l'@ de début de zone RAM à écrire
* @retval None * @retval None
*/ */
void Init_ADC1_DMA1(char Circ, short int *Ptr_Table_DMA); void Init_ADC1_DMA1(char Circ, short int *Ptr_Table_DMA);
/** /**
* @brief Lance une DMA sur le nombre de points spécifie. Les resultats seront stockes * @brief Lance une DMA sur le nombre de points spécifie. Les resultats seront stockes
* dans la zone de RAM écrite est indiquée lors de l'appel de la fonction Init_ADC1_DMA1 * dans la zone de RAM écrite est indiquée lors de l'appel de la fonction Init_ADC1_DMA1
* @note * @note
* @param NbEchDMA est le nombre d'échantillons à stocker. * @param NbEchDMA est le nombre d'échantillons à stocker.
* @retval None * @retval None
*/ */
void Start_DMA1( u16 NbEchDMA ); void Start_DMA1( u16 NbEchDMA );
// arret DMA // arret DMA
#define Stop_DMA1 DMA1_Channel1->CCR =(DMA1_Channel1->CCR) &~0x1; #define Stop_DMA1 DMA1_Channel1->CCR =(DMA1_Channel1->CCR) &~0x1;
/** /**
* @brief Attend la fin d'un cycle de DMA. la duree depend de la periode d'acquisition * @brief Attend la fin d'un cycle de DMA. la duree depend de la periode d'acquisition
* et du nombre d'echantillons * et du nombre d'echantillons
* @note fonction d'attente (bloquante) * @note fonction d'attente (bloquante)
* @param None * @param None
* @retval None * @retval None
*/ */
void Wait_On_End_Of_DMA1(void); void Wait_On_End_Of_DMA1(void);
//********************************************************************************************************** //**********************************************************************************************************
//--------------------- GPIO ------------------------------ //--------------------- GPIO ------------------------------
//********************************************************************************************************** //**********************************************************************************************************
/** /**
* @brief Initialisation d'un GPIO (A à C), pin x. * @brief Initialisation d'un GPIO (A à C), pin x.
* peut être configuré : * peut être configuré :
* -> Input ou output * -> Input ou output
* -> architecture technologique (push-pull, open drain...) * -> architecture technologique (push-pull, open drain...)
* @note * @note
* @param Port : GPIOA, GPIOB, GPIOC * @param Port : GPIOA, GPIOB, GPIOC
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @param Sens : INPUT ou OUTPUT * @param Sens : INPUT ou OUTPUT
* @param Techno : voir define ci dessous * @param Techno : voir define ci dessous
* @retval 1 erreur, 0 si OK * @retval 1 erreur, 0 si OK
*/ */
// Sens // Sens
#define INPUT 'i' #define INPUT 'i'
#define OUTPUT 'o' #define OUTPUT 'o'
// Techno pour pin en entrée (INPUT) // Techno pour pin en entrée (INPUT)
#define ANALOG 0 #define ANALOG 0
#define INPUT_FLOATING 1 #define INPUT_FLOATING 1
#define INPUT_PULL_DOWN_UP 2 #define INPUT_PULL_DOWN_UP 2
// Techno pour pin en sortie (OUTPUT) // Techno pour pin en sortie (OUTPUT)
#define OUTPUT_PPULL 0 #define OUTPUT_PPULL 0
#define OUTPUT_OPDRAIN 1 #define OUTPUT_OPDRAIN 1
#define ALT_PPULL 2 #define ALT_PPULL 2
#define ALT_OPDRAIN 3 #define ALT_OPDRAIN 3
// Exemple : // Exemple :
// Port_IO_Init(GPIOB, 8, OUTPUT, OUTPUT_PPULL); // Port_IO_Init(GPIOB, 8, OUTPUT, OUTPUT_PPULL);
// Place le bit 8 du port B en sortie Push-pull // Place le bit 8 du port B en sortie Push-pull
char GPIO_Configure(GPIO_TypeDef * Port, int Broche, int Sens, int Techno); char GPIO_Configure(GPIO_TypeDef * Port, int Broche, int Sens, int Techno);
/** /**
* @brief Mise à 1 d'une broche GPIO * @brief Mise à 1 d'une broche GPIO
* @note Une fonction par GPIO * @note Une fonction par GPIO
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @retval None * @retval None
*/ */
void GPIOA_Set(char Broche); void GPIOA_Set(char Broche);
void GPIOB_Set(char Broche); void GPIOB_Set(char Broche);
void GPIOC_Set(char Broche); void GPIOC_Set(char Broche);
/** /**
* @brief Mise à 0 d'une broche GPIO * @brief Mise à 0 d'une broche GPIO
* @note Une fonction par GPIO * @note Une fonction par GPIO
* @param Broche : 0 à 15 * @param Broche : 0 à 15
* @retval None * @retval None
*/ */
void GPIOA_Clear(char Broche); void GPIOA_Clear(char Broche);
void GPIOB_Clear(char Broche); void GPIOB_Clear(char Broche);
void GPIOC_Clear(char Broche); void GPIOC_Clear(char Broche);
#endif #endif

View file

@ -1,56 +1,56 @@
; Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR) ; Bibliotheque DriverJeuLaser (ancienne gassp72 adaptée 2021 - TR)
; Accès en aux fonctions suivantes : ; Accès en aux fonctions suivantes :
; GPIO : ; GPIO :
; GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche) ; GPIOA_Set(char Broche), GPIOB_Set(char Broche), GPIOC_Set(char Broche)
; GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche) ; GPIOA_Clear(char Broche), GPIOB_Clear(char Broche), GPIOC_Clear(char Broche)
; PWM : ; PWM :
;/** ;/**
; * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif ; * @brief Fixe une valeur de PWM, Val, en tick horloge. La rapport cyclique effectif
; * est donc : rcy = Thaut_ticks / Periode_ticks ; * est donc : rcy = Thaut_ticks / Periode_ticks
; * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3 ; * @note spécifique Jeu Laser, PWM liée exclusivement au TIM3, chan3
; * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks ; * @param Thaut_ticks : durée de l'état haut d'une impulsion en Ticks
; * @retval None ; * @retval None
; */ ; */
;void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks); ;void PWM_Set_Value_TIM3_Ch3( unsigned short int Thaut_ticks);
import PWM_Set_Value_TIM3_Ch3 import PWM_Set_Value_TIM3_Ch3
;/** ;/**
; * @brief Mise à 1 d'une broche GPIO ; * @brief Mise à 1 d'une broche GPIO
; * @note Une fonction par GPIO ; * @note Une fonction par GPIO
; * @param Broche : 0 à 15 ; * @param Broche : 0 à 15
; * @retval None ; * @retval None
; */ ; */
;void GPIOA_Set(char Broche); ;void GPIOA_Set(char Broche);
import GPIOA_Set import GPIOA_Set
;void GPIOB_Set(char Broche); ;void GPIOB_Set(char Broche);
import GPIOB_Set import GPIOB_Set
;void GPIOC_Set(char Broche); ;void GPIOC_Set(char Broche);
import GPIOC_Set import GPIOC_Set
;/** ;/**
; * @brief Mise à 0 d'une broche GPIO ; * @brief Mise à 0 d'une broche GPIO
; * @note Une fonction par GPIO ; * @note Une fonction par GPIO
; * @param Broche : 0 à 15 ; * @param Broche : 0 à 15
; * @retval None ; * @retval None
; */ ; */
;void GPIOA_Clear(char Broche); ;void GPIOA_Clear(char Broche);
import GPIOA_Clear import GPIOA_Clear
;void GPIOB_Clear(char Broche); ;void GPIOB_Clear(char Broche);
import GPIOB_Clear import GPIOB_Clear
;void GPIOC_Clear(char Broche); ;void GPIOC_Clear(char Broche);
import GPIOC_Clear import GPIOC_Clear
end end

View file

@ -1,205 +1,225 @@
PRESERVE8 PRESERVE8
THUMB THUMB
;include DriverJeuLaser.inc ;include DriverJeuLaser.inc
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
area mesdata,data,readonly area mesdata,data,readonly
;Section RAM (read write): ;Section RAM (read write):
area maram,data,readwrite area maram,data,readwrite
extern LeSignal extern LeSignal
export DFT_ModuleAuCarre export DFT_ModuleAuCarre
export TabCos export TabCos
; =============================================================================================== ; ===============================================================================================
;Section ROM code (read only) : ;Section ROM code (read only) :
area moncode,code,readonly area moncode,code,readonly
; écrire le code ici ; écrire le code ici
; r0 = tableau dft (tab_dft)
DFT_ModuleAuCarre proc ; r1 = indice k (fréquence calculée)
push{lr,r4,r5,r6,r7,r8,r9}
mov r2,#0 ; int DFT_ModuleAuCarre(short* tab_dft, int k)
mov r3,#0 DFT_ModuleAuCarre proc
mov r9,#0 push{lr,r4,r5,r6,r7,r8,r9}
boucle cmp r2,#63 ;int i = 0
bgt fin_boucle mov r2,#0
lsl r5,r2,#1 ;int partie_relle= 0
;ldr r0,=LeSignal mov r3,#0
ldrsh r4,[r0,r5] ;int partie_imaginaire = 0
ldr r6, =TabCos mov r9,#0
ldr r7, =TabSin ;for(i=0;i<64;i++) {
;mul r5, r5, r1 boucle cmp r2,#63
mul r5, r1 bgt fin_boucle
and r5, #127 ;int j = i*2
ldrsh r6,[r6,r5] lsl r5,r2,#1 ;indice utilisé pour le tableau de la dft (décallé de 1 car short)
ldrsh r7,[r7,r5] ;int dft_val = tab_dft[j]
mul r5, r6, r4 ldrsh r4,[r0,r5] ;lecture dans le tableau de dft
mul r8, r7, r4 ldr r6, =TabCos ; adresse de tabcos
add r3, r5 ldr r7, =TabSin ; adresse de tabsin
add r9, r8 ;j = (j*k)%64 (on calcul l'indice correspondant dans le tableau tabcos et tabsin pour le calcul de la dft
add r2, #1 mul r5, r1
b boucle and r5, #127
fin_boucle ; int icos = TabCos[j]
mov r0,r3 ;correspond à Re(X(k)) ldrsh r6,[r6,r5]
mov r1,r9 ;correspond à Im(X(k)) ; int isin = TabSin[j]
smull r2,r3,r0, r0 ldrsh r7,[r7,r5]
smull r4,r5,r1, r1 ; int res_cos = icos*dft_val
adds r0,r2,r4 mul r5, r6, r4
adc r1, r3, r5 ; int res_sin = isin*dft_val
mul r8, r7, r4
mov r0,r1
;partie_relle += res cos
pop{pc,r4,r5,r6,r7,r8,r9} add r3, r5
endp ;partie_imaginaire += res_sin
add r9, r8
add r2, #1
;Section ROM code (read only) : b boucle
AREA Trigo, DATA, READONLY ;}
; codage fractionnaire 1.15 ;//A la fin de la boucle, r3 contient Re(X(k) et r9 contient Im(X(k)
TabCos fin_boucle
DCW 32767 ; 0 0x7fff 0.99997 mov r0,r3 ;correspond à Re(X(k))
DCW 32610 ; 1 0x7f62 0.99518 mov r1,r9 ;correspond à Im(X(k))
DCW 32138 ; 2 0x7d8a 0.98077 ; int re_carre = (partie_relle)^2
DCW 31357 ; 3 0x7a7d 0.95694 smull r2,r3,r0, r0
DCW 30274 ; 4 0x7642 0.92389 ; int im_carre = (partie_imaginaire)^2
DCW 28899 ; 5 0x70e3 0.88193 smull r4,r5,r1, r1
DCW 27246 ; 6 0x6a6e 0.83148 ; int resultat_final = re_carre+im_carre
DCW 25330 ; 7 0x62f2 0.77301 adds r0,r2,r4 ; partie basse (moins intéressante)
DCW 23170 ; 8 0x5a82 0.70709 adc r1, r3, r5 ; partie haute du la somme finale (intéressante car contient chiffre avant virgule
DCW 20788 ; 9 0x5134 0.63440
DCW 18205 ; 10 0x471d 0.55557 mov r0,r1
DCW 15447 ; 11 0x3c57 0.47141
DCW 12540 ; 12 0x30fc 0.38269 pop{pc,r4,r5,r6,r7,r8,r9}
DCW 9512 ; 13 0x2528 0.29028 endp
DCW 6393 ; 14 0x18f9 0.19510
DCW 3212 ; 15 0x0c8c 0.09802
DCW 0 ; 16 0x0000 0.00000 ;Section ROM code (read only) :
DCW -3212 ; 17 0xf374 -0.09802 AREA Trigo, DATA, READONLY
DCW -6393 ; 18 0xe707 -0.19510 ; codage fractionnaire 1.15
DCW -9512 ; 19 0xdad8 -0.29028 TabCos
DCW -12540 ; 20 0xcf04 -0.38269 DCW 32767 ; 0 0x7fff 0.99997
DCW -15447 ; 21 0xc3a9 -0.47141 DCW 32610 ; 1 0x7f62 0.99518
DCW -18205 ; 22 0xb8e3 -0.55557 DCW 32138 ; 2 0x7d8a 0.98077
DCW -20788 ; 23 0xaecc -0.63440 DCW 31357 ; 3 0x7a7d 0.95694
DCW -23170 ; 24 0xa57e -0.70709 DCW 30274 ; 4 0x7642 0.92389
DCW -25330 ; 25 0x9d0e -0.77301 DCW 28899 ; 5 0x70e3 0.88193
DCW -27246 ; 26 0x9592 -0.83148 DCW 27246 ; 6 0x6a6e 0.83148
DCW -28899 ; 27 0x8f1d -0.88193 DCW 25330 ; 7 0x62f2 0.77301
DCW -30274 ; 28 0x89be -0.92389 DCW 23170 ; 8 0x5a82 0.70709
DCW -31357 ; 29 0x8583 -0.95694 DCW 20788 ; 9 0x5134 0.63440
DCW -32138 ; 30 0x8276 -0.98077 DCW 18205 ; 10 0x471d 0.55557
DCW -32610 ; 31 0x809e -0.99518 DCW 15447 ; 11 0x3c57 0.47141
DCW -32768 ; 32 0x8000 -1.00000 DCW 12540 ; 12 0x30fc 0.38269
DCW -32610 ; 33 0x809e -0.99518 DCW 9512 ; 13 0x2528 0.29028
DCW -32138 ; 34 0x8276 -0.98077 DCW 6393 ; 14 0x18f9 0.19510
DCW -31357 ; 35 0x8583 -0.95694 DCW 3212 ; 15 0x0c8c 0.09802
DCW -30274 ; 36 0x89be -0.92389 DCW 0 ; 16 0x0000 0.00000
DCW -28899 ; 37 0x8f1d -0.88193 DCW -3212 ; 17 0xf374 -0.09802
DCW -27246 ; 38 0x9592 -0.83148 DCW -6393 ; 18 0xe707 -0.19510
DCW -25330 ; 39 0x9d0e -0.77301 DCW -9512 ; 19 0xdad8 -0.29028
DCW -23170 ; 40 0xa57e -0.70709 DCW -12540 ; 20 0xcf04 -0.38269
DCW -20788 ; 41 0xaecc -0.63440 DCW -15447 ; 21 0xc3a9 -0.47141
DCW -18205 ; 42 0xb8e3 -0.55557 DCW -18205 ; 22 0xb8e3 -0.55557
DCW -15447 ; 43 0xc3a9 -0.47141 DCW -20788 ; 23 0xaecc -0.63440
DCW -12540 ; 44 0xcf04 -0.38269 DCW -23170 ; 24 0xa57e -0.70709
DCW -9512 ; 45 0xdad8 -0.29028 DCW -25330 ; 25 0x9d0e -0.77301
DCW -6393 ; 46 0xe707 -0.19510 DCW -27246 ; 26 0x9592 -0.83148
DCW -3212 ; 47 0xf374 -0.09802 DCW -28899 ; 27 0x8f1d -0.88193
DCW 0 ; 48 0x0000 0.00000 DCW -30274 ; 28 0x89be -0.92389
DCW 3212 ; 49 0x0c8c 0.09802 DCW -31357 ; 29 0x8583 -0.95694
DCW 6393 ; 50 0x18f9 0.19510 DCW -32138 ; 30 0x8276 -0.98077
DCW 9512 ; 51 0x2528 0.29028 DCW -32610 ; 31 0x809e -0.99518
DCW 12540 ; 52 0x30fc 0.38269 DCW -32768 ; 32 0x8000 -1.00000
DCW 15447 ; 53 0x3c57 0.47141 DCW -32610 ; 33 0x809e -0.99518
DCW 18205 ; 54 0x471d 0.55557 DCW -32138 ; 34 0x8276 -0.98077
DCW 20788 ; 55 0x5134 0.63440 DCW -31357 ; 35 0x8583 -0.95694
DCW 23170 ; 56 0x5a82 0.70709 DCW -30274 ; 36 0x89be -0.92389
DCW 25330 ; 57 0x62f2 0.77301 DCW -28899 ; 37 0x8f1d -0.88193
DCW 27246 ; 58 0x6a6e 0.83148 DCW -27246 ; 38 0x9592 -0.83148
DCW 28899 ; 59 0x70e3 0.88193 DCW -25330 ; 39 0x9d0e -0.77301
DCW 30274 ; 60 0x7642 0.92389 DCW -23170 ; 40 0xa57e -0.70709
DCW 31357 ; 61 0x7a7d 0.95694 DCW -20788 ; 41 0xaecc -0.63440
DCW 32138 ; 62 0x7d8a 0.98077 DCW -18205 ; 42 0xb8e3 -0.55557
DCW 32610 ; 63 0x7f62 0.99518 DCW -15447 ; 43 0xc3a9 -0.47141
TabSin DCW -12540 ; 44 0xcf04 -0.38269
DCW 0 ; 0 0x0000 0.00000 DCW -9512 ; 45 0xdad8 -0.29028
DCW 3212 ; 1 0x0c8c 0.09802 DCW -6393 ; 46 0xe707 -0.19510
DCW 6393 ; 2 0x18f9 0.19510 DCW -3212 ; 47 0xf374 -0.09802
DCW 9512 ; 3 0x2528 0.29028 DCW 0 ; 48 0x0000 0.00000
DCW 12540 ; 4 0x30fc 0.38269 DCW 3212 ; 49 0x0c8c 0.09802
DCW 15447 ; 5 0x3c57 0.47141 DCW 6393 ; 50 0x18f9 0.19510
DCW 18205 ; 6 0x471d 0.55557 DCW 9512 ; 51 0x2528 0.29028
DCW 20788 ; 7 0x5134 0.63440 DCW 12540 ; 52 0x30fc 0.38269
DCW 23170 ; 8 0x5a82 0.70709 DCW 15447 ; 53 0x3c57 0.47141
DCW 25330 ; 9 0x62f2 0.77301 DCW 18205 ; 54 0x471d 0.55557
DCW 27246 ; 10 0x6a6e 0.83148 DCW 20788 ; 55 0x5134 0.63440
DCW 28899 ; 11 0x70e3 0.88193 DCW 23170 ; 56 0x5a82 0.70709
DCW 30274 ; 12 0x7642 0.92389 DCW 25330 ; 57 0x62f2 0.77301
DCW 31357 ; 13 0x7a7d 0.95694 DCW 27246 ; 58 0x6a6e 0.83148
DCW 32138 ; 14 0x7d8a 0.98077 DCW 28899 ; 59 0x70e3 0.88193
DCW 32610 ; 15 0x7f62 0.99518 DCW 30274 ; 60 0x7642 0.92389
DCW 32767 ; 16 0x7fff 0.99997 DCW 31357 ; 61 0x7a7d 0.95694
DCW 32610 ; 17 0x7f62 0.99518 DCW 32138 ; 62 0x7d8a 0.98077
DCW 32138 ; 18 0x7d8a 0.98077 DCW 32610 ; 63 0x7f62 0.99518
DCW 31357 ; 19 0x7a7d 0.95694 TabSin
DCW 30274 ; 20 0x7642 0.92389 DCW 0 ; 0 0x0000 0.00000
DCW 28899 ; 21 0x70e3 0.88193 DCW 3212 ; 1 0x0c8c 0.09802
DCW 27246 ; 22 0x6a6e 0.83148 DCW 6393 ; 2 0x18f9 0.19510
DCW 25330 ; 23 0x62f2 0.77301 DCW 9512 ; 3 0x2528 0.29028
DCW 23170 ; 24 0x5a82 0.70709 DCW 12540 ; 4 0x30fc 0.38269
DCW 20788 ; 25 0x5134 0.63440 DCW 15447 ; 5 0x3c57 0.47141
DCW 18205 ; 26 0x471d 0.55557 DCW 18205 ; 6 0x471d 0.55557
DCW 15447 ; 27 0x3c57 0.47141 DCW 20788 ; 7 0x5134 0.63440
DCW 12540 ; 28 0x30fc 0.38269 DCW 23170 ; 8 0x5a82 0.70709
DCW 9512 ; 29 0x2528 0.29028 DCW 25330 ; 9 0x62f2 0.77301
DCW 6393 ; 30 0x18f9 0.19510 DCW 27246 ; 10 0x6a6e 0.83148
DCW 3212 ; 31 0x0c8c 0.09802 DCW 28899 ; 11 0x70e3 0.88193
DCW 0 ; 32 0x0000 0.00000 DCW 30274 ; 12 0x7642 0.92389
DCW -3212 ; 33 0xf374 -0.09802 DCW 31357 ; 13 0x7a7d 0.95694
DCW -6393 ; 34 0xe707 -0.19510 DCW 32138 ; 14 0x7d8a 0.98077
DCW -9512 ; 35 0xdad8 -0.29028 DCW 32610 ; 15 0x7f62 0.99518
DCW -12540 ; 36 0xcf04 -0.38269 DCW 32767 ; 16 0x7fff 0.99997
DCW -15447 ; 37 0xc3a9 -0.47141 DCW 32610 ; 17 0x7f62 0.99518
DCW -18205 ; 38 0xb8e3 -0.55557 DCW 32138 ; 18 0x7d8a 0.98077
DCW -20788 ; 39 0xaecc -0.63440 DCW 31357 ; 19 0x7a7d 0.95694
DCW -23170 ; 40 0xa57e -0.70709 DCW 30274 ; 20 0x7642 0.92389
DCW -25330 ; 41 0x9d0e -0.77301 DCW 28899 ; 21 0x70e3 0.88193
DCW -27246 ; 42 0x9592 -0.83148 DCW 27246 ; 22 0x6a6e 0.83148
DCW -28899 ; 43 0x8f1d -0.88193 DCW 25330 ; 23 0x62f2 0.77301
DCW -30274 ; 44 0x89be -0.92389 DCW 23170 ; 24 0x5a82 0.70709
DCW -31357 ; 45 0x8583 -0.95694 DCW 20788 ; 25 0x5134 0.63440
DCW -32138 ; 46 0x8276 -0.98077 DCW 18205 ; 26 0x471d 0.55557
DCW -32610 ; 47 0x809e -0.99518 DCW 15447 ; 27 0x3c57 0.47141
DCW -32768 ; 48 0x8000 -1.00000 DCW 12540 ; 28 0x30fc 0.38269
DCW -32610 ; 49 0x809e -0.99518 DCW 9512 ; 29 0x2528 0.29028
DCW -32138 ; 50 0x8276 -0.98077 DCW 6393 ; 30 0x18f9 0.19510
DCW -31357 ; 51 0x8583 -0.95694 DCW 3212 ; 31 0x0c8c 0.09802
DCW -30274 ; 52 0x89be -0.92389 DCW 0 ; 32 0x0000 0.00000
DCW -28899 ; 53 0x8f1d -0.88193 DCW -3212 ; 33 0xf374 -0.09802
DCW -27246 ; 54 0x9592 -0.83148 DCW -6393 ; 34 0xe707 -0.19510
DCW -25330 ; 55 0x9d0e -0.77301 DCW -9512 ; 35 0xdad8 -0.29028
DCW -23170 ; 56 0xa57e -0.70709 DCW -12540 ; 36 0xcf04 -0.38269
DCW -20788 ; 57 0xaecc -0.63440 DCW -15447 ; 37 0xc3a9 -0.47141
DCW -18205 ; 58 0xb8e3 -0.55557 DCW -18205 ; 38 0xb8e3 -0.55557
DCW -15447 ; 59 0xc3a9 -0.47141 DCW -20788 ; 39 0xaecc -0.63440
DCW -12540 ; 60 0xcf04 -0.38269 DCW -23170 ; 40 0xa57e -0.70709
DCW -9512 ; 61 0xdad8 -0.29028 DCW -25330 ; 41 0x9d0e -0.77301
DCW -6393 ; 62 0xe707 -0.19510 DCW -27246 ; 42 0x9592 -0.83148
DCW -3212 ; 63 0xf374 -0.09802 DCW -28899 ; 43 0x8f1d -0.88193
DCW -30274 ; 44 0x89be -0.92389
DCW -31357 ; 45 0x8583 -0.95694
DCW -32138 ; 46 0x8276 -0.98077
DCW -32610 ; 47 0x809e -0.99518
DCW -32768 ; 48 0x8000 -1.00000
DCW -32610 ; 49 0x809e -0.99518
DCW -32138 ; 50 0x8276 -0.98077
DCW -31357 ; 51 0x8583 -0.95694
DCW -30274 ; 52 0x89be -0.92389
DCW -28899 ; 53 0x8f1d -0.88193
DCW -27246 ; 54 0x9592 -0.83148
DCW -25330 ; 55 0x9d0e -0.77301
DCW -23170 ; 56 0xa57e -0.70709
DCW -20788 ; 57 0xaecc -0.63440
DCW -18205 ; 58 0xb8e3 -0.55557
DCW -15447 ; 59 0xc3a9 -0.47141
DCW -12540 ; 60 0xcf04 -0.38269
DCW -9512 ; 61 0xdad8 -0.29028
DCW -6393 ; 62 0xe707 -0.19510
DCW -3212 ; 63 0xf374 -0.09802
END END

View file

@ -0,0 +1,112 @@
PRESERVE8
THUMB
include .\Driver\DriverJeuLaser.inc
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
;Section RAM (read write):
area maram,data,readwrite
SortieSon dcw 0
Index dcd 0
Res dcw 719
export CallbackSon
export StartSon
extern Son
extern LongueurSon
extern TIM4
EXPORT SortieSon
EXPORT Index
; ===============================================================================================
;Section ROM code (read only) :
area moncode,code,readonly
; écrire le code ici
;int tab Son
;int index
;short sortieSon
;int callBack
; int decalage = 1<<15;
; double echelle = 719/(1<<16) //decalage*2
; if(index < LongueurSon) {
; sortieSon = (Son[index] +decalage)*echelle
;
; index += 1;
; }
; return sortieSon
;
StartSon proc
push {lr}
ldr r0,=Index
mov r1,#0
str r1,[r0]
pop {pc}
endp
;CallbackSon mov r0,=Son
CallbackSon proc
; On récupère l'adresse du tableau Son et de l'index
push {lr}
ldr r0,=Son ;contient l'adresse du tableau Son
ldr r2,=Index
ldr r3,[r2] ;contient la valeur de Index
; if(index < LongueurSon)
push {r0}
ldr r0,=LongueurSon
cmp r0, r2
bge exit ; on quitte dans le cas contraire
pop{r0}
; sortieSon = (Son[index] +decalage)*echelle
ldrsh r1, [r0,r3,lsl #1] ;r1 contient Son[Index]
ldr r0,=SortieSon ;r0 contient l'adresse de la variable SortieSon où on lira le son
;mise à echelle
push {r0,r2,r3}
; Variable décalage
mov r3,#1
lsl r0,r3,#15
add r1,r1,r0 ;ajout de decalage à Son[index]
;Calcul mise à l'échelle (719/2^16)
ldr r2,=Res ; Res contient 719
ldrh r2,[r2] ; on met 719 dans r2
mul r1,r1,r2 ; on multiplie 719 par (Son[Index]+decalage) dans r1
lsr r1,r1,#16 ; on divise par 2^16 dans r1
pop {r0,r2,r3}
;fin mise à échelle
strh r1,[r0] ; On écrit cette valeur dans SortieSon
mov r0,r1 ; r0 contient la valeur de SortieSon (donnée en argument de la fonction suivante)
bl PWM_Set_Value_TIM3_Ch3
; index += 1;
add r3,r3,#1
str r3,[r2] ; On ajoute 2 à l'index
exit pop {pc}
endp
END

File diff suppressed because it is too large Load diff

View file

@ -1,72 +1,121 @@
#include "DriverJeuLaser.h" #include "DriverJeuLaser.h"
#include <stdio.h> #include <stdio.h>
#include "Affichage_Valise.h"
extern int DFT_ModuleAuCarre(short int* Signal64ech, char k);
extern short int LeSignal[]; extern int DFT_ModuleAuCarre(short int* Signal64ech, char k);
//int result; extern short int LeSignal[];
extern void CallbackSon(void);
int dft[64]; extern void StartSon(void);
short int dma_buf[64]; #define MAX_PIC 100000
//int result;
void callback() {
Start_DMA1(64); int dft[64];
Wait_On_End_Of_DMA1(); short int dma_buf[64];
//int somme=0; int tab_score[6] = {0};
int tab_norm[6] = {17,18,19,20,23,24}; //fréquences qui nous intéressent
for (int i=1;i<64;i++) { int ancienne_cible = 3; //ancienne cible activée
dft[i] = DFT_ModuleAuCarre(&(dma_buf[0]),i); int cible = 0; //cible actuelle
//somme+=dft[i];
} void callback() {
Start_DMA1(64);
Wait_On_End_Of_DMA1();
//int somme=0;
Stop_DMA1;
} for (int i=1;i<64;i++) {
dft[i] = DFT_ModuleAuCarre(&(dma_buf[0]),i);
int main(void) //somme+=dft[i];
{ }
//Prepare_Afficheur(1, 15);
// ===========================================================================
// ============= INIT PERIPH (faites qu'une seule fois) ===================== Stop_DMA1;
// ===========================================================================
//Lecture des raies pour trouver la fréquence lue
for(int i=0;i<6;i++) {
//int result = DFT_ModuleAuCarre(&(LeSignal[0]),1); if(dft[tab_norm[i]] > MAX_PIC) {
//if (player_count < 4 && tab_score[i] == 0)
//printf("le résultat : %d \n", result); tab_score[i] += 1;
if (tab_score[i] >= 100) {
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers tab_score[i] =0; // remise à zéro lorsque le score dépasse 100
CLOCK_Configure(); }
if(tab_score[i]%20 == 0) {
StartSon(); //On active le son si une cible est touchée
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); Prepare_Clear_LED(cible); // On éteint l'ancienne cible
cible = (cible+1)%3; // On change la cible
PWM_Init_ff(TIM2,3,720); Prepare_Set_LED(cible);
Choix_Capteur(cible+1);
//On change le score
if(i < 4) {
Prepare_Afficheur((i+1), tab_score[i]);
Mise_A_Jour_Afficheurs_LED();
}
}
Init_TimingADC_ActiveADC_ff(ADC1,72); }
Single_Channel_ADC( ADC1, 2 ); }
Init_Conversion_On_Trig_Timer_ff( ADC1, TIM2_CC2, 225 );
Init_ADC1_DMA1( 0, &(dma_buf[0]) ); }
Systick_Period_ff(5*72*1000); int main(void)
Systick_Prio_IT(0,callback); {
SysTick_Enable_IT;
SysTick_On; // ===========================================================================
// ============= INIT PERIPH (faites qu'une seule fois) =====================
//============================================================================ // ===========================================================================
//Initialisation
while (1)
{ CLOCK_Configure();
} Init_Affichage();
}
//Réinitialisation de tous les afficheurs
for(int p = 0;p<4;p++) {
Prepare_Afficheur(p+1,0);
Prepare_Clear_LED(p);
}
Prepare_Set_LED(1);
Choix_Capteur(2);
//Systick pour la DFT
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
PWM_Init_ff(TIM2,3,720);
Init_TimingADC_ActiveADC_ff(ADC1,72);
Single_Channel_ADC( ADC1, 2 );
Init_Conversion_On_Trig_Timer_ff( ADC1, TIM2_CC2, 225 );
Init_ADC1_DMA1( 0, &(dma_buf[0]) );
//Création loop DFT
Systick_Period_ff(5*72*1000);
Systick_Prio_IT(9,callback);
SysTick_Enable_IT;
SysTick_On;
//Systick pour le Son
GPIO_Configure(GPIOB, 1, OUTPUT, OUTPUT_PPULL);
PWM_Init_ff(TIM3,3,720);
PWM_Set_Value_TIM3_Ch3( 360);
Timer_1234_Init_ff( TIM4, 6552 );
Active_IT_Debordement_Timer( TIM4, 10, CallbackSon );
Mise_A_Jour_Afficheurs_LED();
//============================================================================
while (1)
{
}
}

View file

@ -1,335 +1,335 @@
;******************** (C) COPYRIGHT 2011 STMicroelectronics ******************** ;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
;* File Name : startup_stm32f10x_md.s ;* File Name : startup_stm32f10x_md.s
;* Author : MCD Application Team ;* Author : MCD Application Team
;* Version : V3.5.0 ;* Version : V3.5.0
;* Date : 11-March-2011 ;* Date : 11-March-2011
;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM ;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM
;* toolchain. ;* toolchain.
;* This module performs: ;* This module performs:
;* - Set the initial SP ;* - Set the initial SP
;* - Set the initial PC == Reset_Handler ;* - Set the initial PC == Reset_Handler
;* - Set the vector table entries with the exceptions ISR address ;* - Set the vector table entries with the exceptions ISR address
;* - Configure the clock system ;* - Configure the clock system
;* - Branches to __main in the C library (which eventually ;* - Branches to __main in the C library (which eventually
;* calls main()). ;* calls main()).
;* After Reset the CortexM3 processor is in Thread mode, ;* After Reset the CortexM3 processor is in Thread mode,
;* priority is Privileged, and the Stack is set to Main. ;* priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>> ;* <<< Use Configuration Wizard in Context Menu >>>
;******************************************************************************* ;*******************************************************************************
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS ; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. ; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, ; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE ; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING ; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
;******************************************************************************* ;*******************************************************************************
; Amount of memory (in bytes) allocated for Stack ; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs ; Tailor this value to your application needs
; <h> Stack Configuration ; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h> ; </h>
Stack_Size EQU 0x00000400 Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3 AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size Stack_Mem SPACE Stack_Size
__initial_sp __initial_sp
; <h> Heap Configuration ; <h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h> ; </h>
Heap_Size EQU 0x00000200 Heap_Size EQU 0x00000200
AREA HEAP, NOINIT, READWRITE, ALIGN=3 AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base __heap_base
Heap_Mem SPACE Heap_Size Heap_Mem SPACE Heap_Size
__heap_limit __heap_limit
PRESERVE8 PRESERVE8
THUMB THUMB
; Vector Table Mapped to Address 0 at Reset ; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY AREA RESET, DATA, READONLY
EXPORT __Vectors EXPORT __Vectors
EXPORT __Vectors_End EXPORT __Vectors_End
EXPORT __Vectors_Size EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack __Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD 0 ; Reserved DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler DCD SysTick_Handler ; SysTick Handler
; External Interrupts ; External Interrupts
DCD WWDG_IRQHandler ; Window Watchdog DCD WWDG_IRQHandler ; Window Watchdog
DCD PVD_IRQHandler ; PVD through EXTI Line detect DCD PVD_IRQHandler ; PVD through EXTI Line detect
DCD TAMPER_IRQHandler ; Tamper DCD TAMPER_IRQHandler ; Tamper
DCD RTC_IRQHandler ; RTC DCD RTC_IRQHandler ; RTC
DCD FLASH_IRQHandler ; Flash DCD FLASH_IRQHandler ; Flash
DCD RCC_IRQHandler ; RCC DCD RCC_IRQHandler ; RCC
DCD EXTI0_IRQHandler ; EXTI Line 0 DCD EXTI0_IRQHandler ; EXTI Line 0
DCD EXTI1_IRQHandler ; EXTI Line 1 DCD EXTI1_IRQHandler ; EXTI Line 1
DCD EXTI2_IRQHandler ; EXTI Line 2 DCD EXTI2_IRQHandler ; EXTI Line 2
DCD EXTI3_IRQHandler ; EXTI Line 3 DCD EXTI3_IRQHandler ; EXTI Line 3
DCD EXTI4_IRQHandler ; EXTI Line 4 DCD EXTI4_IRQHandler ; EXTI Line 4
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2 DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3 DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4 DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5 DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6 DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7 DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
DCD ADC1_2_IRQHandler ; ADC1_2 DCD ADC1_2_IRQHandler ; ADC1_2
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0 DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_RX1_IRQHandler ; CAN1 RX1
DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD CAN1_SCE_IRQHandler ; CAN1 SCE
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5 DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
DCD TIM1_BRK_IRQHandler ; TIM1 Break DCD TIM1_BRK_IRQHandler ; TIM1 Break
DCD TIM1_UP_IRQHandler ; TIM1 Update DCD TIM1_UP_IRQHandler ; TIM1 Update
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
DCD TIM2_IRQHandler ; TIM2 DCD TIM2_IRQHandler ; TIM2
DCD TIM3_IRQHandler ; TIM3 DCD TIM3_IRQHandler ; TIM3
DCD TIM4_IRQHandler ; TIM4 DCD TIM4_IRQHandler ; TIM4
DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_EV_IRQHandler ; I2C1 Event
DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C1_ER_IRQHandler ; I2C1 Error
DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_EV_IRQHandler ; I2C2 Event
DCD I2C2_ER_IRQHandler ; I2C2 Error DCD I2C2_ER_IRQHandler ; I2C2 Error
DCD SPI1_IRQHandler ; SPI1 DCD SPI1_IRQHandler ; SPI1
DCD SPI2_IRQHandler ; SPI2 DCD SPI2_IRQHandler ; SPI2
DCD USART1_IRQHandler ; USART1 DCD USART1_IRQHandler ; USART1
DCD USART2_IRQHandler ; USART2 DCD USART2_IRQHandler ; USART2
DCD USART3_IRQHandler ; USART3 DCD USART3_IRQHandler ; USART3
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10 DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
__Vectors_End __Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors __Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY AREA |.text|, CODE, READONLY
; Reset handler ; Reset handler
Reset_Handler PROC Reset_Handler PROC
EXPORT Reset_Handler [WEAK] EXPORT Reset_Handler [WEAK]
IMPORT __main IMPORT __main
LDR R0, =SystemInit LDR R0, =SystemInit
BLX R0 BLX R0
; ;
; Enable UsageFault, MemFault and Busfault interrupts ; Enable UsageFault, MemFault and Busfault interrupts
; ;
_SHCSR EQU 0xE000ED24 ; SHCSR is located at address 0xE000ED24 _SHCSR EQU 0xE000ED24 ; SHCSR is located at address 0xE000ED24
LDR.W R0, =_SHCSR LDR.W R0, =_SHCSR
LDR R1, [R0] ; Read CPACR LDR R1, [R0] ; Read CPACR
ORR R1, R1, #(0x7 << 16) ; Set bits 16,17,18 to enable usagefault, busfault, memfault interrupts ORR R1, R1, #(0x7 << 16) ; Set bits 16,17,18 to enable usagefault, busfault, memfault interrupts
STR R1, [R0] ; Write back the modified value to the CPACR STR R1, [R0] ; Write back the modified value to the CPACR
DSB ; Wait for store to complete DSB ; Wait for store to complete
; ;
; Set priority grouping (PRIGROUP) in AIRCR to 3 (16 levels for group priority and 0 for subpriority) ; Set priority grouping (PRIGROUP) in AIRCR to 3 (16 levels for group priority and 0 for subpriority)
; ;
_AIRCR EQU 0xE000ED0C _AIRCR EQU 0xE000ED0C
_AIRCR_VAL EQU 0x05FA0300 _AIRCR_VAL EQU 0x05FA0300
LDR.W R0, =_AIRCR LDR.W R0, =_AIRCR
LDR.W R1, =_AIRCR_VAL LDR.W R1, =_AIRCR_VAL
STR R1,[R0] STR R1,[R0]
; ;
; Finaly, jump to main function (void main (void)) ; Finaly, jump to main function (void main (void))
; ;
LDR R0, =__main LDR R0, =__main
BX R0 BX R0
ENDP ENDP
SystemInit PROC SystemInit PROC
EXPORT SystemInit [WEAK] EXPORT SystemInit [WEAK]
BX LR BX LR
ENDP ENDP
; Dummy Exception Handlers (infinite loops which can be modified) ; Dummy Exception Handlers (infinite loops which can be modified)
NMI_Handler PROC NMI_Handler PROC
EXPORT NMI_Handler [WEAK] EXPORT NMI_Handler [WEAK]
B . B .
ENDP ENDP
HardFault_Handler\ HardFault_Handler\
PROC PROC
EXPORT HardFault_Handler [WEAK] EXPORT HardFault_Handler [WEAK]
B . B .
ENDP ENDP
MemManage_Handler\ MemManage_Handler\
PROC PROC
EXPORT MemManage_Handler [WEAK] EXPORT MemManage_Handler [WEAK]
B . B .
ENDP ENDP
BusFault_Handler\ BusFault_Handler\
PROC PROC
EXPORT BusFault_Handler [WEAK] EXPORT BusFault_Handler [WEAK]
B . B .
ENDP ENDP
UsageFault_Handler\ UsageFault_Handler\
PROC PROC
EXPORT UsageFault_Handler [WEAK] EXPORT UsageFault_Handler [WEAK]
B . B .
ENDP ENDP
SVC_Handler PROC SVC_Handler PROC
EXPORT SVC_Handler [WEAK] EXPORT SVC_Handler [WEAK]
B . B .
ENDP ENDP
DebugMon_Handler\ DebugMon_Handler\
PROC PROC
EXPORT DebugMon_Handler [WEAK] EXPORT DebugMon_Handler [WEAK]
B . B .
ENDP ENDP
PendSV_Handler PROC PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK] EXPORT PendSV_Handler [WEAK]
B . B .
ENDP ENDP
SysTick_Handler PROC SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK] EXPORT SysTick_Handler [WEAK]
B . B .
ENDP ENDP
Default_Handler PROC Default_Handler PROC
EXPORT WWDG_IRQHandler [WEAK] EXPORT WWDG_IRQHandler [WEAK]
EXPORT PVD_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK]
EXPORT TAMPER_IRQHandler [WEAK] EXPORT TAMPER_IRQHandler [WEAK]
EXPORT RTC_IRQHandler [WEAK] EXPORT RTC_IRQHandler [WEAK]
EXPORT FLASH_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK]
EXPORT RCC_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK]
EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK]
EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK]
EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK]
EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK]
EXPORT EXTI4_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK]
EXPORT DMA1_Channel1_IRQHandler [WEAK] EXPORT DMA1_Channel1_IRQHandler [WEAK]
EXPORT DMA1_Channel2_IRQHandler [WEAK] EXPORT DMA1_Channel2_IRQHandler [WEAK]
EXPORT DMA1_Channel3_IRQHandler [WEAK] EXPORT DMA1_Channel3_IRQHandler [WEAK]
EXPORT DMA1_Channel4_IRQHandler [WEAK] EXPORT DMA1_Channel4_IRQHandler [WEAK]
EXPORT DMA1_Channel5_IRQHandler [WEAK] EXPORT DMA1_Channel5_IRQHandler [WEAK]
EXPORT DMA1_Channel6_IRQHandler [WEAK] EXPORT DMA1_Channel6_IRQHandler [WEAK]
EXPORT DMA1_Channel7_IRQHandler [WEAK] EXPORT DMA1_Channel7_IRQHandler [WEAK]
EXPORT ADC1_2_IRQHandler [WEAK] EXPORT ADC1_2_IRQHandler [WEAK]
EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK] EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK] EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK]
EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK]
EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK]
EXPORT TIM1_BRK_IRQHandler [WEAK] EXPORT TIM1_BRK_IRQHandler [WEAK]
EXPORT TIM1_UP_IRQHandler [WEAK] EXPORT TIM1_UP_IRQHandler [WEAK]
EXPORT TIM1_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK]
EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK]
EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK]
EXPORT TIM4_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK]
EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK]
EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK]
EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK]
EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK]
EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK]
EXPORT SPI2_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK]
EXPORT USART1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK]
EXPORT USART2_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK]
EXPORT USART3_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK]
EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK]
EXPORT RTCAlarm_IRQHandler [WEAK] EXPORT RTCAlarm_IRQHandler [WEAK]
EXPORT USBWakeUp_IRQHandler [WEAK] EXPORT USBWakeUp_IRQHandler [WEAK]
WWDG_IRQHandler WWDG_IRQHandler
PVD_IRQHandler PVD_IRQHandler
TAMPER_IRQHandler TAMPER_IRQHandler
RTC_IRQHandler RTC_IRQHandler
FLASH_IRQHandler FLASH_IRQHandler
RCC_IRQHandler RCC_IRQHandler
EXTI0_IRQHandler EXTI0_IRQHandler
EXTI1_IRQHandler EXTI1_IRQHandler
EXTI2_IRQHandler EXTI2_IRQHandler
EXTI3_IRQHandler EXTI3_IRQHandler
EXTI4_IRQHandler EXTI4_IRQHandler
DMA1_Channel1_IRQHandler DMA1_Channel1_IRQHandler
DMA1_Channel2_IRQHandler DMA1_Channel2_IRQHandler
DMA1_Channel3_IRQHandler DMA1_Channel3_IRQHandler
DMA1_Channel4_IRQHandler DMA1_Channel4_IRQHandler
DMA1_Channel5_IRQHandler DMA1_Channel5_IRQHandler
DMA1_Channel6_IRQHandler DMA1_Channel6_IRQHandler
DMA1_Channel7_IRQHandler DMA1_Channel7_IRQHandler
ADC1_2_IRQHandler ADC1_2_IRQHandler
USB_HP_CAN1_TX_IRQHandler USB_HP_CAN1_TX_IRQHandler
USB_LP_CAN1_RX0_IRQHandler USB_LP_CAN1_RX0_IRQHandler
CAN1_RX1_IRQHandler CAN1_RX1_IRQHandler
CAN1_SCE_IRQHandler CAN1_SCE_IRQHandler
EXTI9_5_IRQHandler EXTI9_5_IRQHandler
TIM1_BRK_IRQHandler TIM1_BRK_IRQHandler
TIM1_UP_IRQHandler TIM1_UP_IRQHandler
TIM1_TRG_COM_IRQHandler TIM1_TRG_COM_IRQHandler
TIM1_CC_IRQHandler TIM1_CC_IRQHandler
TIM2_IRQHandler TIM2_IRQHandler
TIM3_IRQHandler TIM3_IRQHandler
TIM4_IRQHandler TIM4_IRQHandler
I2C1_EV_IRQHandler I2C1_EV_IRQHandler
I2C1_ER_IRQHandler I2C1_ER_IRQHandler
I2C2_EV_IRQHandler I2C2_EV_IRQHandler
I2C2_ER_IRQHandler I2C2_ER_IRQHandler
SPI1_IRQHandler SPI1_IRQHandler
SPI2_IRQHandler SPI2_IRQHandler
USART1_IRQHandler USART1_IRQHandler
USART2_IRQHandler USART2_IRQHandler
USART3_IRQHandler USART3_IRQHandler
EXTI15_10_IRQHandler EXTI15_10_IRQHandler
RTCAlarm_IRQHandler RTCAlarm_IRQHandler
USBWakeUp_IRQHandler USBWakeUp_IRQHandler
B . B .
ENDP ENDP
ALIGN ALIGN
;******************************************************************************* ;*******************************************************************************
; User Stack and Heap initialization ; User Stack and Heap initialization
;******************************************************************************* ;*******************************************************************************
IF :DEF:__MICROLIB IF :DEF:__MICROLIB
EXPORT __initial_sp EXPORT __initial_sp
EXPORT __heap_base EXPORT __heap_base
EXPORT __heap_limit EXPORT __heap_limit
ELSE ELSE
IMPORT __use_two_region_memory IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap EXPORT __user_initial_stackheap
__user_initial_stackheap __user_initial_stackheap
LDR R0, = Heap_Mem LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size) LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size) LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem LDR R3, = Stack_Mem
BX LR BX LR
ALIGN ALIGN
ENDIF ENDIF
END END
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE***** ;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****

View file

@ -388,6 +388,16 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\Src\principal.c</FilePath> <FilePath>.\Src\principal.c</FilePath>
</File> </File>
<File>
<FileName>Affichage_Valise.h</FileName>
<FileType>5</FileType>
<FilePath>.\Driver\Affichage_Valise.h</FilePath>
</File>
<File>
<FileName>affichage_valise.o</FileName>
<FileType>3</FileType>
<FilePath>.\Driver\affichage_valise.o</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -477,6 +487,11 @@
<FileType>4</FileType> <FileType>4</FileType>
<FilePath>.\Driver\DriverJeuLaser.lib</FilePath> <FilePath>.\Driver\DriverJeuLaser.lib</FilePath>
</File> </File>
<File>
<FileName>DriverJeuLaser.inc</FileName>
<FileType>5</FileType>
<FilePath>.\Driver\DriverJeuLaser.inc</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -492,6 +507,16 @@
<FileType>2</FileType> <FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath> <FilePath>.\Src\Signal.asm</FilePath>
</File> </File>
<File>
<FileName>bruitverre.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\bruitverre.asm</FilePath>
</File>
<File>
<FileName>GestionSon.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -881,6 +906,16 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\Src\principal.c</FilePath> <FilePath>.\Src\principal.c</FilePath>
</File> </File>
<File>
<FileName>Affichage_Valise.h</FileName>
<FileType>5</FileType>
<FilePath>.\Driver\Affichage_Valise.h</FilePath>
</File>
<File>
<FileName>affichage_valise.o</FileName>
<FileType>3</FileType>
<FilePath>.\Driver\affichage_valise.o</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -901,6 +936,11 @@
<FileType>4</FileType> <FileType>4</FileType>
<FilePath>.\Driver\DriverJeuLaser.lib</FilePath> <FilePath>.\Driver\DriverJeuLaser.lib</FilePath>
</File> </File>
<File>
<FileName>DriverJeuLaser.inc</FileName>
<FileType>5</FileType>
<FilePath>.\Driver\DriverJeuLaser.inc</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -916,6 +956,16 @@
<FileType>2</FileType> <FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath> <FilePath>.\Src\Signal.asm</FilePath>
</File> </File>
<File>
<FileName>bruitverre.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\bruitverre.asm</FilePath>
</File>
<File>
<FileName>GestionSon.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -1374,6 +1424,16 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\Src\principal.c</FilePath> <FilePath>.\Src\principal.c</FilePath>
</File> </File>
<File>
<FileName>Affichage_Valise.h</FileName>
<FileType>5</FileType>
<FilePath>.\Driver\Affichage_Valise.h</FilePath>
</File>
<File>
<FileName>affichage_valise.o</FileName>
<FileType>3</FileType>
<FilePath>.\Driver\affichage_valise.o</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -1394,6 +1454,11 @@
<FileType>4</FileType> <FileType>4</FileType>
<FilePath>.\Driver\DriverJeuLaser.lib</FilePath> <FilePath>.\Driver\DriverJeuLaser.lib</FilePath>
</File> </File>
<File>
<FileName>DriverJeuLaser.inc</FileName>
<FileType>5</FileType>
<FilePath>.\Driver\DriverJeuLaser.inc</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -1409,6 +1474,16 @@
<FileType>2</FileType> <FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath> <FilePath>.\Src\Signal.asm</FilePath>
</File> </File>
<File>
<FileName>bruitverre.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\bruitverre.asm</FilePath>
</File>
<File>
<FileName>GestionSon.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>