diff --git a/LLDrivers/inc/stm32f1xx_ll_adc.h b/LLDrivers/inc/stm32f1xx_ll_adc.h
index 6443ce6..b8cd276 100644
--- a/LLDrivers/inc/stm32f1xx_ll_adc.h
+++ b/LLDrivers/inc/stm32f1xx_ll_adc.h
@@ -3539,12 +3539,8 @@ __STATIC_INLINE uint32_t LL_ADC_INJ_ReadConversionData32(ADC_TypeDef *ADCx, uint
__STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData12(ADC_TypeDef *ADCx, uint32_t Rank)
{
register __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
-<<<<<<< HEAD
return (uint16_t)(READ_BIT(*preg,
-=======
- return (uint16_t)(READ_BIT(*preg,
->>>>>>> origin/Anti-chavirement-v2
ADC_JDR1_JDATA)
);
}
@@ -3585,12 +3581,8 @@ __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOS(ADC_TypeDef *ADCx)
/* end of unitary conversion. */
/* Flag noted as "JEOC" is corresponding to flag "JEOS" */
/* in other STM32 families). */
-<<<<<<< HEAD
return (READ_BIT(ADCx->SR, LL_ADC_FLAG_JEOS) == (LL_ADC_FLAG_JEOS));
}
-=======
- return (READ_BIT(ADCx->SR, LL_ADC_FLAG_JEOS) == (LL_ADC_FLAG_JEOS));}
->>>>>>> origin/Anti-chavirement-v2
/**
* @brief Get flag ADC analog watchdog 1 flag
diff --git a/MDK-ARM/Project.uvoptx b/MDK-ARM/Project.uvoptx
index 547f480..a3deb64 100644
--- a/MDK-ARM/Project.uvoptx
+++ b/MDK-ARM/Project.uvoptx
@@ -75,7 +75,7 @@
1
0
- 0
+ 1
18
@@ -103,7 +103,7 @@
1
0
0
- 6
+ 0
@@ -114,7 +114,7 @@
- STLink\ST-LINKIII-KEIL_SWO.dll
+ BIN\UL2CM3.DLL
@@ -130,7 +130,7 @@
0
DLGTARM
- (1010=668,263,1044,820,0)(1007=-1,-1,-1,-1,0)(1008=179,560,555,796,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1037,48,1458,453,0)(121=-1,-1,-1,-1,0)(122=348,235,769,640,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=87,183,486,528,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=621,97,1215,791,0)(131=157,121,751,815,0)(132=147,87,741,781,0)(133=524,166,1118,860,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
+ (1010=668,263,1044,820,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1027,281,1448,686,0)(121=-1,-1,-1,-1,0)(122=348,235,769,640,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=87,183,486,528,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=784,58,1378,752,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
0
@@ -145,7 +145,7 @@
0
UL2CM3
- UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))
+ -UAny -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)
0
@@ -154,28 +154,6 @@
-
-
- 0
- 1
- commandouille,0x0A
-
-
- 1
- 1
- lecture,0x0A
-
-
- 2
- 1
- lecture1
-
-
- 3
- 1
- lecture2
-
-
0
@@ -184,7 +162,7 @@
1
1
0
- 1
+ 0
0
0
1
@@ -196,7 +174,7 @@
0
0
0
- 0
+ 1
0
0
0
@@ -282,7 +260,7 @@
1
0
- 1
+ 0
18
@@ -327,7 +305,7 @@
0
DLGDARM
- (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=120,153,415,450,0)(120=204,207,625,634,0)(121=-1,-1,-1,-1,0)(122=896,89,1317,516,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=248,17,842,768,0)(131=521,17,1115,768,0)(132=709,34,1303,785,0)(133=-1,-1,-1,-1,0)(160=79,295,527,709,1)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
+ (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=120,153,415,450,0)(120=204,207,625,634,0)(121=-1,-1,-1,-1,0)(122=896,89,1317,516,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=248,17,842,768,0)(131=521,17,1115,768,0)(132=709,34,1303,785,0)(133=-1,-1,-1,-1,0)(160=251,288,699,702,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
0
@@ -364,62 +342,45 @@
0
0
- 99
+ 48
1
- 134221672
+ 134218244
0
0
0
0
0
1
- ..\MyDrivers\MyTimer.c
+ ..\Src\Allure.c
- \\NUCLEO_F103RB\../MyDrivers/MyTimer.c\99
+ \\NUCLEO_F103RB\../Src/Allure.c\48
0
1
- USART1
+ Chrono_Time
1
1
- res10,0x0A
+ USART1
2
1
- level,0x0A
-
-
- 3
- 1
- danger,0x0A
-
-
- 2
- 1
- index
-
-
- 3
- 1
- tailleAllure
-
-
- 4
- 1
- tailleTension
-
-
- 5
- 1
- drapeauTransmission
+ allure
+
+
+ 1
+ 0
+ 0x20000400
+ 0
+
+
0
@@ -428,7 +389,7 @@
1
1
0
- 1
+ 0
0
0
1
@@ -440,7 +401,7 @@
0
0
0
- 1
+ 0
0
0
0
@@ -465,16 +426,10 @@
0
- ((TIM_TypeDef *)(0x40000000UL + 0x00000000UL))->CNT
- FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1900000000000000000000000000000000000000B6020008
+ ((PORTA & 0x00000100) >> 8 & 0x100) >> 8
+ FF0000000000000000000000000000000000F03F0100000000000000000000000000000028504F5254412026203078303030303031303029203E3E2038000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000AC030008
-
-
- System Viewer\USART1
- 35905
-
-
1
0
@@ -495,7 +450,7 @@
1
1
1
- 0
+ 1
0
0
..\Src\Voilier.c
@@ -518,18 +473,6 @@
0
0
0
- ..\MyDrivers\MyTimer.c
- MyTimer.c
- 0
- 0
-
-
- 2
- 3
- 1
- 0
- 0
- 0
..\Src\Allure.c
Allure.c
0
@@ -537,19 +480,7 @@
2
- 4
- 1
- 0
- 0
- 0
- ..\Src\Batterie.c
- Batterie.c
- 0
- 0
-
-
- 2
- 5
+ 3
1
0
0
@@ -561,7 +492,7 @@
2
- 5
+ 4
1
0
0
@@ -573,7 +504,7 @@
2
- 6
+ 5
1
0
0
@@ -585,7 +516,7 @@
2
- 7
+ 6
1
0
0
@@ -597,175 +528,7 @@
2
- 9
- 5
- 0
- 0
- 0
- ..\Src\Allure.h
- Allure.h
- 0
- 0
-
-
- 2
- 10
- 5
- 0
- 0
- 0
- ..\Src\AntiChavirement.h
- AntiChavirement.h
- 0
- 0
-
-
- 2
- 11
- 5
- 0
- 0
- 0
- ..\Src\Batterie.h
- Batterie.h
- 0
- 0
-
-
- 2
- 12
- 5
- 0
- 0
- 0
- ..\Src\Gouvernail.h
- Gouvernail.h
- 0
- 0
-
-
- 2
- 13
- 5
- 0
- 0
- 0
- ..\Src\Heure.h
- Heure.h
- 0
- 0
-
-
- 2
- 14
- 5
- 0
- 0
- 0
- ..\Src\MyTimer.h
- MyTimer.h
- 0
- 0
-
-
- 2
- 15
- 5
- 0
- 0
- 0
- ..\Src\Transmission.h
- Transmission.h
- 0
- 0
-
-
- 2
- 16
- 5
- 0
- 0
- 0
- ..\Src\Voile.h
- Voile.h
- 0
- 0
-
-
- 2
- 17
- 1
- 0
- 0
- 0
- ..\Src\AntiChavirement.c
- AntiChavirement.c
- 0
- 0
-
-
- 2
- 18
- 1
- 0
- 0
- 0
- ..\Src\Securite.c
- Securite.c
- 0
- 0
-
-
- 2
- 19
- 5
- 0
- 0
- 0
- ..\Src\Securite.h
- Securite.h
- 0
- 0
-
-
- 2
- 9
- 5
- 0
- 0
- 0
- ..\Src\Allure.h
- Allure.h
- 0
- 0
-
-
- 2
- 10
- 5
- 0
- 0
- 0
- ..\MyDrivers\MyTimer.h
- MyTimer.h
- 0
- 0
-
-
- 2
- 11
- 5
- 0
- 0
- 0
- ..\Src\maths.h
- maths.h
- 0
- 0
-
-
- 2
- 12
+ 7
1
0
0
@@ -777,13 +540,13 @@
2
- 14
- 5
+ 8
+ 1
0
0
0
- ..\Src\Gouvernail.h
- Gouvernail.h
+ ..\Src\Securite.c
+ Securite.c
0
0
@@ -797,7 +560,7 @@
0
3
- 15
+ 9
1
0
0
@@ -809,7 +572,7 @@
3
- 16
+ 10
1
0
0
@@ -821,7 +584,7 @@
3
- 17
+ 11
1
0
0
@@ -833,7 +596,7 @@
3
- 18
+ 12
1
0
0
@@ -845,7 +608,7 @@
3
- 19
+ 13
1
0
0
@@ -873,7 +636,7 @@
0
5
- 20
+ 14
1
0
0
@@ -893,7 +656,7 @@
0
6
- 21
+ 15
2
0
0
diff --git a/MDK-ARM/Project.uvprojx b/MDK-ARM/Project.uvprojx
index 5a964aa..42336c6 100644
--- a/MDK-ARM/Project.uvprojx
+++ b/MDK-ARM/Project.uvprojx
@@ -11,7 +11,7 @@
0x4
ARM-ADS
5060750::V5.06 update 6 (build 750)::ARMCC
- 8
+ 0
STM32F103RB
@@ -392,21 +392,11 @@
MyDrivers
-
- MyTimer.c
- 1
- ..\MyDrivers\MyTimer.c
-
Allure.c
1
..\Src\Allure.c
-
- Batterie.c
- 1
- ..\Src\Batterie.c
-
Gouvernail.c
1
@@ -427,36 +417,15 @@
1
..\Src\Voile.c
-
- Allure.h
- 5
- ..\Src\Allure.h
-
-
- MyTimer.h
- 5
- ..\MyDrivers\MyTimer.h
-
-
- maths.h
- 5
- ..\Src\maths.h
-
maths.c
1
..\Src\maths.c
-<<<<<<< HEAD
- Transmission.h
- 5
- ..\Src\Transmission.h
-=======
- Gouvernail.h
- 5
- ..\Src\Gouvernail.h
->>>>>>> Gouvernail
+ Securite.c
+ 1
+ ..\Src\Securite.c
@@ -904,21 +873,11 @@
MyDrivers
-
- MyTimer.c
- 1
- ..\MyDrivers\MyTimer.c
-
Allure.c
1
..\Src\Allure.c
-
- Batterie.c
- 1
- ..\Src\Batterie.c
-
Gouvernail.c
1
@@ -939,36 +898,15 @@
1
..\Src\Voile.c
-
- Allure.h
- 5
- ..\Src\Allure.h
-
-
- MyTimer.h
- 5
- ..\MyDrivers\MyTimer.h
-
-
- maths.h
- 5
- ..\Src\maths.h
-
maths.c
1
..\Src\maths.c
-<<<<<<< HEAD
- Transmission.h
- 5
- ..\Src\Transmission.h
-=======
- Gouvernail.h
- 5
- ..\Src\Gouvernail.h
->>>>>>> Gouvernail
+ Securite.c
+ 1
+ ..\Src\Securite.c
diff --git a/Src/Allure.c b/Src/Allure.c
index 8c411d2..0925b59 100644
--- a/Src/Allure.c
+++ b/Src/Allure.c
@@ -70,7 +70,7 @@ int RecupAllure(void) {
}
}
-char * ToString(int alpha) {
+char * AllureToString(int alpha) {
int alpha_abs = abs(alpha);
if (alpha_abs < 45) {
return "Vent debout";
diff --git a/Src/Allure.h b/Src/Allure.h
index 068cc0d..e359520 100644
--- a/Src/Allure.h
+++ b/Src/Allure.h
@@ -36,6 +36,6 @@ int RecupAllure(void);
* @param alpha : un entier représentant l'allure en ° (-180 à 180)
* @retval Une chaine de caractère représentant l'allure
*/
-char * ToString(int alpha);
+char * AllureToString(int alpha);
#endif
diff --git a/Src/MyTimer.c b/Src/MyTimer.c
deleted file mode 100644
index 54bd39c..0000000
--- a/Src/MyTimer.c
+++ /dev/null
@@ -1,183 +0,0 @@
-// TOUT A FAIRE !! //
-
-/*
- indispensable pour pouvoir adresser les registres des périphériques.
- Rem : OBLIGATION d'utiliser les définitions utiles contenues dans ce fichier (ex : TIM_CR1_CEN, RCC_APB1ENR_TIM2EN ...)
- pour une meilleure lisibilité du code.
-
- Pour les masques, utiliser également les définitions proposée
- Rappel : pour mettre à 1 , reg = reg | Mask (ou Mask est le représente le ou les bits à positionner à 1)
- pour mettre à 0 , reg = reg&~ Mask (ou Mask est le représente le ou les bits à positionner à 0)
-
-*/
-
-#include "MyTimer.h"
-#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges
-#include "stm32f1xx_ll_tim.h"
-
-
-// variable pointeur de fonction permettant de mémoriser le callback à appeler depuis
-// le handler d'IT
-void (*Ptr_ItFct_TIM1)(void);
-void (*Ptr_ItFct_TIM2)(void);
-void (*Ptr_ItFct_TIM3)(void);
-void (*Ptr_ItFct_TIM4)(void);
-
-
-
-
-
-/**
- * @brief Active l'horloge et règle l'ARR et le PSC du timer visé
- * @note Fonction à lancer avant toute autre. Le timer n'est pas encore lancé (voir MyTimerStart)
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * int Arr : valeur à placer dans ARR
- * int Psc : valeur à placer dans PSC
- * @retval None
- */
-void MyTimer_Conf(TIM_TypeDef * Timer,int Arr, int Psc)
-{
- LL_TIM_InitTypeDef My_LL_Tim_Init_Struct;
-
- // Validation horloge locale
- if (Timer==TIM1) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1);
- else if (Timer==TIM2) LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM2);
- else if (Timer==TIM3) LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM3);
- else LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM4);
-
- // chargement structure Arr, Psc, Up Count
- My_LL_Tim_Init_Struct.Autoreload=Arr;
- My_LL_Tim_Init_Struct.Prescaler=Psc;
- My_LL_Tim_Init_Struct.ClockDivision=LL_TIM_CLOCKDIVISION_DIV1;
- My_LL_Tim_Init_Struct.CounterMode=LL_TIM_COUNTERMODE_UP;
- My_LL_Tim_Init_Struct.RepetitionCounter=0;
-
- LL_TIM_Init(Timer,&My_LL_Tim_Init_Struct);
-
-
- // Blocage IT
- LL_TIM_DisableIT_UPDATE(Timer);
-
-
- // Blocage Timer
- LL_TIM_DisableCounter(Timer);
-
-
-
-}
-
-
-/**
- * @brief Démarre le timer considéré
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_Start(TIM_TypeDef * Timer)
-{
- LL_TIM_EnableCounter(Timer);
-}
-
-/**
- * @brief Arrêt le timer considéré
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_Stop(TIM_TypeDef * Timer)
-{
- LL_TIM_DisableCounter(Timer);
-}
-
-
-/**
- * @brief Configure le Timer considéré en interruption sur débordement.
- * @note A ce stade, les interruptions ne sont pas validés (voir MyTimer_IT_Enable )
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * void (*IT_function) (void) : nom (adresse) de la fonction à lancer sur interruption
- * int Prio : priorité associée à l'interruption
- * @retval None
- */
-void MyTimer_IT_Conf(TIM_TypeDef * Timer, void (*IT_function) (void),int Prio)
-{
- // affectation de la fonction
- if (Timer==TIM1) Ptr_ItFct_TIM1=IT_function;
- else if (Timer==TIM2) Ptr_ItFct_TIM2=IT_function;
- else if (Timer==TIM3) Ptr_ItFct_TIM3=IT_function;
- else Ptr_ItFct_TIM4=IT_function;
-
-
- // Blocage IT (il faudra la débloquer voir fct suivante)
- LL_TIM_DisableIT_UPDATE(Timer);
-
- // validation du canal NVIC
- IRQn_Type TIM_irq;
-
- if (Timer==TIM1) TIM_irq=TIM1_UP_IRQn;
- else if (Timer==TIM2) TIM_irq=TIM2_IRQn;
- else if (Timer==TIM3) TIM_irq=TIM3_IRQn;
- else TIM_irq=TIM4_IRQn;
-
- NVIC_SetPriority(TIM_irq, Prio);
- NVIC_EnableIRQ(TIM_irq);
-
-
-}
-
-
-/**
- * @brief Autorise les interruptions
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_IT_Enable(TIM_TypeDef * Timer)
-{
- LL_TIM_EnableIT_UPDATE(Timer);
-}
-
-
-/**
- * @brief Interdit les interruptions
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_IT_Disable(TIM_TypeDef * Timer)
-{
- LL_TIM_DisableIT_UPDATE(Timer);
-}
-
-
-/*
-============ LES INTERRUPTIONS =================================
-
-*/
-
-void TIM1_UP_IRQHandler(void)
-{
- // rabaisser le flag d'IT
- LL_TIM_ClearFlag_UPDATE(TIM1);
- (*Ptr_ItFct_TIM1)();
-}
-
-void TIM2_IRQHandler(void)
-{
- // rabaisser le flag d'IT
- LL_TIM_ClearFlag_UPDATE(TIM2);
- (*Ptr_ItFct_TIM2)();
-}
-
-void TIM3_IRQHandler(void)
-{
- // rabaisser le flag d'IT
- LL_TIM_ClearFlag_UPDATE(TIM3);
- (*Ptr_ItFct_TIM3)();
-}
-
-void TIM4_IRQHandler(void)
-{
- // rabaisser le flag d'IT
- LL_TIM_ClearFlag_UPDATE(TIM4);
- (*Ptr_ItFct_TIM4)();
-}
diff --git a/Src/MyTimer.h b/Src/MyTimer.h
deleted file mode 100644
index f2fa06c..0000000
--- a/Src/MyTimer.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// RIEN A MODIFIER //
-
-#ifndef MY_TIMER_H
-#define MY_TIMER_H
-
-/*
-Driver pour Timer 1 à 4 du STM32F103RB
-
-*/
-
-#include "stm32f103xb.h"
-
-/**
- * @brief Active l'horloge et règle l'ARR et le PSC du timer visé
- * @note Fonction à lancer avant toute autre. Le timer n'est pas encore lancé (voir MyTimerStart)
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * int Arr : valeur à placer dans ARR
- * int Psc : valeur à placer dans PSC
- * @retval None
- */
-void MyTimer_Conf(TIM_TypeDef * Timer,int Arr, int Psc);
-
-
-/**
- * @brief Démarre le timer considéré
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_Start(TIM_TypeDef * Timer);
-
-
-/**
- * @brief Arrêt le timer considéré
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_Stop(TIM_TypeDef * Timer);
-
-
-/**
- * @brief Configure le Timer considéré en interruption sur débordement.
- * @note A ce stade, les interruptions ne sont pas validés (voir MyTimer_IT_Enable )
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * void (*IT_function) (void) : nom (adresse) de la fonction à lancer sur interruption
- * int Prio : priorité associée à l'interruption
- * @retval None
- */
-void MyTimer_IT_Conf(TIM_TypeDef * Timer, void (*IT_function) (void),int Prio);
-
-
-/**
- * @brief Autorise les interruptions
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_IT_Enable(TIM_TypeDef * Timer);
-
-
-/**
- * @brief Interdit les interruptions
- * @note
- * @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
- * @retval None
- */
-void MyTimer_IT_Disable(TIM_TypeDef * Timer);
-
-#endif
diff --git a/Src/Securite.c b/Src/Securite.c
index 6ec87c4..116cdb3 100644
--- a/Src/Securite.c
+++ b/Src/Securite.c
@@ -1,4 +1,11 @@
-#include "Securite.h"
+#include "stm32f103xb.h"
+#include "stm32f1xx_ll_adc.h"
+#include "stm32f1xx_ll_gpio.h"
+#include "stm32f1xx_ll_bus.h"
+#include "stm32f1xx_ll_utils.h" // utile dans la fonction SystemClock_Config
+#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
+#include "stm32f1xx_ll_rcc.h" // utile dans la fonction SystemClock_Config
+#include "Voile.h"
// Seuil represente la valeur (en %) en dessous de laquelle le niveau de batterie est consideree faible
@@ -12,7 +19,6 @@ int drapeauRecupSecurite = 0; // Flag qui est mis
int drapeauDangerBatterie = 0; //Flag qui est mis à 1 toute les 10 sec si batterie faible --> envoie message alarme
int drapeauDangerRouli = 0; //Flag qui est mis à 1 toute les 10 sec si rouli pas bon --> envoie message alarme
-
void ConfSecurite(){
//On est pas sûrs pour ADC 1, voir datasheet page 28
@@ -139,87 +145,3 @@ int RecupRouli(){
return 0; // Trouver le calcul de l'angle
}
-void SystemClock_Config(void)
-{
- /* Set FLASH latency */
- LL_FLASH_SetLatency(LL_FLASH_LATENCY_2);
-
- /* Enable HSE oscillator */
- // ********* Commenter la ligne ci-dessous pour MCBSTM32 *****************
- // ********* Conserver la ligne si Nucléo*********************************
- LL_RCC_HSE_EnableBypass();
- LL_RCC_HSE_Enable();
- while(LL_RCC_HSE_IsReady() != 1)
- {
- };
-
- /* Main PLL configuration and activation */
- LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9);
-
- LL_RCC_PLL_Enable();
- while(LL_RCC_PLL_IsReady() != 1)
- {
- };
-
- /* Sysclk activation on the main PLL */
- LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
- LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
- while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
- {
- };
-
- /* Set APB1 & APB2 prescaler*/
- LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2);
- LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
-
- /* Set systick to 1ms in using frequency set to 72MHz */
- LL_Init1msTick(72000000); // utile lorsqu'on utilise la fonction LL_mDelay
-
- /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
- LL_SetSystemCoreClock(72000000);
-}
-
-int res10;
-int level ;
-int danger;
-int rouli;
-
-//Dans le main voilier.c en theorie
-int main(){
- SystemClock_Config();
- ConfSecurite();
-
-
- while(1){
-
- /* Envoi message toute les 3 sec sur l'Allure et la tension voile */
- if (drapeauTransimission){
- //Envoi message régulier
- drapeauTransmission = 0;
- }
-
- /* Recuperation toute les 10 sec niveau batterie et angle chavirement, puis calcul des dangers */
- if (drapeauRecupSecurite){
- level = RecupNiveauBatterie();
- CalculDangerNiveauBatterie( level );
- rouli = RecupRouli()
- CalculerDanger(rouli);
- drapeauRecupSecurite = 0;
- }
-
- /*Si batterie faible après recup (toute les 10 sec), envoi alerte batterie faible */
- if (drapeauDangerBatterie){
- char * msgBatterie = "Batterie faible";
- EnvoiExcpetionnel(msgBatterie);
- drapeauDangerBatterie = 0;
- }
-
- /*Si angle chavirement pas bon après recup (toute les 10 sec), envoi alerte chavirement */
- if (drapeauDangerRouli){
- char * msgRouli = "Bateau chavire !";
- EnvoiExcpetionnel(msgRouli);
- drapeauDangerRouli = 0;
- }
-
- }
-}
diff --git a/Src/Securite.h b/Src/Securite.h
index 6ab7aa0..8c1be6f 100644
--- a/Src/Securite.h
+++ b/Src/Securite.h
@@ -1,15 +1,5 @@
-#ifndef ANTI_CHAVIREMENT_H
-#define ANTI_CHAVIREMENT_H
-
-#include "stm32f103xb.h"
-#include "stm32f1xx_ll_adc.h"
-#include "stm32f1xx_ll_gpio.h"
-#include "stm32f1xx_ll_bus.h"
-#include "stm32f1xx_ll_utils.h" // utile dans la fonction SystemClock_Config
-#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
-#include "stm32f1xx_ll_rcc.h" // utile dans la fonction SystemClock_Config
-
-
+#ifndef SECURITE_H
+#define SECURITE_H
/**
* @brief
@@ -17,7 +7,7 @@
* @param
* @retval
*/
-void CalculerDanger(int gamma);
+void CalculerDangerChavirement(int gamma);
/**
* @brief
@@ -25,7 +15,7 @@ void CalculerDanger(int gamma);
* @param
* @retval
*/
-int RecupRouli();
+int RecupRouli(void);
/**
@@ -42,7 +32,7 @@ int RecupNiveauBatterie(void);
* @param
* @retval
*/
-void confSecurite(void);
+void ConfSecurite(void);
/**
* @brief
@@ -50,6 +40,6 @@ void confSecurite(void);
* @param
* @retval
*/
-void CalculDangerNiveauBatterie(int niveau );
+void CalculDangerNiveauBatterie(int niveau);
#endif
diff --git a/Src/Transmission.c b/Src/Transmission.c
index 59b12b2..29c7e91 100644
--- a/Src/Transmission.c
+++ b/Src/Transmission.c
@@ -1,28 +1,14 @@
-#include "Transmission.h"
-
-int msTicks = 0;
+#include "stm32f1xx_ll_bus.h"
+#include "stm32f1xx_ll_gpio.h"
+#include "stm32f1xx_ll_utils.h"
+#include "stm32f1xx_ll_usart.h"
+#include "stm32f1xx_ll_rcc.h"
+#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
+#include "Allure.h"
+#include "Voile.h"
int drapeauTransmission = 1;
-void ConfSysTick(){
- NVIC_EnableIRQ(SysTick_IRQn);
- SysTick_Config(7200000);
-}
-
-void SysTick_Handler(void) { /* SysTick interrupt Handler. */
- msTicks++;
-
- if (msTicks % 30 == 0){
- drapeauTransmission = 1;
- }
-
- if (msTicks % 90 == 0) {
- drapeauRecupSecurite = 1;
- msTicks = 0;
- }
-
-}
-
void ConfTransmission(){
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1); //On enable la clock pour l'USARt
@@ -73,59 +59,3 @@ void EnvoiExceptionnel(char * msgAlarme){
}
}
-
-void SystemClock_Config(void)
-{
- /* Set FLASH latency */
- LL_FLASH_SetLatency(LL_FLASH_LATENCY_2);
-
- /* Enable HSE oscillator */
- // ********* Commenter la ligne ci-dessous pour MCBSTM32 *****************
- // ********* Conserver la ligne si Nucléo*********************************
- LL_RCC_HSE_EnableBypass();
- LL_RCC_HSE_Enable();
- while(LL_RCC_HSE_IsReady() != 1)
- {
- };
-
- /* Main PLL configuration and activation */
- LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9);
-
- LL_RCC_PLL_Enable();
- while(LL_RCC_PLL_IsReady() != 1)
- {
- };
-
- /* Sysclk activation on the main PLL */
- LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
- LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
- while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
- {
- };
-
- /* Set APB1 & APB2 prescaler*/
- LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2);
- LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
-
- /* Set systick to 1ms in using frequency set to 72MHz */
- LL_Init1msTick(72000000); // utile lorsqu'on utilise la fonction LL_mDelay
-
- /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
- LL_SetSystemCoreClock(72000000);
-}
-
-int main(){
- SystemClock_Config();
- ConfSysTick();
- ConfTransmission();
- char * msg1 = "ok ";
- char * msg2 = "coucou ";
-
- while(1){
- if (drapeauTransmission){
- //EnvoiRegulier(ToString(RecupAllure()),ToString(RecupTension()));
- EnvoiRegulier(msg1, msg2);
- drapeauTransmission = 0;
- }
- }
-}
diff --git a/Src/Transmission.h b/Src/Transmission.h
index 5fcfe73..50b9a8a 100644
--- a/Src/Transmission.h
+++ b/Src/Transmission.h
@@ -1,17 +1,10 @@
-#include "stm32f1xx_ll_bus.h"
-#include "stm32f1xx_ll_gpio.h"
-#include "stm32f1xx_ll_utils.h"
-#include "stm32f1xx_ll_usart.h"
-#include "stm32f1xx_ll_rcc.h"
-#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
-#include "Allure.h"
-#include "Voile.h"
-
-
+#ifndef TRANSMISSION_H
+#define TRANSMISSION_H
void EnvoiRegulier(char * Allure, char * tension);
void EnvoiExceptionnel(char * msgAlarme);
-void ConfTransmission();
+void ConfTransmission(void);
+#endif
diff --git a/Src/Voile.c b/Src/Voile.c
index c9aa425..840d78f 100644
--- a/Src/Voile.c
+++ b/Src/Voile.c
@@ -1,4 +1,3 @@
-
#include "Voile.h"
#include "stm32f1xx_ll_gpio.h"
#include "stm32f1xx_ll_rcc.h" // utile dans la fonction SystemClock_Config
@@ -23,19 +22,20 @@ int angleVoileActuel = 0; //angle de la voile. Mis
void ConfVoile(void){
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
- MyTimer_Conf(Timer,ARR,PSC);
+ LL_TIM_SetAutoReload(Timer, ARR);
+ LL_TIM_SetPrescaler(Timer, PSC);
LL_GPIO_SetPinMode(GPIOA,LL_GPIO_PIN_8,LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetPinOutputType(GPIOA,LL_GPIO_PIN_8,LL_GPIO_OUTPUT_PUSHPULL);
LL_TIM_OC_SetMode(Timer, channel, LL_TIM_OCMODE_PWM1);
Timer->CCER |= TIM_CCER_CC1E;
Timer->BDTR |= 0x1 << 15;
Timer->CCR1 = 1500; // par defaut tendu à 1ms
- MyTimer_Start(Timer);
+ LL_TIM_EnableCounter(Timer);
}
-int RecupTension(void){
+int RecupTensionVoile(void){
return angleVoileActuel;
}
@@ -54,3 +54,7 @@ void TendreVoile(int theta)
{
Timer->CCR1 = (int)(A_BETA_TO_GAMMA * (float)theta + B_BETA_TO_GAMMA) ;
}
+
+char * TensionVoileToString(int theta) {
+ return "";
+}
diff --git a/Src/Voile.h b/Src/Voile.h
index 8af4af3..1e05d15 100644
--- a/Src/Voile.h
+++ b/Src/Voile.h
@@ -1,5 +1,5 @@
-#include "MyTimer.h"
-
+#ifndef VOILE_H
+#define VOILE_H
void ConfVoile(void);
@@ -7,10 +7,12 @@ void ConfVoile(void);
char * ToString(int theta) ;
-int RecupTension(void);
-
+int RecupTensionVoile(void);
int CalculerTension(int alpha);
-
void TendreVoile(int theta);
+
+char * TensionVoileToString(int theta);
+
+#endif
diff --git a/Src/Voilier.c b/Src/Voilier.c
index c324e4b..400eddd 100644
--- a/Src/Voilier.c
+++ b/Src/Voilier.c
@@ -1,10 +1,9 @@
#include "Allure.h"
-#include "AntiChavirement.h"
-#include "Batterie.h"
#include "Gouvernail.h"
-#include "Heure.h"
-//#include "Transmission.h"
+//#include "Heure.h"
+#include "Transmission.h"
#include "Voile.h"
+#include "Securite.h"
#include "stm32f1xx_ll_rcc.h" // utile dans la fonction SystemClock_Config
#include "stm32f1xx_ll_utils.h" // utile dans la fonction SystemClock_Config
@@ -12,6 +11,32 @@
void SystemClock_Config(void);
+extern int drapeauRecupSecurite; // Flag qui est mis à 1 toute les 10 sec pour recuperer niveau batterie/rouli et envoi régulier
+extern int drapeauDangerBatterie; //Flag qui est mis à 1 toute les 10 sec si batterie faible --> envoie message alarme
+extern int drapeauDangerRouli; //Flag qui est mis à 1 toute les 10 sec si rouli pas bon --> envoie message alarme
+extern int drapeauTransmission;
+
+void ConfSysTick(){
+ NVIC_EnableIRQ(SysTick_IRQn);
+ SysTick_Config(7200000);
+}
+
+void SysTick_Handler(void) { /* SysTick interrupt Handler. */
+ static int msTicks = 0;
+
+ msTicks++;
+
+ if (msTicks % 30 == 0){
+ drapeauTransmission = 1;
+ }
+
+ if (msTicks % 90 == 0) {
+ drapeauRecupSecurite = 1;
+ msTicks = 0;
+ }
+
+}
+
/**
* @brief configure tous les periphs qu'on va utiliser en appelant les
fonctions de config de chaque "module"
@@ -20,10 +45,12 @@ void SystemClock_Config(void);
* @retval None
*/
void Setup(){
- //ConfAntiChavirement();
+ ConfSecurite();
ConfAllure();
ConfVoile();
ConfGouvernail();
+ ConfTransmission();
+ ConfSysTick();
}
@@ -76,7 +103,36 @@ int main(){
Setup();
while(1){
- Background();
+ int level ;
+ int rouli;
+ /* Envoi message toute les 3 sec sur l'Allure et la tension voile */
+ if (drapeauTransmission){
+ EnvoiRegulier(AllureToString(RecupAllure()), TensionVoileToString(RecupTensionVoile()));
+ drapeauTransmission = 0;
+ }
+
+ /* Recuperation toute les 10 sec niveau batterie et angle chavirement, puis calcul des dangers */
+ if (drapeauRecupSecurite){
+ level = RecupNiveauBatterie();
+ CalculDangerNiveauBatterie( level );
+ rouli = RecupRouli();
+ CalculerDangerChavirement(rouli);
+ drapeauRecupSecurite = 0;
+ }
+
+ /*Si batterie faible après recup (toute les 10 sec), envoi alerte batterie faible */
+ if (drapeauDangerBatterie){
+ char * msgBatterie = "Batterie faible";
+ EnvoiExceptionnel(msgBatterie);
+ drapeauDangerBatterie = 0;
+ }
+
+ /*Si angle chavirement pas bon après recup (toute les 10 sec), envoi alerte chavirement */
+ if (drapeauDangerRouli){
+ char * msgRouli = "Bateau chavire !";
+ EnvoiExceptionnel(msgRouli);
+ drapeauDangerRouli = 0;
+ }
}
}
@@ -171,3 +227,4 @@ void assert_failed(uint8_t *file, uint32_t line)
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+