Version Fonctionnelle : Tests en cours

This commit is contained in:
Paul Faure 2020-11-15 17:23:25 +01:00
parent fd12f4c92b
commit 41888e5d42
9 changed files with 227 additions and 254 deletions

View file

@ -26,7 +26,7 @@
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
<CLKADS>8000000</CLKADS>
<CLKADS>72000000</CLKADS>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
@ -103,7 +103,7 @@
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>0</nTsel>
<nTsel>6</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
@ -114,7 +114,7 @@
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon>BIN\UL2CM3.DLL</pMon>
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
@ -130,7 +130,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(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)</Name>
<Name>(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=900,145,1348,559,0)(161=476,349,924,763,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=764,77,1367,711,0)(151=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@ -145,7 +145,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>-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)</Name>
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@ -153,7 +153,52 @@
<Name>-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)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>96</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134223920</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\96</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>56</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134223654</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\56</Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>transmission</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>NiveauBatterie</ItemText>
</Ww>
</WatchWindow1>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
@ -162,8 +207,8 @@
<periodic>1</periodic>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aSer1>1</aSer1>
<aSer2>1</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
@ -174,7 +219,7 @@
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>1</aLa>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
@ -342,18 +387,50 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>48</LineNumber>
<LineNumber>31</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134219720</Address>
<Address>134222722</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Allure.c</Filename>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Allure.c\48</Expression>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\31</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>32</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222726</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\32</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>77</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222758</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\77</Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
@ -367,20 +444,7 @@
<WinNumber>1</WinNumber>
<ItemText>USART1</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>allure</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>0</SubType>
<ItemText>0x20000400</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
@ -389,8 +453,8 @@
<periodic>1</periodic>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aSer1>1</aSer1>
<aSer2>1</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
@ -426,8 +490,8 @@
<LogicAnalyzers>
<Wi>
<IntNumber>0</IntNumber>
<FirstString>((PORTA &amp; 0x00000100) &gt;&gt; 8 &amp; 0x100) &gt;&gt; 8</FirstString>
<SecondString>FF0000000000000000000000000000000000F03F0100000000000000000000000000000028504F5254412026203078303030303031303029203E3E2038000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000AC030008</SecondString>
<FirstString>((TIM_TypeDef *)(0x40000000UL + 0x00000000UL))-&gt;CNT</FirstString>
<SecondString>FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000B6020008</SecondString>
</Wi>
</LogicAnalyzers>
<DebugDescription>
@ -450,7 +514,7 @@
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Src\Voilier.c</PathWithFileName>
@ -529,6 +593,30 @@
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>7</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Src\Allure.h</PathWithFileName>
<FilenameWithoutPath>Allure.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>8</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Src\maths.h</PathWithFileName>
<FilenameWithoutPath>maths.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -540,24 +628,24 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>8</FileNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Src\Securite.c</PathWithFileName>
<PathWithFileName>..\..\Projet_Voilier_4IR\Src\Securite.c</PathWithFileName>
<FilenameWithoutPath>Securite.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>9</FileNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Src\string.c</PathWithFileName>
<PathWithFileName>..\..\Projet_Voilier_4IR\Src\string.c</PathWithFileName>
<FilenameWithoutPath>string.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
@ -572,7 +660,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>10</FileNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -584,7 +672,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>11</FileNumber>
<FileNumber>13</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -596,7 +684,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>12</FileNumber>
<FileNumber>14</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -608,7 +696,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>13</FileNumber>
<FileNumber>15</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -620,7 +708,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>14</FileNumber>
<FileNumber>16</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -630,6 +718,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>17</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\LLDrivers\src\stm32f1xx_ll_usart.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_ll_usart.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@ -648,7 +748,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>15</FileNumber>
<FileNumber>18</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -668,7 +768,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>16</FileNumber>
<FileNumber>19</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

View file

@ -11,7 +11,7 @@
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<uAC6>8</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32F103RB</Device>
@ -417,6 +417,16 @@
<FileType>1</FileType>
<FilePath>..\Src\Voile.c</FilePath>
</File>
<File>
<FileName>Allure.h</FileName>
<FileType>5</FileType>
<FilePath>..\Src\Allure.h</FilePath>
</File>
<File>
<FileName>maths.h</FileName>
<FileType>5</FileType>
<FilePath>..\Src\maths.h</FilePath>
</File>
<File>
<FileName>maths.c</FileName>
<FileType>1</FileType>
@ -425,12 +435,12 @@
<File>
<FileName>Securite.c</FileName>
<FileType>1</FileType>
<FilePath>..\Src\Securite.c</FilePath>
<FilePath>..\..\Projet_Voilier_4IR\Src\Securite.c</FilePath>
</File>
<File>
<FileName>string.c</FileName>
<FileType>1</FileType>
<FilePath>..\Src\string.c</FilePath>
<FilePath>..\..\Projet_Voilier_4IR\Src\string.c</FilePath>
</File>
</Files>
</Group>
@ -462,6 +472,11 @@
<FileType>1</FileType>
<FilePath>..\LLDrivers\src\stm32f1xx_ll_exti.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_ll_usart.c</FileName>
<FileType>1</FileType>
<FilePath>..\LLDrivers\src\stm32f1xx_ll_usart.c</FilePath>
</File>
</Files>
</Group>
<Group>
@ -903,6 +918,16 @@
<FileType>1</FileType>
<FilePath>..\Src\Voile.c</FilePath>
</File>
<File>
<FileName>Allure.h</FileName>
<FileType>5</FileType>
<FilePath>..\Src\Allure.h</FilePath>
</File>
<File>
<FileName>maths.h</FileName>
<FileType>5</FileType>
<FilePath>..\Src\maths.h</FilePath>
</File>
<File>
<FileName>maths.c</FileName>
<FileType>1</FileType>
@ -911,12 +936,12 @@
<File>
<FileName>Securite.c</FileName>
<FileType>1</FileType>
<FilePath>..\Src\Securite.c</FilePath>
<FilePath>..\..\Projet_Voilier_4IR\Src\Securite.c</FilePath>
</File>
<File>
<FileName>string.c</FileName>
<FileType>1</FileType>
<FilePath>..\Src\string.c</FilePath>
<FilePath>..\..\Projet_Voilier_4IR\Src\string.c</FilePath>
</File>
</Files>
</Group>
@ -948,6 +973,11 @@
<FileType>1</FileType>
<FilePath>..\LLDrivers\src\stm32f1xx_ll_exti.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_ll_usart.c</FileName>
<FileType>1</FileType>
<FilePath>..\LLDrivers\src\stm32f1xx_ll_usart.c</FilePath>
</File>
</Files>
</Group>
<Group>

View file

@ -1,109 +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 "stm32f103xb.h"
void (* pTIM1_Overflow) (void); //Pointeurs de fonctions que l'on appelle dans le handler et définis dans IT_Conf
void (* pTIM2_Overflow) (void);
void (* pTIM3_Overflow) (void);
void (* pTIM4_Overflow) (void);
void MyTimer_Conf(TIM_TypeDef * Timer,int Arr, int Psc){
//Activation horloge selon timer utilisé
if (Timer == TIM1){
RCC->APB2ENR = RCC->APB2ENR | RCC_APB2ENR_TIM1EN;
}
if (Timer == TIM2){
RCC->APB1ENR = RCC->APB1ENR | RCC_APB1ENR_TIM2EN;
}
else if (Timer == TIM3){
RCC->APB1ENR = RCC->APB1ENR | RCC_APB1ENR_TIM3EN;
}
else{
RCC->APB1ENR = RCC->APB1ENR | RCC_APB1ENR_TIM4EN;
}
Timer->ARR = Arr;
Timer->PSC = Psc;
}
void MyTimer_Start(TIM_TypeDef * Timer){
//Mise à 1 du bit CEN de CR1 = activation timer
Timer->CR1 |= 0x1;
}
void MyTimer_Stop(TIM_TypeDef * Timer){
//Mise à 0 du bit CEN de CR1 = stop timer
Timer->CR1 &= ~0x1;
}
void MyTimer_IT_Conf(TIM_TypeDef * Timer, void (*IT_function) (void),int Prio){
Timer->DIER |= 0x1; //Enable Update IT (débordement du timer)
if (Timer == TIM1){
NVIC->IP[TIM1_UP_IRQn] = Prio<<4;
NVIC->ISER[0] |= 0x1<<TIM1_UP_IRQn;
pTIM1_Overflow = IT_function;
}
if (Timer == TIM2){
NVIC->IP[TIM2_IRQn] = Prio<<4;
NVIC->ISER[0] |= 0x1<<TIM2_IRQn;
pTIM2_Overflow = IT_function;
}
if (Timer == TIM3){
NVIC->IP[TIM3_IRQn] = Prio<<4;
NVIC->ISER[0] |= 0x1<<TIM3_IRQn;
pTIM3_Overflow = IT_function;
}
if (Timer == TIM4){
NVIC->IP[TIM4_IRQn] = Prio<<4;
NVIC->ISER[0] |= 0x1<<TIM4_IRQn;
pTIM4_Overflow = IT_function;
}
}
void MyTimer_IT_Disable(TIM_TypeDef * Timer){
Timer->DIER |= 0x0; //Disable Update IT (débordement du timer)
if (Timer == TIM1){
NVIC->ISER[0] |= 0x0<<TIM1_UP_IRQn;
}
if (Timer == TIM2){
NVIC->ISER[0] |= 0x0<<TIM2_IRQn;
}
if (Timer == TIM3){
NVIC->ISER[0] |= 0x0<<TIM3_IRQn;
}
if (Timer == TIM4){
NVIC->ISER[0] |= 0x0<<TIM4_IRQn;
}
}
void TIM1_UP_IRQHandler(void){ //Fonctions qui sont les handler appelée par le NVIC lors des interruptions
(*pTIM1_Overflow)(); //Contien le faux "handler" qui lui contient des instructions
TIM1->SR = 0x0;
}
void TIM2_IRQHandler(void){
(*pTIM2_Overflow)();
TIM2->SR = 0x0;
}
void TIM3_IRQHandler(void){
(*pTIM3_Overflow)();
TIM3->SR = 0x0;
}
void TIM4_IRQHandler(void){
(*pTIM4_Overflow)();
TIM4->SR = 0x0;
}

View file

@ -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); //On fait tt dans IT_Conf
/**
* @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

View file

@ -64,12 +64,12 @@ void ConfSecurite(){
LL_ADC_StartCalibration(ADC1);
/*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);
@ -89,7 +89,7 @@ int RecupNiveauBatterie(void){
// 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 ;
return (int)((float)(NiveauBatterie) * 100.0 / 4095.0) ;
}
@ -106,7 +106,7 @@ int CalculerDangerNiveauBatterie(int niveau){
}
else
{
return 1;
return 0;
}
}
@ -124,7 +124,7 @@ int CalculerDangerChavirement(int gamma){
}
else
{
return 1;
return 0;
}
}

View file

@ -9,6 +9,7 @@
#include "string.h"
#define TAILLE_MESSAGE_MAX 100
#define USARTX USART2
// Structure pour gérer la transmission du message
struct t_transmission {
@ -41,14 +42,26 @@ static struct t_transmission transmission;
void ConfTransmission(){
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1); //On enable la clock pour l'USARt
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2); //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_2,LL_GPIO_MODE_ALTERNATE); // Mode fonction alternative PIN USART Tx
LL_USART_InitTypeDef USART_InitStruct;
LL_USART_StructInit(&USART_InitStruct);
USART_InitStruct.BaudRate = 9600; //Set Baud rate -> 19200Bd
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; //Set data width -> 8bits
USART_InitStruct.Parity = LL_USART_PARITY_NONE;// Disable Parity
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;// Set stop bit -> 1
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX;//Set sens -> TX Only
LL_USART_Init(USARTX, &USART_InitStruct);// Applique les modifs
LL_USART_Enable(USARTX);// Rend l'USART enable A FAIRE EN DERNIER
/*LL_USART_EnableDirectionTx(USARTX); //Enable direction Tx
LL_USART_SetParity(USARTX,LL_USART_PARITY_NONE); // disable parity bit
LL_USART_SetStopBitsLength(USARTX,LL_USART_STOPBITS_1);
LL_USART_SetBaudRate(USARTX, 72000000,9600); //Set Baud Rate à 9600 (règle de trois avec 1 pour 36 000 0000
LL_USART_Enable(USARTX); //Enable Usart*/
LL_GPIO_SetPinMode(GPIOA,LL_GPIO_PIN_11,LL_GPIO_MODE_OUTPUT);
LL_GPIO_SetPinOutputType(GPIOA,LL_GPIO_PIN_11,LL_GPIO_OUTPUT_PUSHPULL);
@ -68,20 +81,20 @@ void EnvoiRegulier(char * Allure, char * tension){
_____________________________*/
static char promptligne1[] = "Allure actuelle : ";
static int promptligne1size = sizeof(promptligne1);
static int promptligne1size = 19;
static char promptligne2[] = "Tension des voiles : ";
static int promptligne2size = sizeof(promptligne2);
static int promptligne2size = 22;
static char rc[] = "\n";
static int rcsize = sizeof(rc);
static int rcsize = 2;
transmission.message[0] = '\0';
int current_size = 1;
current_size = Concatenate(promptligne1, transmission.message, promptligne1size, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(Allure, transmission.message, sizeof(Allure), current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(Allure, transmission.message, size_of(Allure), current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(rc, transmission.message, rcsize, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(promptligne2, transmission.message, promptligne2size, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(tension, transmission.message, sizeof(tension), current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(tension, transmission.message, size_of(tension), current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(rc, transmission.message, rcsize, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(rc, transmission.message, rcsize, current_size, TAILLE_MESSAGE_MAX);
@ -122,9 +135,9 @@ void EnvoiExceptionnel(char * msgAlarme){
_____________________________*/
static char prompt[] = "WARNING : ";
static int promptsize = sizeof(prompt);
static int promptsize = 11;
static char rc[] = "\n";
static int rcsize = sizeof(rc);
static int rcsize = 2;
transmission.message[0] = '\0';
int current_size = 1;
@ -132,7 +145,7 @@ void EnvoiExceptionnel(char * msgAlarme){
current_size = Concatenate(rc, transmission.message, rcsize, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(rc, transmission.message, rcsize, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(prompt, transmission.message, promptsize, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(msgAlarme, transmission.message, sizeof(msgAlarme), current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(msgAlarme, transmission.message, size_of(msgAlarme), current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(rc, transmission.message, rcsize, current_size, TAILLE_MESSAGE_MAX);
current_size = Concatenate(rc, transmission.message, rcsize, current_size, TAILLE_MESSAGE_MAX);
@ -157,14 +170,16 @@ void EnvoiExceptionnel(char * msgAlarme){
void EnvoyerCaractere(void) {
if (transmission.envoyer) {
if (LL_USART_IsActiveFlag_TXE(USART1)) {//On regarde si le flag de transmission terminée est actif
LL_GPIO_SetOutputPin(GPIOA,LL_GPIO_PIN_11);
if (LL_USART_IsActiveFlag_TXE(USARTX)) {//On regarde si le flag de transmission terminée est actif
if (transmission.position < transmission.taille_message) {
LL_USART_TransmitData8(USART1, (uint8_t)(transmission.message[transmission.position]));
LL_USART_TransmitData8(USARTX, (uint8_t)(transmission.message[transmission.position]));
transmission.position += 1;
} else {
transmission.envoyer = 0;
transmission.exceptionnel = 0;
}
}
LL_GPIO_ResetOutputPin(GPIOA,LL_GPIO_PIN_11);
}
}

View file

@ -13,9 +13,6 @@ void SystemClock_Config(void);
void ConfSysTick(void){
SysTick_Config(7200000);
}
void SysTickEnableIT(void) {
NVIC_EnableIRQ(SysTick_IRQn);
}
@ -33,7 +30,6 @@ void Setup(){
ConfVoile();
ConfGouvernail();
ConfTransmission();
ConfSysTick();
}
@ -97,7 +93,7 @@ int main(){
EnvoyerCaractere();
}
SysTickEnableIT();
ConfSysTick();
while(1){
EnvoyerCaractere();
@ -154,7 +150,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<75>r<EFBFBD>e
//LL_Init1msTick(72000000); //!! d<>commenter que si l'IT est r<>cup<75>r<EFBFBD>e
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
LL_SetSystemCoreClock(72000000);

View file

@ -9,3 +9,12 @@ int Concatenate(char * chaine1, char * chaine2, int sizechaine1, int sizechaine2
return 0;
}
}
int size_of(char * chaine) {
int i = 0;
while (chaine[i] != '\0') {
i++;
}
return i+1;
}

View file

@ -3,4 +3,6 @@
int Concatenate(char * chaine1, char * chaine2, int sizechaine1, int sizechaine2, int sizemax);
int size_of(char * chaine);
#endif