diff --git a/MDK-ARM/Project.uvoptx b/MDK-ARM/Project.uvoptx
index 920a74d..656b9da 100644
--- a/MDK-ARM/Project.uvoptx
+++ b/MDK-ARM/Project.uvoptx
@@ -75,7 +75,7 @@
1
0
- 1
+ 0
18
@@ -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
@@ -284,7 +267,7 @@
1
0
- 0
+ 1
18
@@ -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
-
@@ -439,6 +374,26 @@
1
USART1
+
+ 2
+ 1
+ index
+
+
+ 3
+ 1
+ tailleAllure
+
+
+ 4
+ 1
+ tailleTension
+
+
+ 5
+ 1
+ drapeauTransmission
+
0
@@ -448,7 +403,7 @@
1
1
0
- 0
+ 1
0
0
1
@@ -460,7 +415,7 @@
0
0
0
- 0
+ 1
0
0
0
@@ -485,10 +440,16 @@
0
- ((TIM_TypeDef *)(0x40000000UL + 0x00000000UL))->CNT
- FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000B6020008
+ `msTicks
+ 0080000000000000000000000000000000003E40000000000000000000000000000000006D735469636B73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001000000000000000000F03F17000000000000000000000000000000000000008C040008
+
+
+ System Viewer\USART1
+ 35905
+
+
1
0
@@ -556,18 +517,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 +524,7 @@
2
- 6
+ 5
1
0
0
@@ -587,7 +536,7 @@
2
- 7
+ 6
1
0
0
@@ -599,9 +548,9 @@
2
- 8
+ 7
1
- 0
+ 1
0
0
..\Src\Transmission.c
@@ -611,7 +560,7 @@
2
- 9
+ 8
1
0
0
@@ -623,7 +572,7 @@
2
- 10
+ 9
5
0
0
@@ -635,7 +584,7 @@
2
- 11
+ 10
5
0
0
@@ -647,7 +596,7 @@
2
- 12
+ 11
5
0
0
@@ -659,7 +608,7 @@
2
- 13
+ 12
1
0
0
@@ -669,6 +618,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 d85880a..67f6025 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
@@ -452,6 +447,11 @@
1
..\Src\maths.c
+
+ Transmission.h
+ 5
+ ..\Src\Transmission.h
+
@@ -908,11 +908,6 @@
1
..\Src\Allure.c
-
- AntiCharvirement.c
- 1
- ..\Src\AntiCharvirement.c
-
Batterie.c
1
@@ -958,6 +953,11 @@
1
..\Src\maths.c
+
+ Transmission.h
+ 5
+ ..\Src\Transmission.h
+
diff --git a/Src/Transmission.c b/Src/Transmission.c
index e69de29..11cac01 100644
--- a/Src/Transmission.c
+++ b/Src/Transmission.c
@@ -0,0 +1,112 @@
+#include "Transmission.h"
+
+int msTicks = 0;
+
+void ConfSysTick(){
+ NVIC_EnableIRQ(SysTick_IRQn);
+ SysTick_Config(7200000);
+}
+
+void SysTick_Handler(void) { /* SysTick interrupt Handler. */
+ msTicks++;
+
+ if (msTicks == 29){
+ drapeauTransmission = 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 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();
+ drapeauTransmission = 1;
+
+
+ while(1){
+ if (drapeauTransmission == 1){
+ drapeauTransmission = 0;
+ //EnvoiMessageRegulier(ToString(RecupAllure()),ToString(RecupTension()));
+ char * msg1 = "ok ";
+ char * msg2 = "coucou ";
+ EnvoiRegulier(msg1, msg2);
+ }
+ }
+}
diff --git a/Src/Transmission.h b/Src/Transmission.h
index e69de29..fae9997 100644
--- a/Src/Transmission.h
+++ b/Src/Transmission.h
@@ -0,0 +1,19 @@
+#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;
+
+
+void EnvoiRegulier(char * Allure, char * tension);
+
+void EnvoiExceptionnel(char * msgAlarme);
+
+void ConfTransmission();
+
diff --git a/Src/Voilier.c b/Src/Voilier.c
index 92008ad..3d7bb88 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
@@ -72,7 +72,7 @@ void Background(){
}
-int main(){
+/*int main(){
SystemClock_Config();
@@ -81,7 +81,7 @@ int main(){
while(1){
Background();
}
-}
+} */
/**
@@ -99,46 +99,8 @@ int main(){
* @param None
* @retval None
*/
-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); !! 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);
-}
+/* METTRE SYSTEMCLOCKCONFIG */
/* ============== BOARD SPECIFIC CONFIGURATION CODE END ============== */