From 9f8d4e08f3f2176d04ae0cfffc99cf81c8c49386 Mon Sep 17 00:00:00 2001 From: Cedric Chanfreau Date: Tue, 11 Apr 2023 12:13:36 +0200 Subject: [PATCH 01/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fee8526..022ecfa 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ ### a) MyGPIO_Init -![Name](.\INSA\Microcontrôleur\README_picture) -![Image](file:///U:/INSA/Microcontr%C3%B4leur/README_picture/APB2ENR.png) +![Name](APB2ENR.png) +![Image](Voilier/README_picture/APB2ENR.png) ### b) MyGPIO_Read From 676a21ae664b847c771e3448e57e6f7ffe853167 Mon Sep 17 00:00:00 2001 From: Cedric Chanfreau Date: Tue, 11 Apr 2023 12:23:23 +0200 Subject: [PATCH 02/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 022ecfa..9624c90 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ### a) MyGPIO_Init ![Name](APB2ENR.png) -![Image](Voilier/README_picture/APB2ENR.png) +![test](README_picture/APB2ENR.png) ### b) MyGPIO_Read From 24491a1b10691c78932cdf6b2d972a271640a9ad Mon Sep 17 00:00:00 2001 From: Cedric Chanfreau Date: Tue, 11 Apr 2023 12:24:06 +0200 Subject: [PATCH 03/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9624c90..409d9a0 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ ### a) MyGPIO_Init -![Name](APB2ENR.png) -![test](README_picture/APB2ENR.png) +![RCC->APB2ENR](README_picture/APB2ENR.png) ### b) MyGPIO_Read From b1378c7cac696557c4193976d7b8f1d8c34b002b Mon Sep 17 00:00:00 2001 From: Cedric Chanfreau Date: Tue, 11 Apr 2023 12:24:59 +0200 Subject: [PATCH 04/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 409d9a0..c826cd6 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ ### a) MyGPIO_Init ![RCC->APB2ENR](README_picture/APB2ENR.png) +

+ +

### b) MyGPIO_Read From 791fabf4a2b34528c4cbcb7d7ca69b30cfa82d06 Mon Sep 17 00:00:00 2001 From: Cedric Chanfreau Date: Tue, 11 Apr 2023 12:26:11 +0200 Subject: [PATCH 05/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c826cd6..50c77e7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,12 @@ ![RCC->APB2ENR](README_picture/APB2ENR.png)

- + APB2ENR](README_picture/APB2ENR.png) /> +

+ +

+ ![RCC->APB2ENR](README_picture/APB2ENR.png) +

### b) MyGPIO_Read From 6b7db409d824d5bc1bf402e58b462a8606c53559 Mon Sep 17 00:00:00 2001 From: Cedric Chanfreau Date: Tue, 11 Apr 2023 12:27:07 +0200 Subject: [PATCH 06/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 50c77e7..fc7c7dd 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,9 @@ ### a) MyGPIO_Init + RCC->APB2ENR ![RCC->APB2ENR](README_picture/APB2ENR.png) -

- APB2ENR](README_picture/APB2ENR.png) /> -

-

- ![RCC->APB2ENR](README_picture/APB2ENR.png) - -

### b) MyGPIO_Read From 6ac0111519f21450bb8085c8d1ff17d9c583fe56 Mon Sep 17 00:00:00 2001 From: Cedric Chanfreau Date: Tue, 11 Apr 2023 12:38:40 +0200 Subject: [PATCH 07/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc7c7dd..08149d4 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ### a) MyGPIO_Init - RCC->APB2ENR +**RCC->APB2ENR** : On active l'horloge des périphériques des GPIO ![RCC->APB2ENR](README_picture/APB2ENR.png) From 8e19bd842c1f450223cb2504323b295c124ecdf7 Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 13:36:30 +0200 Subject: [PATCH 08/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 83 ++++++++++--------------------------------------------- 1 file changed, 14 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 08149d4..ce35505 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,18 @@ # Projet Voilier -## 1) GPIO - -### a) MyGPIO_Init - -**RCC->APB2ENR** : On active l'horloge des périphériques des GPIO -![RCC->APB2ENR](README_picture/APB2ENR.png) - - -### b) MyGPIO_Read - -### c) MyGPIO_Set - -### d) MyGPIO_Reset - -### e) MyGPIO_Toggle - - - -## 2) Timer - -### a) MyTimer_Init - -### b) MyTimer_Start - -### c) MyTimer_Stop - -### d) TIM1_Interrupt - -### e) TIM1_IRQHandler - -## 3) PWM - -### a) MyTimer_PWM - -## 4) ADC - -### a) MyADC_Init - -### b) MyADC_Init_Periph - -### c) MyADC_Result - -### d) MyADC_Start - -### e) MyADC_Base_Interuption - -### f) ADC1_2_IRQHandler - -## 5) UART - -### a) UART_init - -### b) UART_send - -### c) UART_read - -### d) UART_interruption - -### e) USART1_IRQHandler - -### f) UART_InitGPIO - -## 6) Plateau - -### a) Plateau_init - -### b) MyMotor_ChangeDirection - -## 7) Girouette +##Equipe 4 +* Clement MARCE +* Louis ROUSSET +* Cedric CHANFREAU +## Réalisation des drivers : +* [GPIOS](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_GPIO.c) //Done +* [TIMERS](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_Timer.c) //Done +* [PWM](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_Timer.c) //Done (Cédric) +* [ADC](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_ADC.c) //Done (Clement+Louis) +* [UART](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_UART.c) //Done (Cédric) +## Réalisation des différentes fonctions du bateau : +* [Girouette](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Voilier_fonction/Girouette.c) //Work in progress (Clement) +* [Plateau](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Voilier_fonction/Plateau.c) //Need to test (Cédric) +* From 4d96c1d53e1fd20d5089c52c9b0eb4866553954e Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 13:43:01 +0200 Subject: [PATCH 09/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ce35505..baec002 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,5 @@ ## Réalisation des différentes fonctions du bateau : * [Girouette](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Voilier_fonction/Girouette.c) //Work in progress (Clement) * [Plateau](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Voilier_fonction/Plateau.c) //Need to test (Cédric) -* From 4bf91d54e31e9fe6be8817e3169c3a248fd27a5c Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 13:43:17 +0200 Subject: [PATCH 10/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index baec002..d11ef2d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Projet Voilier -##Equipe 4 +## Equipe 4 * Clement MARCE * Louis ROUSSET * Cedric CHANFREAU From e06fea7cc1d80e2ca274039968136425b9b8adb3 Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 13:43:26 +0200 Subject: [PATCH 11/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d11ef2d..7b4ef9f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ * Clement MARCE * Louis ROUSSET * Cedric CHANFREAU + ## Réalisation des drivers : * [GPIOS](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_GPIO.c) //Done * [TIMERS](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_Timer.c) //Done From 9e9fc9eb4e156461ac642cd95de7244252d97ae4 Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 13:52:20 +0200 Subject: [PATCH 12/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'Drivers/Sources?= =?UTF-8?q?/Driver=5FGPIO.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drivers/Sources/Driver_GPIO.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Drivers/Sources/Driver_GPIO.c b/Drivers/Sources/Driver_GPIO.c index bac8120..52dd29d 100644 --- a/Drivers/Sources/Driver_GPIO.c +++ b/Drivers/Sources/Driver_GPIO.c @@ -5,26 +5,26 @@ void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr ) { - /* Activation of the GPIO port specific clock */ + /* Activation de la clock liée au GPIO sélectionné */ if (GPIOStructPtr->GPIO == GPIOA) { - RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; - } + RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; + } else if (GPIOStructPtr->GPIO == GPIOB) { RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; - } + } else if (GPIOStructPtr->GPIO == GPIOC) { RCC->APB2ENR |= RCC_APB2ENR_IOPCEN; - } + } else if (GPIOStructPtr->GPIO == GPIOD) { RCC->APB2ENR |= RCC_APB2ENR_IOPDEN; } - /* Reset, and then configuration writing of the selected GPIO Pin */ + /* Reset & configuration de la pin avec le mode adéquat */ if(GPIOStructPtr->GPIO_Pin <= 8) { GPIOStructPtr->GPIO->CRL &= ~0xF<<(4*(GPIOStructPtr->GPIO_Pin)); @@ -36,6 +36,7 @@ void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr ) GPIOStructPtr->GPIO->CRH |= (GPIOStructPtr->GPIO_Conf)<<(4*((GPIOStructPtr->GPIO_Pin)%8)); } + /* Ecriture de l'ODR pour choisir entre pulldown & pushpull*/ if(GPIOStructPtr->GPIO_Conf == (char)In_PullDown) { GPIOStructPtr->GPIO->ODR &= ~(0x1<<(GPIOStructPtr->GPIO_Pin)); @@ -49,7 +50,8 @@ void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr ) //----------------------------READ--------------------------// int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ){ int etatbit; -//On vérifie si la valeur lue dans l'IDR est un 0 ou un 1 + + /* Verification de la valeur de l'IDR */ if((GPIO->IDR & (1<BSRR |= (1 << GPIO_Pin); } //---------------------RESET-----------------// void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin ){ + + /*Ecriture du 1 sur le numéro de la pin dans le registre BRR*/ GPIO->BRR = (1 << GPIO_Pin); - //Pas besoin de | puisque les 0 n'impactent pas la fonction reset } //---------------------TOGGLE-----------------// From da4f66ed73854fd65758a9e36f07b27d7cf92a3c Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 13:57:19 +0200 Subject: [PATCH 13/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'Drivers/Sources?= =?UTF-8?q?/Driver=5FTimer.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drivers/Sources/Driver_Timer.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Drivers/Sources/Driver_Timer.c b/Drivers/Sources/Driver_Timer.c index 6784afe..85fc546 100644 --- a/Drivers/Sources/Driver_Timer.c +++ b/Drivers/Sources/Driver_Timer.c @@ -2,6 +2,8 @@ //-----------------------INITIALISATION TIMER---------------------// void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){ + + /* Activation de la clock liée au TIMER sélectionné */ if(Timer->Timer == TIM1){ //RCC->APB2ENR |= 0x0001<<11; RCC->APB2ENR |= RCC_APB2ENR_TIM1EN; @@ -19,6 +21,7 @@ void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){ RCC->APB1ENR |= RCC_APB1ENR_TIM4EN; } + /* Load des valeurs de l'ARR et du PSC */ Timer->Timer->ARR = Timer->ARR; Timer->Timer->PSC = Timer->PSC; @@ -27,20 +30,21 @@ void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){ //-----------------------START----------------------// void MyTimer_Base_Start(TIM_TypeDef * Timer){ - Timer->CR1 |= TIM_CR1_CEN; //Masque OU pour placer un 1 décalé avec des 0 + Timer->CR1 |= TIM_CR1_CEN; //* Masque OU pour placer un 1 décalé avec des 0 */ } //------------------------STOP----------------------// void MyTimer_Base_Stop(TIM_TypeDef * Timer){ - Timer->CR1 |= ~TIM_CR1_CEN; //Masque ET pour placer un 0 décalé avec des 1 (~) + Timer->CR1 |= ~TIM_CR1_CEN; /* Masque ET pour placer un 0 décalé avec des 1 (~) */ } void MyTimer_PWM( MyTimer_Struct_TypeDef * Timer, uint16_t cycle){ - Timer->Timer->CCMR1 &= ~TIM_CCMR1_OC1M_0; //Configuration du canal CH1 - Timer->Timer->CCMR1 |= TIM_CCMR1_OC1M_1| TIM_CCMR1_OC1M_2; // Ajouter 110 aux bits OC1M (registre CCMR1) + + Timer->Timer->CCMR1 &= ~TIM_CCMR1_OC1M_0; /* Configuration du canal CH1 */ + Timer->Timer->CCMR1 |= TIM_CCMR1_OC1M_1| TIM_CCMR1_OC1M_2; /* Ajouter 110 aux bits OC1M (registre CCMR1) */ - Timer->Timer->CCER |= TIM_CCER_CC1E; // Canal CH1 validé par bit CC1E (registre CCER) - Timer->Timer->CR1 |= TIM_CR1_CEN; // Lancement du timer - Timer->Timer->CCR1 = (cycle * Timer->ARR) / 100; // Fixer la durée à 20% + Timer->Timer->CCER |= TIM_CCER_CC1E; /* Canal CH1 validé par bit CC1E (registre CCER) */ + Timer->Timer->CR1 |= TIM_CR1_CEN; /* Lancement du timer */ + Timer->Timer->CCR1 = (cycle * Timer->ARR) / 100; /* Fixer la durée à 20% */ } From 730d0cddd4894b428ef0b6c3cdeacaa0f47d7052 Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 13:57:50 +0200 Subject: [PATCH 14/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'Drivers/Sources?= =?UTF-8?q?/Driver=5FTimer.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drivers/Sources/Driver_Timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Drivers/Sources/Driver_Timer.c b/Drivers/Sources/Driver_Timer.c index 85fc546..92e78c9 100644 --- a/Drivers/Sources/Driver_Timer.c +++ b/Drivers/Sources/Driver_Timer.c @@ -21,7 +21,7 @@ void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){ RCC->APB1ENR |= RCC_APB1ENR_TIM4EN; } - /* Load des valeurs de l'ARR et du PSC */ + /* Load des valeurs de l'ARR et du PSC pour définir la période de comptage du TIMER et sa limite*/ Timer->Timer->ARR = Timer->ARR; Timer->Timer->PSC = Timer->PSC; From 7e19976938bfef5e602afa04a0feeff196cb9189 Mon Sep 17 00:00:00 2001 From: Louis Rousset Date: Tue, 11 Apr 2023 14:16:32 +0200 Subject: [PATCH 15/15] =?UTF-8?q?Mettre=20=C3=A0=20jour=20'Drivers/Sources?= =?UTF-8?q?/Driver=5FADC.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drivers/Sources/Driver_ADC.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Drivers/Sources/Driver_ADC.c b/Drivers/Sources/Driver_ADC.c index 8e3db1b..17cc84e 100644 --- a/Drivers/Sources/Driver_ADC.c +++ b/Drivers/Sources/Driver_ADC.c @@ -2,29 +2,29 @@ #include "Driver_GPIO.h" -void (*PtrfctADC)(void); //Déclaration du pointeur de fonction ADC +void (*PtrfctADC)(void); /* Déclaration du pointeur de fonction ADC pour l'interrupt */ //---------------------INIT-------------------// void MyADC_Base_Init(MyADC_Struct_TypeDef * ADC){ - MyGPIO_Struct_TypeDef * GPIO_ADC; //Déclaration du GPIO de l'ADC + MyGPIO_Struct_TypeDef * GPIO_ADC; /* Déclaration du GPIO lié à l'ADC */ - RCC->CFGR |= RCC_CFGR_ADCPRE_DIV6; //Division par 6 de la clock (72MHz) pour l'ADC (12MHz) - RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; //Start clock ADC1 + RCC->CFGR |= RCC_CFGR_ADCPRE_DIV6; /*Division par 6 de la clock (72MHz) pour l'ADC (12MHz) car clock max ADC : 14MHz */ + RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; /* Start clock de l'ADC1 */ - GPIO_ADC->GPIO = GPIOC; //Initialisation du GPIO de l'ADC + GPIO_ADC->GPIO = GPIOC; /* Initialisation du GPIO lié à l'ADC */ GPIO_ADC->GPIO_Conf = In_Analog; GPIO_ADC->GPIO_Pin = 0; MyGPIO_Init(GPIO_ADC); - ADC1->SQR1 &= ADC_SQR1_L; //fixe le nombre de conversion à 1 - ADC1->SQR3|= ADC->Channel; //indique la voie à convertir - ADC1->CR2 |= ADC_CR2_EXTTRIG; //activation du trigger externe - ADC1->CR2 |= ADC_CR2_EXTSEL; //event externe choisis : SWSTART + ADC1->SQR1 &= ADC_SQR1_L; /* Fixation du nombre de conversion à 1 */ + ADC1->SQR3|= ADC->Channel; /* Choix de la voie à convertir */ + ADC1->CR2 |= ADC_CR2_EXTTRIG; /* Activation du trigger externe */ + ADC1->CR2 |= ADC_CR2_EXTSEL; /* event externe choisis : SWSTART */ - MyADC_Base_Start(ADC->ADC); //Sart ADC1 et Horloge ADC1 + MyADC_Base_Start(ADC->ADC); /* Sart ADC1 et Horloge ADC1 */ } @@ -36,25 +36,25 @@ void MyADC_Base_Start(ADC_TypeDef * ADC){ //------------------INTERRUPTION--------------// void MyADC_Base_Interuption(ADC_TypeDef * ADC){ - //Activation du trigger externe - ADC->CR1 |= ADC_CR1_EOCIE; //Interruption de l'ADC autorisée - NVIC->ISER[0] |= (0x1<IP[ADC1_2_IRQn] |= 1<<4; //Affectation du niveau de priorité + /* Activation du trigger externe */ + ADC->CR1 |= ADC_CR1_EOCIE; /* Interruption de l'ADC autorisée */ + NVIC->ISER[0] |= (0x1<IP[ADC1_2_IRQn] |= 1<<4; /* Affectation du niveau de priorité */ } //--------------------HANDLER-----------------// void ADC1_2_IRQHandler (void) { - (*PtrfctADC)(); //Appel de la fonction pointée par le pointeur fonction ADC + (*PtrfctADC)(); /* Appel de la fonction pointée par le pointeur fonction ADC */ MyADC_Base_Start(ADC1); - ADC1->SR &= ~ADC_SR_EOC; //RAZ du flag end of conversion + ADC1->SR &= ~ADC_SR_EOC; /* RAZ du flag de fin de conversion */ } //--------------------DATA--------------------// int MyADC_Base_Result (MyADC_Struct_TypeDef * ADC){ - return ADC1->DR & ~((0x0F)<<12); //Retour de la conversion de l'ADC + return ADC1->DR & ~((0x0F)<<12); /* Récuperation du résultat de la conversion de l'ADC */ } //-------------------POINTEUR-----------------// void MyADC_Init_Periph (void (*fct)(void)){ - PtrfctADC=fct; //Affectation du pointeur de fonction ADC + PtrfctADC=fct; /* Affectation du pointeur de fonction ADC */ }