diff --git a/LLDrivers/inc/stm32f1xx_ll_adc.h b/LLDrivers/inc/stm32f1xx_ll_adc.h
index b8cd276..6443ce6 100644
--- a/LLDrivers/inc/stm32f1xx_ll_adc.h
+++ b/LLDrivers/inc/stm32f1xx_ll_adc.h
@@ -3539,8 +3539,12 @@ __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)
);
}
@@ -3581,8 +3585,12 @@ __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 920a74d..bb6f851 100644
--- a/MDK-ARM/Project.uvoptx
+++ b/MDK-ARM/Project.uvoptx
@@ -75,7 +75,7 @@
1
0
- 1
+ 0
18
@@ -284,7 +284,7 @@
1
0
- 0
+ 1
18
@@ -432,12 +432,22 @@
0
1
- Chrono_Time
+ USART1
1
1
- USART1
+ res10,0x0A
+
+
+ 2
+ 1
+ level,0x0A
+
+
+ 3
+ 1
+ danger,0x0A
@@ -448,7 +458,7 @@
1
1
0
- 0
+ 1
0
0
1
@@ -486,7 +496,7 @@
0
((TIM_TypeDef *)(0x40000000UL + 0x00000000UL))->CNT
- FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000B6020008
+ FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1900000000000000000000000000000000000000B6020008
@@ -556,18 +566,6 @@
0
0
0
- ..\Src\AntiCharvirement.c
- AntiCharvirement.c
- 0
- 0
-
-
- 2
- 5
- 1
- 0
- 0
- 0
..\Src\Batterie.c
Batterie.c
0
@@ -575,7 +573,7 @@
2
- 6
+ 5
1
0
0
@@ -587,7 +585,7 @@
2
- 7
+ 6
1
0
0
@@ -599,7 +597,7 @@
2
- 8
+ 7
1
0
0
@@ -611,7 +609,7 @@
2
- 9
+ 8
1
0
0
@@ -621,6 +619,138 @@
0
0
+
+ 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
10
diff --git a/MDK-ARM/Project.uvprojx b/MDK-ARM/Project.uvprojx
index d85880a..5827a8a 100644
--- a/MDK-ARM/Project.uvprojx
+++ b/MDK-ARM/Project.uvprojx
@@ -402,11 +402,6 @@
1
..\Src\Allure.c
-
- AntiCharvirement.c
- 1
- ..\Src\AntiCharvirement.c
-
Batterie.c
1
@@ -908,11 +903,6 @@
1
..\Src\Allure.c
-
- AntiCharvirement.c
- 1
- ..\Src\AntiCharvirement.c
-
Batterie.c
1
diff --git a/Src/AntiCharvirement.c b/Src/AntiCharvirement.c
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/AntiChavirement.c b/Src/AntiChavirement.c
new file mode 100644
index 0000000..b0ef40a
--- /dev/null
+++ b/Src/AntiChavirement.c
@@ -0,0 +1,63 @@
+#include "AntiChavirement.h"
+
+int CalculerDanger(int gamma){
+}
+
+int RecupRouli(){
+}
+
+void ConfAntiChavirement(){
+ //On est pas sûrs pour ADC 1, voir datasheet page 28
+
+ //Faire les horloges
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1);
+
+
+ //On configure les PINS
+ LL_GPIO_SetPinMode(GPIOC,LL_GPIO_PIN_0,LL_GPIO_MODE_ANALOG);
+ LL_GPIO_SetPinMode(GPIOC,LL_GPIO_PIN_2,LL_GPIO_MODE_ANALOG);
+
+
+ //ON se met en mode scan enable pour pouvoir à chaque trigger aller chercher sur plusieur voies.
+ LL_ADC_SetSequencersScanMode(ADC1,LL_ADC_SEQ_SCAN_ENABLE);
+
+ //Permet de faire en sorte d'aller chercher 2 voies (2 rangs) à chaque trigger
+ LL_ADC_INJ_SetSequencerLength(ADC1,LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS);
+
+ //Permet de ne pas avoir d'intérruption dans le scan
+ LL_ADC_INJ_SetSequencerDiscont(ADC1,LL_ADC_INJ_SEQ_DISCONT_DISABLE);
+
+ //A chaque trigger, on va donc avoir voies de rang 1 puis de rang 2 de scannées
+
+ //On met le rang 1 pour la voie 10 (accéléro)
+ LL_ADC_INJ_SetSequencerRanks(ADC1,LL_ADC_INJ_RANK_1,LL_ADC_CHANNEL_10);
+
+ //On met rang 2 pour la voie 12 (surveillance batterie)
+ LL_ADC_INJ_SetSequencerRanks(ADC1,LL_ADC_INJ_RANK_2,LL_ADC_CHANNEL_12);
+
+ //Permet d'avoirdes registres indépendants pour chaque voie (chaque rangs en fait, au max 4 + 1 pour les regular)
+ LL_ADC_INJ_SetTrigAuto(ADC1,LL_ADC_INJ_TRIG_INDEPENDENT);
+
+
+ //Sampling time voie 10 et 12, à changer peut-être
+ LL_ADC_SetChannelSamplingTime(ADC1,LL_ADC_CHANNEL_10,LL_ADC_SAMPLINGTIME_28CYCLES_5);
+
+ LL_ADC_SetChannelSamplingTime(ADC1,LL_ADC_CHANNEL_12,LL_ADC_SAMPLINGTIME_28CYCLES_5);
+
+
+
+ LL_ADC_INJ_SetTriggerSource(ADC1,LL_ADC_INJ_TRIG_SOFTWARE); //permet d'enable le trigger de l'adc par le software
+
+
+
+ LL_ADC_StartCalibration(ADC1);
+
+
+ //Tant que calibration par terminée on enable pas
+ while(LL_ADC_IsCalibrationOnGoing(ADC1)){
+ }
+
+ //Activation de l'ADC (???)
+ LL_ADC_Enable(ADC1);
+}
diff --git a/Src/AntiChavirement.h b/Src/AntiChavirement.h
index e69de29..f2d3d65 100644
--- a/Src/AntiChavirement.h
+++ b/Src/AntiChavirement.h
@@ -0,0 +1,38 @@
+#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
+
+
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+int CalculerDanger(int gamma);
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+int RecupRouli();
+
+/**
+ * @brief
+ * @note Fonction à lancer avant toute autre.
+ * @param None
+ * @retval None
+ */
+void ConfAntiChavirement();
+
+#endif
diff --git a/Src/Securite.c b/Src/Securite.c
new file mode 100644
index 0000000..6ec87c4
--- /dev/null
+++ b/Src/Securite.c
@@ -0,0 +1,225 @@
+#include "Securite.h"
+
+
+// Seuil represente la valeur (en %) en dessous de laquelle le niveau de batterie est consideree faible
+#define Seuil (20)
+
+// Seuil represente la valeur de l'angle au dessus de laquelle le chavirement est trop prononcé
+#define SeuilAngle (40)
+
+
+int drapeauRecupSecurite = 0; // Flag qui est mis à 1 toute les 10 sec pour recuperer niveau batterie/rouli et envoi régulier
+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
+
+ //Faire les horloges
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1);
+
+
+ //On configure les PINS
+ LL_GPIO_SetPinMode(GPIOC,LL_GPIO_PIN_0,LL_GPIO_MODE_ANALOG);
+ LL_GPIO_SetPinMode(GPIOC,LL_GPIO_PIN_2,LL_GPIO_MODE_ANALOG);
+
+
+ //ON se met en mode scan enable pour pouvoir à chaque trigger aller chercher sur plusieur voies.
+ LL_ADC_SetSequencersScanMode(ADC1,LL_ADC_SEQ_SCAN_ENABLE);
+
+ //Permet de faire en sorte d'aller chercher 2 voies (2 rangs) à chaque trigger
+ LL_ADC_INJ_SetSequencerLength(ADC1,LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS);
+
+ //Permet de ne pas avoir d'intérruption dans le scan
+ LL_ADC_INJ_SetSequencerDiscont(ADC1,LL_ADC_INJ_SEQ_DISCONT_DISABLE);
+
+ //A chaque trigger, on va donc avoir voies de rang 1 puis de rang 2 de scannées
+
+ //On met le rang 1 pour la voie 10 (accéléro)
+ LL_ADC_INJ_SetSequencerRanks(ADC1,LL_ADC_INJ_RANK_1,LL_ADC_CHANNEL_10);
+
+ //On met rang 2 pour la voie 12 (surveillance batterie)
+ LL_ADC_INJ_SetSequencerRanks(ADC1,LL_ADC_INJ_RANK_2,LL_ADC_CHANNEL_12);
+
+ //Permet d'avoirdes registres indépendants pour chaque voie (chaque rangs en fait, au max 4 + 1 pour les regular)
+ LL_ADC_INJ_SetTrigAuto(ADC1,LL_ADC_INJ_TRIG_INDEPENDENT);
+
+
+ //Sampling time voie 10 et 12, à changer peut-être
+ LL_ADC_SetChannelSamplingTime(ADC1,LL_ADC_CHANNEL_10,LL_ADC_SAMPLINGTIME_28CYCLES_5);
+
+ LL_ADC_SetChannelSamplingTime(ADC1,LL_ADC_CHANNEL_12,LL_ADC_SAMPLINGTIME_28CYCLES_5);
+
+
+
+ LL_ADC_INJ_SetTriggerSource(ADC1,LL_ADC_INJ_TRIG_SOFTWARE); //permet d'enable le trigger de l'adc par le software
+
+
+
+ LL_ADC_StartCalibration(ADC1);
+
+
+ //Tant que calibration par terminée on enable pas
+ while(LL_ADC_IsCalibrationOnGoing(ADC1)){
+ }
+
+ //Activation de l'ADC (???)
+ LL_ADC_Enable(ADC1);
+}
+
+/**
+ * @brief Recuperer le niveau de batterie
+ * @note ADC1 -> Channel 12 (Rang 2)
+ * @param None
+ * @retval niveau de batterie en pourcentage
+ */
+int RecupNiveauBatterie(void){
+ // Lancement de la conversion
+ LL_ADC_INJ_StartConversionSWStart(ADC1);
+ // Attente de la fin de conversion
+ while(!LL_ADC_IsActiveFlag_JEOS(ADC1)){}
+ // R?cuperation de la valeur apres conversion
+ int NiveauBatterie = LL_ADC_INJ_ReadConversionData12(ADC1,LL_ADC_INJ_RANK_2);
+ // Valeur code sur 12 bits : 0 a 4095 ; on veut Niveau de batterie en pourcentage
+ return NiveauBatterie * 100 / 4095 ;
+}
+
+
+/**
+ * @brief Met le flag de dangerBatterie à 1 si batterie faible.
+ * @note
+ * @param un entier representant le niveau de batterie en pourcentage
+ * @retval
+ */
+void CalculDangerNiveauBatterie(int niveau){
+ if ( niveau <= Seuil)
+ {
+ drapeauDangerBatterie = 1;
+ }
+ else
+ {
+ drapeauDangerBatterie = 0 ;
+ }
+}
+
+
+ /*
+ * @brief Mets le flag drapeauDangerRouli a 1 si l angle de rouli est mauvais
+ * @note Si le voilier prend un angle de roulis supe´rieur a` 40° -> MSG de danger + voiles sont imme´diatement rela^che´es
+ * @param un entier representant l angle de rouli
+ * @retval NONE
+ */
+void CalculerDangerChavirement(int gamma){
+ if ( gamma >= SeuilAngle)
+ {
+ drapeauDangerRouli = 1;
+ TendreVoile(90); //On lache les voiles si danger de chavirement
+ }
+ else
+ {
+ drapeauDangerRouli = 0 ;
+ }
+}
+
+/*
+ * @brief Recuperer l angle de rouli
+ * @note ADC1 -> Channel 10 (Rang 1)
+ * @param None
+ * @retval angle de rouli
+ */
+int RecupRouli(){
+ // Lancement de la conversion
+ LL_ADC_INJ_StartConversionSWStart(ADC1);
+ // Attente de la fin de conversion
+ while(!LL_ADC_IsActiveFlag_JEOS(ADC1)){}
+ // R?cuperation de la valeur apres conversion
+ int NiveauChavirement = LL_ADC_INJ_ReadConversionData12(ADC1,LL_ADC_INJ_RANK_1);
+ 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
new file mode 100644
index 0000000..6ab7aa0
--- /dev/null
+++ b/Src/Securite.h
@@ -0,0 +1,55 @@
+#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
+
+
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+void CalculerDanger(int gamma);
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+int RecupRouli();
+
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+int RecupNiveauBatterie(void);
+
+/**
+ * @brief
+ * @note A lancer en 1er avant tout
+ * @param
+ * @retval
+ */
+void confSecurite(void);
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+void CalculDangerNiveauBatterie(int niveau );
+
+#endif
diff --git a/Src/Voilier.c b/Src/Voilier.c
index 92008ad..d29e605 100644
--- a/Src/Voilier.c
+++ b/Src/Voilier.c
@@ -15,9 +15,9 @@
void SystemClock_Config(void);
/**
- * @brief configure tous les periphs qu'on va utiliser en appelant les
+ * @brief configure tous les periphs qu'on va utiliser en appelant les
fonctions de config de chaque "module"
- * @note
+ * @note
* @param None
* @retval None
*/
@@ -26,58 +26,58 @@ void Setup(){
ConfAllure();
ConfVoile();
//ConfGouvernail();
-
-
+
+
}
-//on utilise EnvoiRegulier de Transmission
-//TODO : récuperer les valeurs des params de EnvoiRegulier
-//Interruption toute les 3s via un Timer qui déclenche cette fonction qui permet d'envoyer ce qu'il faut
+//on utilise EnvoiRegulier de Transmission
+//TODO : r�cuperer les valeurs des params de EnvoiRegulier
+//Interruption toute les 3s via un Timer qui d�clenche cette fonction qui permet d'envoyer ce qu'il faut
/**
- * @brief
- * @note
- * @param
- * @retval
+ * @brief
+ * @note
+ * @param
+ * @retval
*/
void Envoi3s(){
-
+
}
/**
* @brief tache qui va fonctionner en fond qui gere l'orientation
des voiles, le gouvernail et aussi le systeme anti-chavirement
- * @note relacher les voiles <=> tendre les voiles avec un angle à 90°
+ * @note relacher les voiles <=> tendre les voiles avec un angle � 90�
* @param None
* @retval None
*/
void Background(){
//Voiles
int allure = RecupAllure(); //on recupere l'allulre via la girouette
- int tensionVoile = CalculerTension(allure); //grace à l'allure on peut calculer la tension à appliquer sur la voile
- TendreVoile(CalculerTension(RecupAllure())); //on tend la voile grâce à la tension obtenue
-
- //Gouvernail
- /*int valeurTelecommande = LireTelecommande(); //on lit la valeur renvoyée par la télécommande
- int vitesse = CalculerVitesse(valeurTelecommande);//gràace à la valeur de la telecommande on calcule la vitesse souhaitée
- CommanderMoteur(vitesse);//On commande le moteur pour aller à la vitesse voulue
-
+ int tensionVoile = CalculerTension(allure); //grace � l'allure on peut calculer la tension � appliquer sur la voile
+ TendreVoile(CalculerTension(RecupAllure())); //on tend la voile gr�ce � la tension obtenue
+
+ //Gouvernail
+ /*int valeurTelecommande = LireTelecommande(); //on lit la valeur renvoy�e par la t�l�commande
+ int vitesse = CalculerVitesse(valeurTelecommande);//gr�ace � la valeur de la telecommande on calcule la vitesse souhait�e
+ CommanderMoteur(vitesse);//On commande le moteur pour aller � la vitesse voulue
+
//Anti-Chavirement
int rouli = RecupRouli();
- int danger = CalculerDanger(rouli);//renvoi boolean : int à 0 si faux et 1 si vrai
+ int danger = CalculerDanger(rouli);//renvoi boolean : int � 0 si faux et 1 si vrai
if(danger){
- TendreVoile(90); //si il y a danger on relache les voiles (relacher les voiles = les mettre à 90)
+ TendreVoile(90); //si il y a danger on relache les voiles (relacher les voiles = les mettre � 90)
}*/
-
+
}
int main(){
-
+
SystemClock_Config();
-
+
Setup();
-
+
while(1){
Background();
}
@@ -106,7 +106,7 @@ void SystemClock_Config(void)
/* Enable HSE oscillator */
// ********* Commenter la ligne ci-dessous pour MCBSTM32 *****************
- // ********* Conserver la ligne si Nucléo*********************************
+ // ********* Conserver la ligne si Nucl�o*********************************
LL_RCC_HSE_EnableBypass();
LL_RCC_HSE_Enable();
while(LL_RCC_HSE_IsReady() != 1)
@@ -133,7 +133,7 @@ void SystemClock_Config(void)
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
/* Set systick to 1ms in using frequency set to 72MHz */
- //LL_Init1msTick(72000000); !! décommenter que si l'IT est récupérée
+ //LL_Init1msTick(72000000); !! d�commenter que si l'IT est r�cup�r�e
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
LL_SetSystemCoreClock(72000000);
@@ -173,4 +173,3 @@ void assert_failed(uint8_t *file, uint32_t line)
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-