forked from acco/chti23
55 lines
No EOL
1.2 KiB
C
55 lines
No EOL
1.2 KiB
C
#include "DriverJeuLaser.h"
|
|
|
|
int main(void)
|
|
{
|
|
|
|
// ===========================================================================
|
|
// ============= INIT PERIPH (faites qu'une seule fois) =====================
|
|
// ===========================================================================
|
|
|
|
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
|
|
CLOCK_Configure();
|
|
|
|
// configuration du Timer 4 en débordement 91µs
|
|
Timer_1234_Init_ff(TIM4, 6552); //6552 équivalent à 91µs
|
|
|
|
// configuration du Timer 3 pour une PWM de fréquence 100kHz
|
|
PWM_Init_ff(TIM3, 3, 720);
|
|
|
|
//Récupération de la fonction timer_callback() codée en ASM
|
|
extern void callbackson();
|
|
|
|
|
|
|
|
// Activation des interruptions issues du Timer 4
|
|
// Association de la fonction à exécuter lors de l'interruption : timer_callback
|
|
// cette fonction (si écrite en ASM) doit être conforme à l'AAPCS
|
|
|
|
Active_IT_Debordement_Timer(TIM4, 2, callbackson);
|
|
|
|
// configuration de PortB.0 (PB0)
|
|
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
|
|
|
|
|
|
//============================================================================
|
|
|
|
while (1)
|
|
{
|
|
}
|
|
}
|
|
|
|
/*char FlagCligno;
|
|
|
|
void timer_callback(void)
|
|
{
|
|
if (FlagCligno==1)
|
|
{
|
|
FlagCligno=0;
|
|
GPIOB_Set(1);
|
|
}
|
|
else
|
|
{
|
|
FlagCligno=1;
|
|
GPIOB_Clear(1);
|
|
}
|
|
}*/ |