diff --git a/MDK-ARM/Project.uvoptx b/MDK-ARM/Project.uvoptx
index bb6f851..e556a2f 100644
--- a/MDK-ARM/Project.uvoptx
+++ b/MDK-ARM/Project.uvoptx
@@ -130,7 +130,7 @@
0
DLGTARM
- (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=621,97,1215,791,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)
+ (1010=668,211,1044,768,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=193,123,614,528,1)(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,74,1215,768,0)(131=-1,-1,-1,-1,0)(132=772,58,1366,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
@@ -153,24 +153,7 @@
-U-O142 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)
-
-
- 0
- 0
- 56
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- startup_stm32f103xb.s
-
-
-
-
+
0
@@ -186,8 +169,8 @@
1
1
0
- 0
- 0
+ 1
+ 1
0
1
0
@@ -329,7 +312,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=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)
+ (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=149,287,570,714,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,17,1303,768,0)(133=-1,-1,-1,-1,0)(160=249,199,697,613,0)(161=454,216,902,630,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
@@ -368,7 +351,7 @@
0
99
1
- 134218684
+ 134218824
0
0
0
@@ -379,54 +362,6 @@
\\NUCLEO_F103RB\../MyDrivers/MyTimer.c\99
-
- 1
- 0
- 12
- 1
- 134218790
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Src\Voilier.c
-
- \\NUCLEO_F103RB\../Src/Voilier.c\12
-
-
- 2
- 0
- 49
- 1
- 134218416
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Src\Allure.c
-
- \\NUCLEO_F103RB\../Src/Allure.c\49
-
-
- 3
- 0
- 17
- 1
- 134218794
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Src\Voilier.c
-
- \\NUCLEO_F103RB\../Src/Voilier.c\17
-
@@ -449,6 +384,26 @@
1
danger,0x0A
+
+ 2
+ 1
+ index
+
+
+ 3
+ 1
+ tailleAllure
+
+
+ 4
+ 1
+ tailleTension
+
+
+ 5
+ 1
+ drapeauTransmission
+
0
@@ -470,7 +425,7 @@
0
0
0
- 0
+ 1
0
0
0
@@ -499,6 +454,12 @@
FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1900000000000000000000000000000000000000B6020008
+
+
+ System Viewer\USART1
+ 35905
+
+
1
0
@@ -585,7 +546,7 @@
2
- 6
+ 5
1
0
0
@@ -597,7 +558,7 @@
2
- 7
+ 6
1
0
0
@@ -609,7 +570,7 @@
2
- 8
+ 7
1
0
0
@@ -753,7 +714,7 @@
2
- 10
+ 9
5
0
0
@@ -765,7 +726,7 @@
2
- 11
+ 10
5
0
0
@@ -777,7 +738,7 @@
2
- 12
+ 11
5
0
0
@@ -789,7 +750,7 @@
2
- 13
+ 12
1
0
0
@@ -799,6 +760,18 @@
0
0
+
+ 2
+ 13
+ 5
+ 0
+ 0
+ 0
+ ..\Src\Transmission.h
+ Transmission.h
+ 0
+ 0
+
diff --git a/MDK-ARM/Project.uvprojx b/MDK-ARM/Project.uvprojx
index 5827a8a..67f6025 100644
--- a/MDK-ARM/Project.uvprojx
+++ b/MDK-ARM/Project.uvprojx
@@ -447,6 +447,11 @@
1
..\Src\maths.c
+
+ Transmission.h
+ 5
+ ..\Src\Transmission.h
+
@@ -948,6 +953,11 @@
1
..\Src\maths.c
+
+ Transmission.h
+ 5
+ ..\Src\Transmission.h
+
diff --git a/Src/AntiChavirement.c b/Src/AntiChavirement.c
deleted file mode 100644
index b0ef40a..0000000
--- a/Src/AntiChavirement.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#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
deleted file mode 100644
index f2d3d65..0000000
--- a/Src/AntiChavirement.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#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/Batterie.c b/Src/Batterie.c
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Batterie.h b/Src/Batterie.h
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Transmission.c b/Src/Transmission.c
index e69de29..59b12b2 100644
--- a/Src/Transmission.c
+++ b/Src/Transmission.c
@@ -0,0 +1,131 @@
+#include "Transmission.h"
+
+int msTicks = 0;
+
+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
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); //enable la clock du gpio où est l'USART
+ LL_GPIO_SetPinMode(GPIOA,LL_GPIO_PIN_9,LL_GPIO_MODE_ALTERNATE); // Mode fonction alternative PIN USART Tx
+ LL_USART_Enable(USART1); //Enable Usart
+ LL_USART_EnableDirectionTx(USART1); //Enable direction Tx
+ LL_USART_SetParity(USART1,LL_USART_PARITY_NONE); // disable parity bit
+ LL_USART_SetStopBitsLength(USART1,LL_USART_STOPBITS_1);
+ LL_USART_SetBaudRate(USART1, 72000000,9600); //Set Baud Rate à 9600 (règle de trois avec 1 pour 36 000 0000
+
+ LL_GPIO_SetPinMode(GPIOA,LL_GPIO_PIN_11,LL_GPIO_MODE_OUTPUT);
+ LL_GPIO_SetPinOutputType(GPIOA,LL_GPIO_PIN_11,LL_GPIO_OUTPUT_PUSHPULL);
+}
+
+void EnvoiRegulier(char * Allure, char * tension){
+
+ LL_GPIO_SetOutputPin(GPIOA,LL_GPIO_PIN_11);
+ int tailleAllure = sizeof(Allure);
+ int tailleTension = 8; //ATTENTION TAILLE
+ int index = 0;
+ while(index < tailleAllure){
+ if (LL_USART_IsActiveFlag_TXE(USART1)){ //On regarde si le flag de transmission terminée est actif
+ LL_USART_TransmitData8(USART1, (uint8_t) Allure[index]); //On envoie le message (8 bits)
+ index++;
+ }
+ }
+ index = 0;
+ while(index < tailleTension){
+ if (LL_USART_IsActiveFlag_TXE(USART1)){ //On regarde si le flag de transmission terminée est actif
+ LL_USART_TransmitData8(USART1, (uint8_t) tension[index]); //On envoie le message (8 bits)
+ index++;
+ }
+ }
+ LL_GPIO_ResetOutputPin(GPIOA,LL_GPIO_PIN_11);
+}
+
+void EnvoiExceptionnel(char * msgAlarme){
+
+ LL_GPIO_SetOutputPin(GPIOA,LL_GPIO_PIN_11);
+ int tailleMessage = sizeof(msgAlarme);
+ int index = 0;
+ while(index < tailleMessage){
+ if (LL_USART_IsActiveFlag_TXE(USART1)){ //On regarde si le flag de transmission terminée est actif
+ LL_USART_TransmitData8(USART1, (uint8_t) msgAlarme[index]); //On envoie le message (8 bits)
+ index++;
+ }
+ }
+
+}
+
+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 e69de29..5fcfe73 100644
--- a/Src/Transmission.h
+++ b/Src/Transmission.h
@@ -0,0 +1,17 @@
+#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"
+
+
+
+void EnvoiRegulier(char * Allure, char * tension);
+
+void EnvoiExceptionnel(char * msgAlarme);
+
+void ConfTransmission();
+
diff --git a/Src/Voilier.c b/Src/Voilier.c
index d29e605..00ec686 100644
--- a/Src/Voilier.c
+++ b/Src/Voilier.c
@@ -3,7 +3,7 @@
#include "Batterie.h"
#include "Gouvernail.h"
#include "Heure.h"
-#include "Transmission.h"
+//#include "Transmission.h"
#include "Voile.h"
#include "stm32f1xx_ll_rcc.h" // utile dans la fonction SystemClock_Config
@@ -81,7 +81,7 @@ int main(){
while(1){
Background();
}
-}
+}
/**
@@ -139,6 +139,7 @@ void SystemClock_Config(void)
LL_SetSystemCoreClock(72000000);
}
+/* METTRE SYSTEMCLOCKCONFIG */
/* ============== BOARD SPECIFIC CONFIGURATION CODE END ============== */