Réalisation de l'objectif 4
This commit is contained in:
parent
3cd4fc98a7
commit
23e7e600c7
5 changed files with 5703 additions and 49 deletions
15
README.md
15
README.md
|
@ -2,7 +2,14 @@
|
|||
|
||||
Groupe: Yohan Simard, Arnaud Vergnet
|
||||
|
||||
## Avancement
|
||||
* 1.1 - Terminé
|
||||
* 2.1 - Terminé
|
||||
* 2.2 - Terminé, verif en cours
|
||||
# Obj 4
|
||||
|
||||
**Partie terminée**
|
||||
|
||||
Nous avons fusionné les parties 2 et 3 sans modifier les fichiers assembleur. Nous avons seulement modifié le fichier main.c.
|
||||
Pour tester :
|
||||
|
||||
* Compiler le projet
|
||||
* Lancer le mode Debug
|
||||
* Ouvrir le logic analyser. Tout devrait être préconfiguré.
|
||||
* Appuyer sur run et observer dans le logic analyser les détections de tirs, les incrémentations de score, et le son qui est joué à chaque incrémentation.
|
||||
|
|
|
@ -153,24 +153,7 @@
|
|||
<Name>-U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>0</LineNumber>
|
||||
<EnabledFlag>0</EnabledFlag>
|
||||
<Address>134218136</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename></Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>0x08000198</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<Breakpoint/>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
|
@ -247,62 +230,67 @@
|
|||
<Wi>
|
||||
<IntNumber>0</IntNumber>
|
||||
<FirstString>`counters[0]</FirstString>
|
||||
<SecondString>008000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B305D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001000000555555555555B53F1C00000000000000000000000000000000000000180D0008</SecondString>
|
||||
<SecondString>008000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B305D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000100000024C436ADB877B23F1700000000000000000000000000000000000000180D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>1</IntNumber>
|
||||
<FirstString>`counters[1]</FirstString>
|
||||
<SecondString>000080000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B315D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000002000000555555555555B53F1C00000000000000000000000000000000000000180D0008</SecondString>
|
||||
<SecondString>000080000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B315D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000200000024C436ADB877B23F1700000000000000000000000000000000000000180D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>2</IntNumber>
|
||||
<FirstString>`counters[2]</FirstString>
|
||||
<SecondString>000000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B325D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000003000000555555555555B53F1C00000000000000000000000000000000000000180D0008</SecondString>
|
||||
<SecondString>000000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B325D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000300000024C436ADB877B23F1700000000000000000000000000000000000000180D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>3</IntNumber>
|
||||
<FirstString>`counters[3]</FirstString>
|
||||
<SecondString>FF0000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B335D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000004000000555555555555B53F1C00000000000000000000000000000000000000180D0008</SecondString>
|
||||
<SecondString>FF0000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B335D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000400000024C436ADB877B23F1700000000000000000000000000000000000000180D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>4</IntNumber>
|
||||
<FirstString>`counters[4]</FirstString>
|
||||
<SecondString>008000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B345D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000005000000555555555555B53F1C00000000000000000000000000000000000000180D0008</SecondString>
|
||||
<SecondString>008000000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B345D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000500000024C436ADB877B23F1700000000000000000000000000000000000000180D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>5</IntNumber>
|
||||
<FirstString>`counters[5]</FirstString>
|
||||
<SecondString>000080000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B355D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000006000000555555555555B53F1C00000000000000000000000000000000000000180D0008</SecondString>
|
||||
<SecondString>000080000000000000000000000000000000354000000000000000000000000000000000636F756E746572735B355D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000600000024C436ADB877B23F1700000000000000000000000000000000000000180D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>6</IntNumber>
|
||||
<FirstString>`scores[0]</FirstString>
|
||||
<SecondString>0000800000000000000000000000000000002E400000000000000000000000000000000073636F7265735B305D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000007000000555555555555B53F1C00000000000000000000000000000000000000C80D0008</SecondString>
|
||||
<SecondString>0000800000000000000000000000000000002E400000000000000000000000000000000073636F7265735B305D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000700000024C436ADB877B23F1700000000000000000000000000000000000000C80D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>7</IntNumber>
|
||||
<FirstString>`scores[1]</FirstString>
|
||||
<SecondString>0000000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B315D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000008000000555555555555B53F1C00000000000000000000000000000000000000C80D0008</SecondString>
|
||||
<SecondString>0000000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B315D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000800000024C436ADB877B23F1700000000000000000000000000000000000000C80D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>8</IntNumber>
|
||||
<FirstString>`scores[2]</FirstString>
|
||||
<SecondString>FF00000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B325D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000009000000555555555555B53F1C00000000000000000000000000000000000000C80D0008</SecondString>
|
||||
<SecondString>FF00000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B325D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000009000000611470683ED7AF3F1700000000000000000000000000000000000000C80D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>9</IntNumber>
|
||||
<FirstString>`scores[3]</FirstString>
|
||||
<SecondString>0080000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B335D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000A000000575555555555B53F1C00000000000000000000000000000000000000C80D0008</SecondString>
|
||||
<SecondString>0080000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B335D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000A000000ADB87792A58EB03F1700000000000000000000000000000000000000C80D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>10</IntNumber>
|
||||
<FirstString>`scores[4]</FirstString>
|
||||
<SecondString>0000800000000000000000000000000000002E400000000000000000000000000000000073636F7265735B345D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000B000000555555555555B53F1C00000000000000000000000000000000000000C80D0008</SecondString>
|
||||
<SecondString>0000800000000000000000000000000000002E400000000000000000000000000000000073636F7265735B345D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000B000000177E3526D203B53F1700000000000000000000000000000000000000C80D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>11</IntNumber>
|
||||
<FirstString>`scores[5]</FirstString>
|
||||
<SecondString>0000000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B355D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000C000000565555555555B53F1C00000000000000000000000000000000000000C80D0008</SecondString>
|
||||
<SecondString>0000000000000000000000000000000000002E400000000000000000000000000000000073636F7265735B355D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000C000000177E3526D203B53F1700000000000000000000000000000000000000C80D0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>12</IntNumber>
|
||||
<FirstString>`TIM3_CCR3</FirstString>
|
||||
<SecondString>FF000000000000000000000000000000008499400000000000000000000000000000000054494D335F434352330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000D000000EC8F97C128E0C03F1700000000000000000000000000000000000000560F0008</SecondString>
|
||||
</Wi>
|
||||
</LogicAnalyzers>
|
||||
<DebugDescription>
|
||||
|
@ -381,6 +369,18 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\Src\gen_signal.s</PathWithFileName>
|
||||
<FilenameWithoutPath>gen_signal.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
|
|
|
@ -407,6 +407,11 @@
|
|||
<FileType>4</FileType>
|
||||
<FilePath>.\Src\gfssp72.lib</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>gen_signal.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\gen_signal.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
|
5587
projet_keil/Src/gen_signal.s
Normal file
5587
projet_keil/Src/gen_signal.s
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,41 @@
|
|||
#include "gassp72.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
// **********************
|
||||
// * GESTION DU SON *
|
||||
// **********************
|
||||
typedef struct {
|
||||
int position; // index courant dans le tableau d'echantillons
|
||||
int taille; // nombre d'echantillons de l'enregistrement
|
||||
short int *son; // adresse de base du tableau d'echantillons en ROM
|
||||
int resolution; // pleine echelle du modulateur PWM
|
||||
int Tech_en_Tck; // periode d'ech. audio en periodes d'horloge CPU
|
||||
} type_etat;
|
||||
|
||||
// Variables définies en asm
|
||||
extern short Son;
|
||||
extern int LongueurSon;
|
||||
extern int PeriodeSonMicroSec;
|
||||
|
||||
type_etat etat;
|
||||
int Periode_PWM_en_Tck = 1638;
|
||||
int Periode_ech_en_Tck = 6552;
|
||||
|
||||
void timer_callback(void);
|
||||
|
||||
|
||||
|
||||
// ************************
|
||||
// * GESTION DU SCORE *
|
||||
// ************************
|
||||
|
||||
// Constantes
|
||||
#define NB_JOUEURS 6
|
||||
#define TYPE_SIGNAL 0x33
|
||||
const int SYSTICK_PER = 5*72000;
|
||||
const int N = 64;
|
||||
const int M2TIR = 985661;
|
||||
|
||||
|
||||
// Fe = 320 kHz donc pasFreq = 5 kHz
|
||||
// F1 = 85 kHz -> k = 17
|
||||
// F2 = 90 kHz -> k = 18
|
||||
|
@ -27,6 +55,14 @@ int scores[NB_JOUEURS];
|
|||
int time = 0;
|
||||
|
||||
|
||||
void incrementScore(int playerID) {
|
||||
// incrémentation du score
|
||||
++scores[playerID];
|
||||
// reset de la position pour jouer le son depuis le début
|
||||
etat.position = 0;
|
||||
}
|
||||
|
||||
|
||||
void callbackTimer(void) {
|
||||
// Démarrage DMA pour 64 points
|
||||
Start_DMA1(64);
|
||||
|
@ -38,7 +74,7 @@ void callbackTimer(void) {
|
|||
if (debug_result[i] > M2TIR) {
|
||||
++counters[i];
|
||||
if (counters[i] == 3) {
|
||||
++scores[i];
|
||||
incrementScore(i);
|
||||
}
|
||||
} else {
|
||||
counters[i] = 0;
|
||||
|
@ -59,10 +95,29 @@ int main(void) {
|
|||
CLOCK_Configure();
|
||||
// PA2 (ADC voie 2) = entrée analog
|
||||
GPIO_Configure(GPIOA, 2, INPUT, ANALOG);
|
||||
// PB1 = sortie pour profilage à l'oscillo
|
||||
GPIO_Configure(GPIOB, 1, OUTPUT, OUTPUT_PPULL);
|
||||
// PB14 = sortie pour LED
|
||||
GPIO_Configure(GPIOB, 14, OUTPUT, OUTPUT_PPULL);
|
||||
|
||||
// GESTION DU SON
|
||||
// config port PB0 pour être utilisé par TIM3-CH3
|
||||
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
|
||||
// config TIM3-CH3 en mode PWM
|
||||
etat.resolution = PWM_Init_ff(TIM3, 3, Periode_PWM_en_Tck);
|
||||
etat.taille = LongueurSon;
|
||||
etat.son = &Son;
|
||||
etat.position = LongueurSon;
|
||||
|
||||
// initialisation du timer 4
|
||||
// Periode_en_Tck doit fournir la durée entre interruptions,
|
||||
// exprimée en périodes Tck de l'horloge principale du STM32 (72 MHz)
|
||||
Timer_1234_Init_ff(TIM4, Periode_ech_en_Tck);
|
||||
|
||||
// enregistrement de la fonction de traitement de l'interruption timer
|
||||
// ici le 2 est la priorité, timer_callback est l'adresse de cette fonction, a créér en asm,
|
||||
// cette fonction doit être conforme à l'AAPCS
|
||||
Active_IT_Debordement_Timer(TIM4, 2, timer_callback);
|
||||
// lancement du timer pour jouer le son
|
||||
Run_Timer(TIM4);
|
||||
|
||||
|
||||
|
||||
// activation ADC, sampling time 1us
|
||||
Init_TimingADC_ActiveADC_ff(ADC1, TYPE_SIGNAL);
|
||||
|
@ -75,7 +130,7 @@ int main(void) {
|
|||
// Config Timer, période exprimée en périodes horloge CPU (72 MHz)
|
||||
Systick_Period_ff(SYSTICK_PER);
|
||||
// enregistrement de la fonction de traitement de l'interruption timer
|
||||
// ici le 3 est la priorité, sys_callback est l'adresse de cette fonction, a créér en C
|
||||
// ici le 3 est la priorité, callbackTimer est l'adresse de cette fonction, a créér en C
|
||||
Systick_Prio_IT(3, callbackTimer);
|
||||
SysTick_On;
|
||||
SysTick_Enable_IT;
|
||||
|
|
Loading…
Reference in a new issue