Code source pour le BE-CHTI de l'année 2020-2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

principal.c 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "DriverJeuLaser.h"
  2. void timer_callback(void);
  3. int main(void)
  4. {
  5. // ===========================================================================
  6. // ============= INIT PERIPH (faites qu'une seule fois) =====================
  7. // ===========================================================================
  8. // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
  9. CLOCK_Configure();
  10. // configuration du Timer 4 en débordement 100ms
  11. //** Placez votre code là ** //
  12. //on a la clock a 72 Mhz donc pour avoir 100 ms il nus faut
  13. // 1 sec = 72 . 10^6 donc en
  14. // 7,2 Millions de cycles
  15. //c'est 100 ms
  16. Timer_1234_Init_ff( TIM1, 7200000);
  17. Active_IT_Debordement_Timer( TIM1, 2, timer_callback );
  18. // Activation des interruptions issues du Timer 4
  19. // Association de la fonction à exécuter lors de l'interruption : timer_callback
  20. // cette fonction (si écrite en ASM) doit être conforme à l'AAPCS
  21. //** Placez votre code là ** //
  22. // configuration de PortB.1 (PB1) en sortie push-pull
  23. GPIO_Configure(GPIOB, 1, OUTPUT, OUTPUT_PPULL);
  24. //============================================================================
  25. while (1)
  26. {
  27. }
  28. }
  29. //char FlagCligno;
  30. //void timer_callback(void)
  31. //{
  32. // if (FlagCligno==1)
  33. // {
  34. // FlagCligno=0;
  35. // GPIOB_Set(1);
  36. // }
  37. // else
  38. // {
  39. // FlagCligno=1;
  40. // GPIOB_Clear(1);
  41. // }
  42. //
  43. //}