diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.h b/soft/PjtKEIL_StepSon/Src/GestionSon.h index e69de29..c5593ba 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.h +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.h @@ -0,0 +1,3 @@ +void callback_son(void); + +void start_son(void); \ No newline at end of file diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index a2d0f10..828dd2e 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -3,8 +3,9 @@ include Driver/DriverJeuLaser.inc export callback_son; + export start_son; export sortieSon; - extern Son; + extern Son; ; ====================== zone de réservation de données, ====================================== ;Section RAM (read only) : area mesdata,data,readonly @@ -25,9 +26,12 @@ index dcd 0 ; écrire le code ici callback_son - push{lr,r4}; + push{lr,r4,r5}; ldr r0, =index; ldr r4, [r0]; + mov r5, #5512; + cmp r4,r5; + bgt fin; ldr r1, =sortieSon; ldr r2, =Son; ldrsh r3, [r2, r4,lsl #1]; @@ -40,12 +44,13 @@ callback_son str r3, [r1]; mov r0,r3; bl PWM_Set_Value_TIM3_Ch3; - pop{pc,r4}; - END +fin + pop{pc,r4,r5}; -StartSon +start_son push{lr}; - - + ldr r0, =index; + mov r1, #0; + str r1, [r0]; pop{pc}; END \ No newline at end of file diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index 9be4734..dfbd742 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -1,7 +1,8 @@ #include "DriverJeuLaser.h" -extern void callback_son(void); - +extern void callback_son(void); +extern void start_son(void); +int button = 0; int main(void) { @@ -20,7 +21,11 @@ GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); while (1) { - + if (button == 1){ + start_son(); + button = 0; + } } + } diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index d844344..30ee7a5 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -75,7 +75,7 @@ 1 0 - 0 + 1 18 @@ -168,7 +168,7 @@ 0 1 - 1 + 0 0 0 0 @@ -182,7 +182,7 @@ 0 0 0 - 1 + 0 0 0 0 @@ -280,7 +280,7 @@ 1 0 - 1 + 0 18