int main() { CLOCK_Configure(); Service_Moteur_CC_Init(); Service_FM_Init(); Service_FM_Enable_IT(callback); /*Moteur_CC_Commande(-50);*/ while(1) { } return 0; }
int main (void) { //declaration de variables float alpha = 181; float theta; int i = 0; CLOCK_Configure(); init_commande_servo(); theta = conversion_angle(alpha); commande_servo(theta); while (1) { i++; } return 0; }
int main (void) { CLOCK_Configure(); Service_Girouette_Init(); //Config_Transmission(); Service_Moteur_CC_Init(); Service_FM_Init(); Service_FM_Enable_IT(callback); /*while (1) { if(Is_Low_Battery()) { Start_Transmission(); } }*/ while(1) { } return 0; }
int main (void) { /****************** * Main variables * ******************/ /******************* * Initializations * *******************/ // Clock CLOCK_Configure(); // Initialization of the whole clock tree // See clock_conf.h for more info on current config // USB communication usbCommInit(); // Signals processing sProcInit(); // Signals acquisition sampleAcquisitionInit(); /*********** * Process * ***********/ while(1) { } return 0; }
int main() { // Configuration du clock (passage de 8MHz à 72MHz) CLOCK_Configure(); //test servo output Timer_1234_Init(TIM2, 3000000.0 ); Timer_Active_IT( TIM2, 10, Test_Angle ); Init_Servo(); Angle=0; Augmente=1; Set_Angle_Servo(Angle); Init_Girouette(); while(1) { // //Set_Angle_Servo(Get_Angle_); } return 0; }
int main (void) { alerte_roulis=0; alerte_batterie=0; CLOCK_Configure(); /*###################################################### CONFIGURATION DES ENTREES/SORTIES ########################################################*/ //configuration GPIOA floating input port 5, 6 et 7 //(voie I & A & B) pour la girouette Port_IO_Init_Input(GPIOA, 5); Port_IO_Init_Input(GPIOA, 6); Port_IO_Init_Input(GPIOA, 7); //Config Servo-moteur Port_IO_Init_AF_Output ( GPIOA, 8); //Config Moteur-CC Port_IO_Init_AF_Output( GPIOA, 1); //PWM moteur cc Port_IO_Init_Output( GPIOA, 2); //sens du moteur cc //Config Récepteur RF Port_IO_Init_Input( GPIOB, 6); //Récepteur RF CH1 //Config liaison HF Port_IO_Init_AF_Output (GPIOA, 9); //USART : liaison HF Port_IO_Init_Output(GPIOA, 11); //TX_ENABLE //Config ADC Port_IO_Init_Analog_Input(GPIOC, Y_AXIS_CHANNEL); Port_IO_Init_Analog_Input(GPIOC, BATTERY_CHANNEL); /*###################################################### CONFIGURATION DES TIMERS ########################################################*/ //Enable clock Timer 3 Enable_CLK_Timer1234(TIM3); //init du codeur incrémental Init_Codeur(TIM3, 5); //configuration pour lire les impulsions du récepteur RF Timer_Init_PWM_Input(TIM4, 1, 20000); //Servo Moteur Timer_1234_Init(TIM1,20000); config_pwm (TIM1, 1, 5); // config TIM1 CH1 //Moteur CC (PWM) Timer_1234_Init(TIM2, 52); config_pwm(TIM2, 2,0); /*###################################################### CONFIGURATION DE L'USART ########################################################*/ //Config UART Config_UART_Projet_Bateau(USART1); Port_IO_Set( GPIOA, 11); /*###################################################### CONFIGURATION DES ADCs ########################################################*/ //Config Accéléromètre et niveau batterie power_ADC(ADC1); power_ADC(ADC2); config_adc_single_channel(ADC1, Y_AXIS_CHANNEL); config_adc_single_channel(ADC2, BATTERY_CHANNEL); /*###################################################### ACTIVATION DES INTERRUPTIONS ########################################################*/ //Recepteur RF & Moteur_CC Timer_Active_IT(TIM4,5, 2,notreTIM4_IRQHandler); //Accelerometre & Batterie Active_IT_ADC(ADC1, 1, &ADC_IT);//Accelerometre Active_IT_ADC(ADC2, 1, &ADC_IT);//Batterie Timer_Active_IT(TIM1, 99, 0, &Timer_IT);//f_s ADCs while(1) { alpha = lire_alpha(); //angle de la girouette Convert_alpha_DC(alpha,alerte_roulis); // le bras varie entre 0 et 90 deg // valeur correspondant a un bras a 0 deg (5%) // valeur correspondant a un bras a 90 deg (10%) // quand le bras est a 90 deg les voiles sont a 0 deg // quand le bras est a 0 deg les voiles sont a 90 deg d'amplitude // et le vent decide du signe de l'angle de la voile }; }