Compare commits
No commits in common. "master" and "Anti-chavirement-v2" have entirely different histories.
master
...
Anti-chavi
27 changed files with 983 additions and 1212 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
MDK-ARM/DebugConfig/
|
|
||||||
MDK-ARM/NUCLEO-F103RB
|
|
||||||
MDK-ARM/*.scvd
|
|
||||||
MDK-ARM/*.uvguix.*
|
|
||||||
MDK-ARM/RTE/
|
|
||||||
*.lst
|
*.lst
|
||||||
|
*.uvguix*
|
||||||
|
MDK-ARM/DebugConfig/
|
||||||
|
*.scvd
|
||||||
|
MDK-ARM/NUCLEO-F103RB/
|
||||||
|
*.o
|
|
@ -3539,7 +3539,6 @@ __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)
|
__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));
|
register __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
|
||||||
|
|
||||||
return (uint16_t)(READ_BIT(*preg,
|
return (uint16_t)(READ_BIT(*preg,
|
||||||
ADC_JDR1_JDATA)
|
ADC_JDR1_JDATA)
|
||||||
);
|
);
|
||||||
|
@ -3581,8 +3580,7 @@ __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOS(ADC_TypeDef *ADCx)
|
||||||
/* end of unitary conversion. */
|
/* end of unitary conversion. */
|
||||||
/* Flag noted as "JEOC" is corresponding to flag "JEOS" */
|
/* Flag noted as "JEOC" is corresponding to flag "JEOS" */
|
||||||
/* in other STM32 families). */
|
/* in other STM32 families). */
|
||||||
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));}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get flag ADC analog watchdog 1 flag
|
* @brief Get flag ADC analog watchdog 1 flag
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<CLKADS>72000000</CLKADS>
|
<CLKADS>8000000</CLKADS>
|
||||||
<OPTTT>
|
<OPTTT>
|
||||||
<gFlags>1</gFlags>
|
<gFlags>1</gFlags>
|
||||||
<BeepAtEnd>1</BeepAtEnd>
|
<BeepAtEnd>1</BeepAtEnd>
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>1</IsCurrentTarget>
|
<IsCurrentTarget>0</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>18</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
<bEvRecOn>1</bEvRecOn>
|
<bEvRecOn>1</bEvRecOn>
|
||||||
<bSchkAxf>0</bSchkAxf>
|
<bSchkAxf>0</bSchkAxf>
|
||||||
<bTchkAxf>0</bTchkAxf>
|
<bTchkAxf>0</bTchkAxf>
|
||||||
<nTsel>0</nTsel>
|
<nTsel>6</nTsel>
|
||||||
<sDll></sDll>
|
<sDll></sDll>
|
||||||
<sDllPa></sDllPa>
|
<sDllPa></sDllPa>
|
||||||
<sDlgDll></sDlgDll>
|
<sDlgDll></sDlgDll>
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
<tDlgDll></tDlgDll>
|
<tDlgDll></tDlgDll>
|
||||||
<tDlgPa></tDlgPa>
|
<tDlgPa></tDlgPa>
|
||||||
<tIfile></tIfile>
|
<tIfile></tIfile>
|
||||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
|
||||||
</DebugOpt>
|
</DebugOpt>
|
||||||
<TargetDriverDllRegistry>
|
<TargetDriverDllRegistry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>DLGTARM</Key>
|
<Key>DLGTARM</Key>
|
||||||
<Name>(1010=1544,437,1920,994,1)(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=1029,93,1623,787,0)(131=-1,-1,-1,-1,0)(132=1285,441,1879,1135,1)(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=1317,406,1920,1040,1)(151=-1,-1,-1,-1,0)</Name>
|
<Name>(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=-1,-1,-1,-1,0)(120=100,127,658,622,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=-1,-1,-1,-1,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=-1,-1,-1,-1,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>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>UL2CM3</Key>
|
<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>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
@ -154,33 +154,6 @@
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint/>
|
||||||
<WatchWindow1>
|
|
||||||
<Ww>
|
|
||||||
<count>0</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>transmission</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>1</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>NiveauBatterie</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>2</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>res</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>3</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>angle_voile</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>4</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>retourCapteur,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
</WatchWindow1>
|
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
</Tracepoint>
|
</Tracepoint>
|
||||||
|
@ -189,7 +162,7 @@
|
||||||
<periodic>1</periodic>
|
<periodic>1</periodic>
|
||||||
<aLwin>1</aLwin>
|
<aLwin>1</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>1</aSer1>
|
<aSer1>0</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
<aPa>0</aPa>
|
<aPa>0</aPa>
|
||||||
<viewmode>1</viewmode>
|
<viewmode>1</viewmode>
|
||||||
|
@ -287,7 +260,7 @@
|
||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>0</IsCurrentTarget>
|
<IsCurrentTarget>1</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>18</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
|
@ -332,7 +305,7 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>DLGDARM</Key>
|
<Key>DLGDARM</Key>
|
||||||
<Name>(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=896,77,1490,828,1)(133=-1,-1,-1,-1,0)(160=1068,325,1516,739,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)</Name>
|
<Name>(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=-1,-1,-1,-1,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=-1,-1,-1,-1,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=60,0,663,751,0)(151=-1,-1,-1,-1,0)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
@ -365,17 +338,44 @@
|
||||||
<Name>-U-O142 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
<Name>-U-O142 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint>
|
||||||
|
<Bp>
|
||||||
|
<Number>0</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>99</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134218780</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>..\MyDrivers\MyTimer.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\NUCLEO_F103RB\../MyDrivers/MyTimer.c\99</Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>Chrono_Time</ItemText>
|
<ItemText>USART1</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>1</count>
|
<count>1</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>USART1</ItemText>
|
<ItemText>res10,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>2</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>level,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>3</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>danger,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
|
@ -424,7 +424,7 @@
|
||||||
<Wi>
|
<Wi>
|
||||||
<IntNumber>0</IntNumber>
|
<IntNumber>0</IntNumber>
|
||||||
<FirstString>((TIM_TypeDef *)(0x40000000UL + 0x00000000UL))->CNT</FirstString>
|
<FirstString>((TIM_TypeDef *)(0x40000000UL + 0x00000000UL))->CNT</FirstString>
|
||||||
<SecondString>FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000B6020008</SecondString>
|
<SecondString>FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1900000000000000000000000000000000000000B6020008</SecondString>
|
||||||
</Wi>
|
</Wi>
|
||||||
</LogicAnalyzers>
|
</LogicAnalyzers>
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
|
@ -447,7 +447,7 @@
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>1</FileNumber>
|
<FileNumber>1</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Src\Voilier.c</PathWithFileName>
|
<PathWithFileName>..\Src\Voilier.c</PathWithFileName>
|
||||||
|
@ -470,6 +470,18 @@
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\MyDrivers\MyTimer.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>MyTimer.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>3</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Src\Allure.c</PathWithFileName>
|
<PathWithFileName>..\Src\Allure.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>Allure.c</FilenameWithoutPath>
|
<FilenameWithoutPath>Allure.c</FilenameWithoutPath>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
@ -477,7 +489,19 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>3</FileNumber>
|
<FileNumber>4</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Batterie.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Batterie.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>5</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -489,7 +513,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>4</FileNumber>
|
<FileNumber>6</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -501,7 +525,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>5</FileNumber>
|
<FileNumber>7</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -513,7 +537,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>6</FileNumber>
|
<FileNumber>8</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -525,7 +549,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>7</FileNumber>
|
<FileNumber>9</FileNumber>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -537,49 +561,121 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>8</FileNumber>
|
<FileNumber>10</FileNumber>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Src\maths.h</PathWithFileName>
|
<PathWithFileName>..\Src\AntiChavirement.h</PathWithFileName>
|
||||||
<FilenameWithoutPath>maths.h</FilenameWithoutPath>
|
<FilenameWithoutPath>AntiChavirement.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>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\Src\maths.c</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>maths.c</FilenameWithoutPath>
|
|
||||||
<RteFlg>0</RteFlg>
|
|
||||||
<bShared>0</bShared>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<GroupNumber>2</GroupNumber>
|
|
||||||
<FileNumber>10</FileNumber>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\..\Projet_Voilier_4IR\Src\Securite.c</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>Securite.c</FilenameWithoutPath>
|
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>11</FileNumber>
|
<FileNumber>11</FileNumber>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Batterie.h</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Batterie.h</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>12</FileNumber>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Gouvernail.h</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Gouvernail.h</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>13</FileNumber>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Heure.h</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Heure.h</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>14</FileNumber>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\MyTimer.h</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>MyTimer.h</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>15</FileNumber>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Transmission.h</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Transmission.h</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>16</FileNumber>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Voile.h</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Voile.h</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>17</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\..\Projet_Voilier_4IR\Src\string.c</PathWithFileName>
|
<PathWithFileName>..\Src\AntiChavirement.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>string.c</FilenameWithoutPath>
|
<FilenameWithoutPath>AntiChavirement.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>18</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Securite.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Securite.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>2</GroupNumber>
|
||||||
|
<FileNumber>19</FileNumber>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\Src\Securite.h</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>Securite.h</FilenameWithoutPath>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
|
@ -593,7 +689,7 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>3</GroupNumber>
|
<GroupNumber>3</GroupNumber>
|
||||||
<FileNumber>12</FileNumber>
|
<FileNumber>20</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -605,7 +701,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>3</GroupNumber>
|
<GroupNumber>3</GroupNumber>
|
||||||
<FileNumber>13</FileNumber>
|
<FileNumber>21</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -615,54 +711,6 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
|
||||||
<GroupNumber>3</GroupNumber>
|
|
||||||
<FileNumber>14</FileNumber>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\LLDrivers\src\stm32f1xx_ll_gpio.c</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>stm32f1xx_ll_gpio.c</FilenameWithoutPath>
|
|
||||||
<RteFlg>0</RteFlg>
|
|
||||||
<bShared>0</bShared>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<GroupNumber>3</GroupNumber>
|
|
||||||
<FileNumber>15</FileNumber>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\LLDrivers\src\stm32f1xx_ll_tim.c</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>stm32f1xx_ll_tim.c</FilenameWithoutPath>
|
|
||||||
<RteFlg>0</RteFlg>
|
|
||||||
<bShared>0</bShared>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<GroupNumber>3</GroupNumber>
|
|
||||||
<FileNumber>16</FileNumber>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\LLDrivers\src\stm32f1xx_ll_exti.c</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>stm32f1xx_ll_exti.c</FilenameWithoutPath>
|
|
||||||
<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>
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -681,7 +729,7 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>5</GroupNumber>
|
<GroupNumber>5</GroupNumber>
|
||||||
<FileNumber>18</FileNumber>
|
<FileNumber>22</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -701,7 +749,7 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>6</GroupNumber>
|
<GroupNumber>6</GroupNumber>
|
||||||
<FileNumber>19</FileNumber>
|
<FileNumber>23</FileNumber>
|
||||||
<FileType>2</FileType>
|
<FileType>2</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
<TargetName>NUCLEO-F103RB</TargetName>
|
<TargetName>NUCLEO-F103RB</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
|
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
|
||||||
<uAC6>0</uAC6>
|
<uAC6>8</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
<Device>STM32F103RB</Device>
|
<Device>STM32F103RB</Device>
|
||||||
|
@ -185,7 +185,6 @@
|
||||||
<uocXRam>0</uocXRam>
|
<uocXRam>0</uocXRam>
|
||||||
<RvdsVP>0</RvdsVP>
|
<RvdsVP>0</RvdsVP>
|
||||||
<RvdsMve>0</RvdsMve>
|
<RvdsMve>0</RvdsMve>
|
||||||
<RvdsCdeCp>0</RvdsCdeCp>
|
|
||||||
<hadIRAM2>0</hadIRAM2>
|
<hadIRAM2>0</hadIRAM2>
|
||||||
<hadIROM2>0</hadIROM2>
|
<hadIROM2>0</hadIROM2>
|
||||||
<StupSel>8</StupSel>
|
<StupSel>8</StupSel>
|
||||||
|
@ -352,7 +351,7 @@
|
||||||
<NoWarn>0</NoWarn>
|
<NoWarn>0</NoWarn>
|
||||||
<uSurpInc>0</uSurpInc>
|
<uSurpInc>0</uSurpInc>
|
||||||
<useXO>0</useXO>
|
<useXO>0</useXO>
|
||||||
<ClangAsOpt>4</ClangAsOpt>
|
<uClangAs>0</uClangAs>
|
||||||
<VariousControls>
|
<VariousControls>
|
||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define></Define>
|
<Define></Define>
|
||||||
|
@ -393,11 +392,21 @@
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>MyDrivers</GroupName>
|
<GroupName>MyDrivers</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>MyTimer.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\MyDrivers\MyTimer.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Allure.c</FileName>
|
<FileName>Allure.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Src\Allure.c</FilePath>
|
<FilePath>..\Src\Allure.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Batterie.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Src\Batterie.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Gouvernail.c</FileName>
|
<FileName>Gouvernail.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
|
@ -424,24 +433,54 @@
|
||||||
<FilePath>..\Src\Allure.h</FilePath>
|
<FilePath>..\Src\Allure.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>maths.h</FileName>
|
<FileName>AntiChavirement.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\Src\maths.h</FilePath>
|
<FilePath>..\Src\AntiChavirement.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>maths.c</FileName>
|
<FileName>Batterie.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Batterie.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Gouvernail.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Gouvernail.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Heure.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Heure.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>MyTimer.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\MyTimer.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Transmission.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Transmission.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Voile.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Voile.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>AntiChavirement.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Src\maths.c</FilePath>
|
<FilePath>..\Src\AntiChavirement.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Securite.c</FileName>
|
<FileName>Securite.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\..\Projet_Voilier_4IR\Src\Securite.c</FilePath>
|
<FilePath>..\Src\Securite.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>string.c</FileName>
|
<FileName>Securite.h</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\..\Projet_Voilier_4IR\Src\string.c</FilePath>
|
<FilePath>..\Src\Securite.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -458,26 +497,6 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\LLDrivers\src\stm32f1xx_ll_utils.c</FilePath>
|
<FilePath>..\LLDrivers\src\stm32f1xx_ll_utils.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
|
||||||
<FileName>stm32f1xx_ll_gpio.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\LLDrivers\src\stm32f1xx_ll_gpio.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>stm32f1xx_ll_tim.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\LLDrivers\src\stm32f1xx_ll_tim.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>stm32f1xx_ll_exti.c</FileName>
|
|
||||||
<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>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -512,7 +531,7 @@
|
||||||
<TargetName>Simulateur</TargetName>
|
<TargetName>Simulateur</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
|
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
|
||||||
<uAC6>0</uAC6>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
|
@ -687,7 +706,6 @@
|
||||||
<uocXRam>0</uocXRam>
|
<uocXRam>0</uocXRam>
|
||||||
<RvdsVP>0</RvdsVP>
|
<RvdsVP>0</RvdsVP>
|
||||||
<RvdsMve>0</RvdsMve>
|
<RvdsMve>0</RvdsMve>
|
||||||
<RvdsCdeCp>0</RvdsCdeCp>
|
|
||||||
<hadIRAM2>0</hadIRAM2>
|
<hadIRAM2>0</hadIRAM2>
|
||||||
<hadIROM2>0</hadIROM2>
|
<hadIROM2>0</hadIROM2>
|
||||||
<StupSel>8</StupSel>
|
<StupSel>8</StupSel>
|
||||||
|
@ -854,7 +872,7 @@
|
||||||
<NoWarn>0</NoWarn>
|
<NoWarn>0</NoWarn>
|
||||||
<uSurpInc>0</uSurpInc>
|
<uSurpInc>0</uSurpInc>
|
||||||
<useXO>0</useXO>
|
<useXO>0</useXO>
|
||||||
<ClangAsOpt>4</ClangAsOpt>
|
<uClangAs>0</uClangAs>
|
||||||
<VariousControls>
|
<VariousControls>
|
||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define></Define>
|
<Define></Define>
|
||||||
|
@ -895,11 +913,21 @@
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>MyDrivers</GroupName>
|
<GroupName>MyDrivers</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>MyTimer.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\MyDrivers\MyTimer.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Allure.c</FileName>
|
<FileName>Allure.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Src\Allure.c</FilePath>
|
<FilePath>..\Src\Allure.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Batterie.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Src\Batterie.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Gouvernail.c</FileName>
|
<FileName>Gouvernail.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
|
@ -926,24 +954,54 @@
|
||||||
<FilePath>..\Src\Allure.h</FilePath>
|
<FilePath>..\Src\Allure.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>maths.h</FileName>
|
<FileName>AntiChavirement.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\Src\maths.h</FilePath>
|
<FilePath>..\Src\AntiChavirement.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>maths.c</FileName>
|
<FileName>Batterie.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Batterie.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Gouvernail.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Gouvernail.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Heure.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Heure.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>MyTimer.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\MyTimer.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Transmission.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Transmission.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Voile.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Src\Voile.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>AntiChavirement.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Src\maths.c</FilePath>
|
<FilePath>..\Src\AntiChavirement.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Securite.c</FileName>
|
<FileName>Securite.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\..\Projet_Voilier_4IR\Src\Securite.c</FilePath>
|
<FilePath>..\Src\Securite.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>string.c</FileName>
|
<FileName>Securite.h</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\..\Projet_Voilier_4IR\Src\string.c</FilePath>
|
<FilePath>..\Src\Securite.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -960,26 +1018,6 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\LLDrivers\src\stm32f1xx_ll_utils.c</FilePath>
|
<FilePath>..\LLDrivers\src\stm32f1xx_ll_utils.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
|
||||||
<FileName>stm32f1xx_ll_gpio.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\LLDrivers\src\stm32f1xx_ll_gpio.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>stm32f1xx_ll_tim.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\LLDrivers\src\stm32f1xx_ll_tim.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>stm32f1xx_ll_exti.c</FileName>
|
|
||||||
<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>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -1026,19 +1064,4 @@
|
||||||
<files/>
|
<files/>
|
||||||
</RTE>
|
</RTE>
|
||||||
|
|
||||||
<LayerInfo>
|
|
||||||
<Layers>
|
|
||||||
<Layer>
|
|
||||||
<LayName><Project Info></LayName>
|
|
||||||
<LayDesc></LayDesc>
|
|
||||||
<LayUrl></LayUrl>
|
|
||||||
<LayKeys></LayKeys>
|
|
||||||
<LayCat></LayCat>
|
|
||||||
<LayLic></LayLic>
|
|
||||||
<LayTarg>0</LayTarg>
|
|
||||||
<LayPrjMark>1</LayPrjMark>
|
|
||||||
</Layer>
|
|
||||||
</Layers>
|
|
||||||
</LayerInfo>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
109
MyDrivers/MyTimer.c
Normal file
109
MyDrivers/MyTimer.c
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
// 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;
|
||||||
|
}
|
70
MyDrivers/MyTimer.h
Normal file
70
MyDrivers/MyTimer.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
// 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
|
104
Src/Allure.c
104
Src/Allure.c
|
@ -1,104 +0,0 @@
|
||||||
#include "maths.h" //Pour la valeur absolue
|
|
||||||
#include "stm32f1xx_ll_gpio.h" // GPIO
|
|
||||||
#include "stm32f1xx_ll_bus.h" // RCC
|
|
||||||
#include "stm32f1xx_ll_tim.h" // TIMER
|
|
||||||
#include "stm32f1xx_ll_exti.h" // External Interrup
|
|
||||||
|
|
||||||
int initialized = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure la girouette pour la détection de l'allure (sens du vent).
|
|
||||||
* @note Configuration des ports PA6 et 7 en alternate input pour récupérer les signaux
|
|
||||||
Configuration des deux channels du TIM3 pour le compteur incrementeur
|
|
||||||
Configuration du PA5 avec une interruption pour capter les tours de girouette
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ConfAllure(void) {
|
|
||||||
// Configuration des IO
|
|
||||||
// Liberation de la clock du port A
|
|
||||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
|
||||||
|
|
||||||
// Configuration des IO -> pin A6 et A7 en alternate imput, pin A5 en interruption
|
|
||||||
//LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_5, LL_GPIO_MODE_INPUT);
|
|
||||||
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_6, LL_GPIO_MODE_FLOATING);
|
|
||||||
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_7, LL_GPIO_MODE_FLOATING);
|
|
||||||
LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTA, LL_GPIO_AF_EXTI_LINE5);
|
|
||||||
|
|
||||||
LL_EXTI_InitTypeDef ExtiInitializer;
|
|
||||||
LL_EXTI_StructInit(&ExtiInitializer);
|
|
||||||
ExtiInitializer.Line_0_31 = LL_EXTI_LINE_5;
|
|
||||||
ExtiInitializer.Mode = LL_EXTI_MODE_IT;
|
|
||||||
ExtiInitializer.Trigger = LL_EXTI_TRIGGER_RISING;
|
|
||||||
ExtiInitializer.LineCommand = ENABLE;
|
|
||||||
LL_EXTI_Init(&ExtiInitializer);
|
|
||||||
|
|
||||||
NVIC->IP[23] = 0x43;
|
|
||||||
NVIC->ISER[0] |= 0x01 <<23;
|
|
||||||
|
|
||||||
//Configuration du timer
|
|
||||||
// Libération de la clock du timer
|
|
||||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM3);
|
|
||||||
|
|
||||||
// Configuration des canaux du timer -> TIM3 CH1 et 2 en alternate input
|
|
||||||
LL_TIM_ENCODER_InitTypeDef Tim3Initializer;
|
|
||||||
LL_TIM_ENCODER_StructInit(&Tim3Initializer);
|
|
||||||
Tim3Initializer.EncoderMode = LL_TIM_ENCODERMODE_X2_TI1;
|
|
||||||
Tim3Initializer.IC1ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
|
|
||||||
Tim3Initializer.IC1Filter = LL_TIM_IC_FILTER_FDIV1 ;
|
|
||||||
Tim3Initializer.IC1Polarity = LL_TIM_IC_POLARITY_RISING;
|
|
||||||
Tim3Initializer.IC1Prescaler = LL_TIM_ICPSC_DIV1;
|
|
||||||
Tim3Initializer.IC2ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
|
|
||||||
Tim3Initializer.IC2Filter = LL_TIM_IC_FILTER_FDIV1;
|
|
||||||
Tim3Initializer.IC2Polarity = LL_TIM_IC_POLARITY_RISING;
|
|
||||||
Tim3Initializer.IC2Prescaler = LL_TIM_ICPSC_DIV1;
|
|
||||||
LL_TIM_ENCODER_Init(TIM3, &Tim3Initializer);
|
|
||||||
LL_TIM_SetAutoReload(TIM3, 719);
|
|
||||||
LL_TIM_EnableCounter(TIM3);
|
|
||||||
}
|
|
||||||
int retourCapteur;
|
|
||||||
int RecupAllure(void) {
|
|
||||||
if (!initialized) {
|
|
||||||
return 180; //Si jamais la girouette n'est pas initialisée, on relache les voiles (comme en cas d'alerte dee chavirement)
|
|
||||||
} else {
|
|
||||||
retourCapteur = (int)LL_TIM_GetCounter(TIM3);
|
|
||||||
if (retourCapteur < 360) {
|
|
||||||
return (retourCapteur/2);
|
|
||||||
} else {
|
|
||||||
return (retourCapteur + 720)/2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char * AllureToString(int alpha) {
|
|
||||||
int alpha_abs = abs(alpha);
|
|
||||||
if (alpha_abs < 45) {
|
|
||||||
return "Vent debout";
|
|
||||||
} else if (alpha < 55) {
|
|
||||||
return "Pres";
|
|
||||||
} else if (alpha < 65) {
|
|
||||||
return "Bon plein";
|
|
||||||
} else if (alpha < 80) {
|
|
||||||
return "Petit largue";
|
|
||||||
} else if (alpha < 100) {
|
|
||||||
return "Travers";
|
|
||||||
} else if (alpha < 115) {
|
|
||||||
return "Largue";
|
|
||||||
} else if (alpha < 155) {
|
|
||||||
return "Grand largue";
|
|
||||||
} else if (alpha < 180) {
|
|
||||||
return "Vent arriere";
|
|
||||||
} else {
|
|
||||||
return "ERROR";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int GirouetteInitialisee(void) {
|
|
||||||
return initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EXTI9_5_IRQHandler(void) {
|
|
||||||
LL_TIM_SetCounter(TIM3, 0);
|
|
||||||
initialized = 1;
|
|
||||||
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_5);
|
|
||||||
}
|
|
45
Src/Allure.h
45
Src/Allure.h
|
@ -1,45 +0,0 @@
|
||||||
#ifndef ALLURE_H
|
|
||||||
#define ALLURE_H
|
|
||||||
|
|
||||||
/* PERSONNES QUI ONT TRAVAILLE SUR CE MODULE : PAUL */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure la girouette pour la détection de l'allure (sens du vent).
|
|
||||||
* @note Configuration des ports PA6 et 7 en alternate input pour récupérer les signaux
|
|
||||||
Configuration des deux channels du TIM3 pour le compteur incrementeur
|
|
||||||
Configuration du PA5 avec une interruption pour capter les tours de girouette
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ConfAllure(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Renvoi la valeur de l'allure actuelle
|
|
||||||
* @note Représentation de la donnée en degrès -> int entre -180 et 180
|
|
||||||
ATTENTION : -1000 renvoyé si girouette non initialisée
|
|
||||||
* @param None
|
|
||||||
* @retval L'allure, représenté en degrès par un entier entre -180 et 180
|
|
||||||
ATTENTION : -1000 renvoyé si girouette non initialisée
|
|
||||||
*/
|
|
||||||
int RecupAllure(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Associe un chaine de caractère a une valeur d'allure.
|
|
||||||
* @note Une chaine de caractère est associé a des intervalles de alpha :
|
|
||||||
[-45, 45] -> "Vent debout"
|
|
||||||
[45, 55] -> "Près" (et intervalle opposé)
|
|
||||||
[55, 65] -> "Bon plein" (et intervalle opposé)
|
|
||||||
[65, 80] -> "Petit largue" (et intervalle opposé)
|
|
||||||
[80, 100] -> "Travers" (et intervalle opposé)
|
|
||||||
[100, 115] -> "Largue" (et intervalle opposé)
|
|
||||||
[115, 155] -> "Grand largue" (et intervalle opposé)
|
|
||||||
[155, -155] -> "Vent arrière"
|
|
||||||
Autre -> "ERROR"
|
|
||||||
* @param alpha : un entier représentant l'allure en ° (-180 à 180)
|
|
||||||
* @retval Une chaine de caractère représentant l'allure
|
|
||||||
*/
|
|
||||||
char * AllureToString(int alpha);
|
|
||||||
|
|
||||||
int GirouetteInitialisee(void);
|
|
||||||
|
|
||||||
#endif
|
|
63
Src/AntiChavirement.c
Normal file
63
Src/AntiChavirement.c
Normal file
|
@ -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);
|
||||||
|
}
|
38
Src/AntiChavirement.h
Normal file
38
Src/AntiChavirement.h
Normal file
|
@ -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
|
0
Src/Batterie.c
Normal file
0
Src/Batterie.c
Normal file
0
Src/Batterie.h
Normal file
0
Src/Batterie.h
Normal file
|
@ -1,94 +0,0 @@
|
||||||
#include "stm32f1xx_ll_gpio.h" // GPIO
|
|
||||||
#include "stm32f1xx_ll_bus.h" // RCC
|
|
||||||
#include "stm32f1xx_ll_tim.h" // TIMER
|
|
||||||
#include "maths.h"
|
|
||||||
|
|
||||||
#define MAX_PWM (50)
|
|
||||||
#define MAX_PWM_OUTPUT (34999)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure le récepteur de la télécommande ainsi que le plateau rotatif.
|
|
||||||
* @note Configuration du port PB6 et 7 en alternate input pour récupérer les signaux
|
|
||||||
Configuration des deux channels du TIM4 pour la lecture de la PWM
|
|
||||||
Configuration du PA1 en alternate output (commande PWM vitesse) et PA2 en output push pull pour commander le sens
|
|
||||||
Configuration du TIM2_CH2 pour la sortie PWM
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ConfGouvernail(void) {
|
|
||||||
// Configuration des IO
|
|
||||||
// Liberation de la clock du port A et B
|
|
||||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
|
||||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);
|
|
||||||
|
|
||||||
// Configuration des IO -> pin B6 en alternate input, pin A1 en alternate output, et, pin A2 en output push pull
|
|
||||||
LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_6, LL_GPIO_MODE_FLOATING);
|
|
||||||
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_1, LL_GPIO_MODE_ALTERNATE);
|
|
||||||
LL_GPIO_SetPinOutputType(GPIOA, LL_GPIO_PIN_1, LL_GPIO_OUTPUT_PUSHPULL);
|
|
||||||
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_2, LL_GPIO_MODE_OUTPUT_2MHz);
|
|
||||||
LL_GPIO_SetPinOutputType(GPIOA, LL_GPIO_PIN_2, LL_GPIO_OUTPUT_PUSHPULL);
|
|
||||||
|
|
||||||
|
|
||||||
//Configuration des timers
|
|
||||||
// Libération de la clock du timer
|
|
||||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM2);
|
|
||||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM4);
|
|
||||||
|
|
||||||
// Configuration des canaux du timer -> TIM2 CH2 et PWM output (plages de 20ms)
|
|
||||||
LL_TIM_OC_InitTypeDef Tim2Initializer;
|
|
||||||
LL_TIM_OC_StructInit(&Tim2Initializer);
|
|
||||||
Tim2Initializer.OCMode = LL_TIM_OCMODE_PWM1;
|
|
||||||
LL_TIM_OC_Init(TIM2, LL_TIM_CHANNEL_CH2, &Tim2Initializer);
|
|
||||||
LL_TIM_SetAutoReload(TIM2, MAX_PWM);
|
|
||||||
LL_TIM_SetPrescaler(TIM2, 71);
|
|
||||||
LL_TIM_OC_SetCompareCH2(TIM2, 0);
|
|
||||||
LL_TIM_EnableCounter(TIM2);
|
|
||||||
LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH2);
|
|
||||||
|
|
||||||
LL_TIM_IC_InitTypeDef Tim4Initializer;
|
|
||||||
LL_TIM_IC_StructInit(&Tim4Initializer);
|
|
||||||
Tim4Initializer.ICActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
|
|
||||||
Tim4Initializer.ICPolarity = LL_TIM_IC_POLARITY_RISING;
|
|
||||||
LL_TIM_IC_Init(TIM4, LL_TIM_CHANNEL_CH1, &Tim4Initializer);
|
|
||||||
Tim4Initializer.ICActiveInput = LL_TIM_ACTIVEINPUT_INDIRECTTI;
|
|
||||||
Tim4Initializer.ICPolarity = LL_TIM_IC_POLARITY_FALLING;
|
|
||||||
LL_TIM_IC_Init(TIM4, LL_TIM_CHANNEL_CH2, &Tim4Initializer);
|
|
||||||
LL_TIM_SetAutoReload(TIM4, MAX_PWM_OUTPUT);
|
|
||||||
LL_TIM_SetPrescaler(TIM4, 71);
|
|
||||||
LL_TIM_SetSlaveMode(TIM4, LL_TIM_SLAVEMODE_RESET);
|
|
||||||
LL_TIM_SetTriggerInput(TIM4, LL_TIM_TS_TI1FP1);
|
|
||||||
LL_TIM_EnableCounter(TIM4);
|
|
||||||
LL_TIM_CC_EnableChannel(TIM4, LL_TIM_CHANNEL_CH1);
|
|
||||||
LL_TIM_CC_EnableChannel(TIM4, LL_TIM_CHANNEL_CH2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Renvoi la valeur envoyée par la télécommande
|
|
||||||
* @note Représentation de la donnée en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue)
|
|
||||||
* @param None
|
|
||||||
* @retval La commande de la télécommande, représenté en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue)
|
|
||||||
*/
|
|
||||||
int LireTelecommande(void) {
|
|
||||||
int lecture = LL_TIM_IC_GetCaptureCH2(TIM4) + 1;
|
|
||||||
int Valeur_Lue = ((lecture - 1500) / 5);
|
|
||||||
if (abs(Valeur_Lue) < 10) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return Valeur_Lue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Commande le moteur en fonction de la commande donnée.
|
|
||||||
* @note Commande le sens et la vitesse
|
|
||||||
* @param Commande en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void CommanderMoteur(int commande) {
|
|
||||||
if (commande < 0) {
|
|
||||||
LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_2);
|
|
||||||
} else {
|
|
||||||
LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_2);
|
|
||||||
}
|
|
||||||
LL_TIM_OC_SetCompareCH2(TIM2, (int)(((float)abs(commande)) * (((float)MAX_PWM) / 100.0)));
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
#ifndef GOUVERNAIL_H
|
|
||||||
#define GOUVERNAIL_H
|
|
||||||
|
|
||||||
/* PERSONNES QUI ONT TRAVAILLE SUR CE MODULE : PAUL, ELISE */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure le récepteur de la télécommande ainsi que le plateau rotatif.
|
|
||||||
* @note Configuration du port PB6 et 7 en alternate input pour récupérer les signaux de la télécommande
|
|
||||||
Configuration des deux channels du TIM4 pour la lecture de la PWM
|
|
||||||
Configuration du PA1 en alternate output (commande PWM vitesse) et PA2 en output push pull pour commander le sens
|
|
||||||
Configuration du TIM2_CH2 pour la sortie PWM
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ConfGouvernail(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Renvoi la valeur envoyée par la télécommande
|
|
||||||
* @note Représentation de la donnée en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue)
|
|
||||||
* @param None
|
|
||||||
* @retval La commande de la télécommande, représenté en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue)
|
|
||||||
*/
|
|
||||||
int LireTelecommande(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Commande le moteur en fonction de la commande donnée.
|
|
||||||
* @note Commande le sens et la vitesse
|
|
||||||
* @param Commande en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void CommanderMoteur(int commande);
|
|
||||||
|
|
||||||
#endif
|
|
182
Src/MyTimer.c
Normal file
182
Src/MyTimer.c
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
// 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)();
|
||||||
|
}
|
70
Src/MyTimer.h
Normal file
70
Src/MyTimer.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
// 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
|
153
Src/Securite.c
153
Src/Securite.c
|
@ -1,20 +1,18 @@
|
||||||
#include "stm32f103xb.h"
|
#include "Securite.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"
|
|
||||||
|
|
||||||
#define SEUIL45DEGRESSENS1 (1853)
|
|
||||||
|
|
||||||
#define SEUIL45DEGRESSENS2 (2457)
|
|
||||||
|
|
||||||
|
|
||||||
// Seuil represente la valeur (en %) en dessous de laquelle le niveau de batterie est consideree faible
|
// Seuil represente la valeur (en %) en dessous de laquelle le niveau de batterie est consideree faible
|
||||||
#define Seuil (20)
|
#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(){
|
void ConfSecurite(){
|
||||||
//On est pas sûrs pour ADC 1, voir datasheet page 28
|
//On est pas sûrs pour ADC 1, voir datasheet page 28
|
||||||
|
|
||||||
|
@ -60,17 +58,23 @@ void ConfSecurite(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*LL_ADC_StartCalibration(ADC1);
|
LL_ADC_StartCalibration(ADC1);
|
||||||
|
|
||||||
|
|
||||||
//Tant que calibration par terminée on enable pas
|
//Tant que calibration par terminée on enable pas
|
||||||
while(LL_ADC_IsCalibrationOnGoing(ADC1)){
|
while(LL_ADC_IsCalibrationOnGoing(ADC1)){
|
||||||
}*/
|
}
|
||||||
|
|
||||||
//Activation de l'ADC (???)
|
//Activation de l'ADC (???)
|
||||||
LL_ADC_Enable(ADC1);
|
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){
|
int RecupNiveauBatterie(void){
|
||||||
// Lancement de la conversion
|
// Lancement de la conversion
|
||||||
LL_ADC_INJ_StartConversionSWStart(ADC1);
|
LL_ADC_INJ_StartConversionSWStart(ADC1);
|
||||||
|
@ -79,33 +83,52 @@ int RecupNiveauBatterie(void){
|
||||||
// R?cuperation de la valeur apres conversion
|
// R?cuperation de la valeur apres conversion
|
||||||
int NiveauBatterie = LL_ADC_INJ_ReadConversionData12(ADC1,LL_ADC_INJ_RANK_2);
|
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
|
// Valeur code sur 12 bits : 0 a 4095 ; on veut Niveau de batterie en pourcentage
|
||||||
return (int)((float)(NiveauBatterie) * 100.0 / 4095.0) ;
|
return NiveauBatterie * 100 / 4095 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CalculerDangerNiveauBatterie(int niveau){
|
/**
|
||||||
|
* @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)
|
if ( niveau <= Seuil)
|
||||||
{
|
{
|
||||||
return 1;
|
drapeauDangerBatterie = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
drapeauDangerBatterie = 0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CalculerDangerChavirement(int gamma){
|
/*
|
||||||
if ((gamma > SEUIL45DEGRESSENS2) || (gamma < SEUIL45DEGRESSENS1))
|
* @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)
|
||||||
{
|
{
|
||||||
return 1;
|
drapeauDangerRouli = 1;
|
||||||
|
TendreVoile(90); //On lache les voiles si danger de chavirement
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
drapeauDangerRouli = 0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Recuperer l angle de rouli
|
||||||
|
* @note ADC1 -> Channel 10 (Rang 1)
|
||||||
|
* @param None
|
||||||
|
* @retval angle de rouli
|
||||||
|
*/
|
||||||
int RecupRouli(){
|
int RecupRouli(){
|
||||||
// Lancement de la conversion
|
// Lancement de la conversion
|
||||||
LL_ADC_INJ_StartConversionSWStart(ADC1);
|
LL_ADC_INJ_StartConversionSWStart(ADC1);
|
||||||
|
@ -113,6 +136,90 @@ int RecupRouli(){
|
||||||
while(!LL_ADC_IsActiveFlag_JEOS(ADC1)){}
|
while(!LL_ADC_IsActiveFlag_JEOS(ADC1)){}
|
||||||
// R?cuperation de la valeur apres conversion
|
// R?cuperation de la valeur apres conversion
|
||||||
int NiveauChavirement = LL_ADC_INJ_ReadConversionData12(ADC1,LL_ADC_INJ_RANK_1);
|
int NiveauChavirement = LL_ADC_INJ_ReadConversionData12(ADC1,LL_ADC_INJ_RANK_1);
|
||||||
return NiveauChavirement;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,50 +1,55 @@
|
||||||
#ifndef SECURITE_H
|
#ifndef ANTI_CHAVIREMENT_H
|
||||||
#define SECURITE_H
|
#define ANTI_CHAVIREMENT_H
|
||||||
|
|
||||||
/* PERSONNES QUI ONT TRAVAILLE SUR CE MODULE : ELIES, AURIANE, ELISE */
|
#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 Mets le flag drapeauDangerRouli a 1 si l angle de roulis est mauvais
|
|
||||||
* @note Si le voilier prend un angle de roulis supérieur à 40° -> MSG de danger + voiles sont immédiatement relâchées
|
|
||||||
* @param un entier representant l angle de roulis (entre 0 et 90 degrés)
|
|
||||||
* @retval NONE
|
|
||||||
*/
|
|
||||||
int CalculerDangerChavirement(int gamma);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Recuperer l angle de rouli
|
* @brief
|
||||||
* @note ADC1 -> Channel 10 (Rang 1)
|
* @note
|
||||||
* @param None
|
* @param
|
||||||
* @retval angle de rouli (entre 0 et 90 degrès)
|
* @retval
|
||||||
*/
|
*/
|
||||||
int RecupRouli(void);
|
void CalculerDanger(int gamma);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* @note
|
||||||
|
* @param
|
||||||
|
* @retval
|
||||||
|
*/
|
||||||
|
int RecupRouli();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Recuperer le niveau de batterie
|
* @brief
|
||||||
* @note ADC1 -> Channel 12 (Rang 2)
|
* @note
|
||||||
* @param None
|
* @param
|
||||||
* @retval niveau de batterie en pourcentage (entre 0 et 100)
|
* @retval
|
||||||
*/
|
*/
|
||||||
int RecupNiveauBatterie(void);
|
int RecupNiveauBatterie(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configuration de l'ADC 1 pour l'acceleromètre et le niveau de batterie
|
* @brief
|
||||||
* @note Channels 10 et 12. A lancer en 1er
|
* @note A lancer en 1er avant tout
|
||||||
* @param None
|
* @param
|
||||||
* @retval None
|
* @retval
|
||||||
*/
|
*/
|
||||||
void ConfSecurite(void);
|
void confSecurite(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Met le flag de dangerBatterie à 1 si batterie faible.
|
* @brief
|
||||||
* @note
|
* @note
|
||||||
* @param un entier representant le niveau de batterie en pourcentage
|
* @param
|
||||||
* @retval 1 si danger, 0 si pas de danger
|
* @retval
|
||||||
*/
|
*/
|
||||||
int CalculerDangerNiveauBatterie(int niveau);
|
void CalculDangerNiveauBatterie(int niveau );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,185 +0,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"
|
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
#define TAILLE_MESSAGE_MAX 100
|
|
||||||
#define USARTX USART1
|
|
||||||
|
|
||||||
// Structure pour gérer la transmission du message
|
|
||||||
struct t_transmission {
|
|
||||||
char message[TAILLE_MESSAGE_MAX];// Le message lui même
|
|
||||||
int position;// La position du caractere a envoyer
|
|
||||||
int taille_message; //On peut envoyer des messages de tailles variables, il faut donc spécifier la taille
|
|
||||||
char envoyer;// Booléen utilisé comme flag -> vrai on envoie, faux on fait rien
|
|
||||||
char exceptionnel; //Booléen utilisé comme flag -> vrai on envoie un message excep donc, on ne fait pas l'envoi regulier
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialise une structure t_transmission.
|
|
||||||
* @note Structure initialisée : (message -> 00:00:00:, end_of_message -> 0x0D, position -> 0, first_appel -> 1)
|
|
||||||
* @param @ de la structure a initialiser
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void init_t_transmission(struct t_transmission * transmission) {
|
|
||||||
int i;
|
|
||||||
for (i=0; i<TAILLE_MESSAGE_MAX; i++) {
|
|
||||||
transmission->message[i] = '0';
|
|
||||||
}
|
|
||||||
transmission->message[TAILLE_MESSAGE_MAX - 1] = '\0';
|
|
||||||
transmission->position = 0;
|
|
||||||
transmission->taille_message = 0;
|
|
||||||
transmission->envoyer = 0;
|
|
||||||
transmission->exceptionnel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct t_transmission transmission;
|
|
||||||
|
|
||||||
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_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);
|
|
||||||
|
|
||||||
init_t_transmission(&transmission);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void EnvoiRegulier(char * Allure, char * tension){
|
|
||||||
|
|
||||||
if (!transmission.exceptionnel) {
|
|
||||||
/* Message de la forme suivante :
|
|
||||||
_____________________________
|
|
||||||
Allure actuelle : xxxxxxxxxxx
|
|
||||||
Tension des voiles : xxxxxxxx
|
|
||||||
_____________________________*/
|
|
||||||
|
|
||||||
static char promptligne1[] = "Allure actuelle : ";
|
|
||||||
static int promptligne1size = 19;
|
|
||||||
static char promptligne2[] = "Tension des voiles : ";
|
|
||||||
static int promptligne2size = 22;
|
|
||||||
static char rc[] = "\n";
|
|
||||||
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, 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, 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);
|
|
||||||
|
|
||||||
transmission.envoyer = 1;
|
|
||||||
transmission.position = 0;
|
|
||||||
transmission.taille_message = current_size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*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){
|
|
||||||
|
|
||||||
/* Message de la forme suivante :
|
|
||||||
_____________________________
|
|
||||||
Allure actuelle : xxxxxxxxxxx
|
|
||||||
Tension des voiles : xxxxxxxx
|
|
||||||
_____________________________*/
|
|
||||||
|
|
||||||
static char prompt[] = "WARNING : ";
|
|
||||||
static int promptsize = 11;
|
|
||||||
static char rc[] = "\n";
|
|
||||||
static int rcsize = 2;
|
|
||||||
|
|
||||||
transmission.message[0] = '\0';
|
|
||||||
int current_size = 1;
|
|
||||||
|
|
||||||
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, 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);
|
|
||||||
|
|
||||||
transmission.envoyer = 1;
|
|
||||||
transmission.position = 0;
|
|
||||||
transmission.taille_message = current_size;
|
|
||||||
transmission.exceptionnel = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*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++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LL_GPIO_ResetOutputPin(GPIOA,LL_GPIO_PIN_11);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void EnvoyerCaractere(void) {
|
|
||||||
if (transmission.envoyer) {
|
|
||||||
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(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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
#ifndef TRANSMISSION_H
|
|
||||||
#define TRANSMISSION_H
|
|
||||||
|
|
||||||
|
|
||||||
/* PERSONNES QUI ONT TRAVAILLE SUR CE MODULE : PAUL, ELIES, AURIANE */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialiser la structure de transmission avec les chaines de caractères pour l'envoi régulier
|
|
||||||
* @note Flag d'envoi mis à 1 à la fin pour activer la transmission dans EnvoyerCaractere
|
|
||||||
* @param 2 chaines de caractères pour l'allure et la tension des voiles
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void EnvoiRegulier(char * Allure, char * tension);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialiser la structure de transmission avec les chaines de caractères pour l'envoi excptionnel
|
|
||||||
* @note Flag d'envoi mis à 1 à la fin pour activer la transmission dans EnvoyerCaractere
|
|
||||||
Envoi excpetionnel peut être un message d'alerte pour la batterie ou le roulis
|
|
||||||
* @param A chaine de caractère pour indiquer quel danger est mis en avant
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void EnvoiExceptionnel(char * msgAlarme);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Appelée en BG dans le while(1). Si le flag d'envoi est à 1, envoi le prochain caractère contenu dans la
|
|
||||||
structure transmission
|
|
||||||
* @note
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void EnvoyerCaractere(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configuration de l'USART pour les transmissions
|
|
||||||
* @note None
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ConfTransmission(void);
|
|
||||||
|
|
||||||
#endif
|
|
135
Src/Voile.c
135
Src/Voile.c
|
@ -1,135 +0,0 @@
|
||||||
#include "Voile.h"
|
|
||||||
#include "stm32f1xx_ll_gpio.h"
|
|
||||||
#include "stm32f1xx_ll_tim.h"
|
|
||||||
#include "stm32f1xx_ll_bus.h"
|
|
||||||
#include "maths.h" //Remplacer par maths.h quand on va tout faire marcher.
|
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
#define ARR (19999)
|
|
||||||
#define PSC (71)
|
|
||||||
#define Timer (TIM1)
|
|
||||||
#define channel (1)
|
|
||||||
#define A_ALPHA_TO_BETA (2.0/3.0) //Coefficient directeur de la partie linéaire de la fonction transformant l'allure en angle de voile
|
|
||||||
#define B_ALPHA_TO_BETA (-30.0) //Ordonnée a l'origine de cette même fonction
|
|
||||||
#define GAMMA_90 (2100) //Valeur du registre commandant la largeur de la PWM pour les voiles lachées
|
|
||||||
#define GAMMA_0 (1000) //Valeur du registre commandant la largeur de la PWM pour les voiles bordées au maximum
|
|
||||||
#define A_BETA_TO_GAMMA ((GAMMA_90 - GAMMA_0)/90.0) //Coefficient directeur de la relation entre l'angle de voile et la PWM
|
|
||||||
#define B_BETA_TO_GAMMA (GAMMA_0) //Ordonnée a l'origine
|
|
||||||
|
|
||||||
//Valeurs de CCR1 pour la PWM output
|
|
||||||
#define POSITION_00 2100
|
|
||||||
#define POSITION_10 1880
|
|
||||||
#define POSITION_20 1770
|
|
||||||
#define POSITION_30 1660
|
|
||||||
#define POSITION_40 1550
|
|
||||||
#define POSITION_50 1440
|
|
||||||
#define POSITION_60 1330
|
|
||||||
#define POSITION_70 1220
|
|
||||||
#define POSITION_80 1110
|
|
||||||
#define POSITION_90 1000
|
|
||||||
|
|
||||||
|
|
||||||
int angleVoileActuel = 0; //angle de la voile. Mis à jour quans on la tend. de 0 à 45.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfVoile(void){
|
|
||||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); //Enable l'horloge du GPIOA
|
|
||||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1);
|
|
||||||
LL_TIM_SetAutoReload(Timer, ARR); //On règle l'ARR
|
|
||||||
LL_TIM_SetPrescaler(Timer, PSC); //On règle le PSC
|
|
||||||
LL_GPIO_SetPinMode(GPIOA,LL_GPIO_PIN_8,LL_GPIO_MODE_ALTERNATE); //Pin en mode output alternate
|
|
||||||
LL_GPIO_SetPinOutputType(GPIOA,LL_GPIO_PIN_8,LL_GPIO_OUTPUT_PUSHPULL); //Pin en mode output pushpull
|
|
||||||
LL_TIM_OC_SetMode(Timer, channel, LL_TIM_OCMODE_PWM1); //On met le timer en mode PWM1 sur le channel choisi
|
|
||||||
Timer->CCER |= TIM_CCER_CC1E; //On enable le comptage dans le timer en output
|
|
||||||
Timer->BDTR |= 0x1 << 15; //Comme on utilise le Timer1, on met le bit MOE à 1
|
|
||||||
Timer->CCR1 = 1500; // par defaut tendu à 1ms
|
|
||||||
LL_TIM_EnableCounter(Timer); //On commence le comptage
|
|
||||||
}
|
|
||||||
|
|
||||||
float res;
|
|
||||||
|
|
||||||
int RecupTensionVoile(void){
|
|
||||||
return angleVoileActuel;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int CalculerTension(int alpha){
|
|
||||||
if (abs(alpha) < 45){
|
|
||||||
res = 0;
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
res = A_ALPHA_TO_BETA * (float)abs(alpha) + B_ALPHA_TO_BETA;
|
|
||||||
return (int)res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float angle_voile;
|
|
||||||
void TendreVoile(int theta)
|
|
||||||
{
|
|
||||||
/*if (theta < 5){
|
|
||||||
Timer->CCR1 = POSITION_00;
|
|
||||||
angleVoileActuel = 0;
|
|
||||||
}
|
|
||||||
if (theta < 10){
|
|
||||||
Timer->CCR1 = POSITION_10;
|
|
||||||
angleVoileActuel = 10;
|
|
||||||
}
|
|
||||||
else if(theta < 20){
|
|
||||||
Timer->CCR1 = POSITION_20;
|
|
||||||
angleVoileActuel = 20;
|
|
||||||
}
|
|
||||||
else if(theta < 30){
|
|
||||||
Timer->CCR1 = POSITION_30;
|
|
||||||
angleVoileActuel = 30;
|
|
||||||
}
|
|
||||||
else if(theta < 40){
|
|
||||||
Timer->CCR1 = POSITION_40;
|
|
||||||
angleVoileActuel = 40;
|
|
||||||
}
|
|
||||||
else if(theta < 50){
|
|
||||||
Timer->CCR1 = POSITION_50;
|
|
||||||
angleVoileActuel = 50;
|
|
||||||
}
|
|
||||||
else if(theta < 60){
|
|
||||||
Timer->CCR1 = POSITION_60;
|
|
||||||
angleVoileActuel = 60;
|
|
||||||
}
|
|
||||||
else if(theta < 70){
|
|
||||||
Timer->CCR1 = POSITION_70;
|
|
||||||
angleVoileActuel = 70;
|
|
||||||
}
|
|
||||||
else if(theta < 80){
|
|
||||||
Timer->CCR1 = POSITION_80;
|
|
||||||
angleVoileActuel = 80;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Timer->CCR1 = POSITION_90;
|
|
||||||
angleVoileActuel = 90;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
angleVoileActuel = (A_BETA_TO_GAMMA * (float)theta + B_BETA_TO_GAMMA) ;
|
|
||||||
Timer->CCR1 = (int)angleVoileActuel ;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * TensionVoileToString(int theta) {
|
|
||||||
if (theta < 10) {
|
|
||||||
return "Voiles bordees";
|
|
||||||
} else if (theta < 20) {
|
|
||||||
return "Voiles a 20 degres";
|
|
||||||
} else if (theta < 30) {
|
|
||||||
return "Voiles a 30 degres";
|
|
||||||
} else if (theta < 40) {
|
|
||||||
return "Voiles a 40 degres";
|
|
||||||
} else if (theta < 50) {
|
|
||||||
return "Voiles a 50 degres";
|
|
||||||
} else if (theta < 60) {
|
|
||||||
return "Voiles a 60 degres";
|
|
||||||
} else if (theta < 70) {
|
|
||||||
return "Voiles a 70 degres";
|
|
||||||
} else if (theta < 80) {
|
|
||||||
return "Voiles a 80 degres";
|
|
||||||
} else {
|
|
||||||
return "Voiles choquees";
|
|
||||||
}
|
|
||||||
}
|
|
51
Src/Voile.h
51
Src/Voile.h
|
@ -1,51 +0,0 @@
|
||||||
#ifndef VOILE_H
|
|
||||||
#define VOILE_H
|
|
||||||
|
|
||||||
/* PERSONNES QUI ONT TRAVAILLE SUR CE MODULE : ELIES, AURIANE */
|
|
||||||
|
|
||||||
/* RESOLUTION PWM SERVOMOTEUR : 10 POSITIONS POSSIBLES*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configuration du Timer en mode PWM output
|
|
||||||
* @note Timer1 en thérie
|
|
||||||
* @param
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ConfVoile(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Retourne la valeur de l'angle de la voile actuel en degrés
|
|
||||||
* @note
|
|
||||||
* @param
|
|
||||||
* @retval Un angle compris entre 5 et 90 (en degrés) (10 valeurs possibles entre dans [5,10,20,30,40,50,60,70,80,90]
|
|
||||||
*/
|
|
||||||
int RecupTensionVoile(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calcule à partir de l'angle alpha (allure), l'angle theta (de la voile) à avoir
|
|
||||||
* @note Si alpha < 45, on détend la voile (theta = 90)
|
|
||||||
* @param Un entier alpha compris entre 0 et 180
|
|
||||||
* @retval Un angle theta compris entre 0 et 90 degrés (en degrés)
|
|
||||||
*/
|
|
||||||
int CalculerTension(int alpha);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Met à jour le registre CCR1 pour tendre la voile selon theta
|
|
||||||
* @note 10 niveaus possibles pour la résolution PWM.
|
|
||||||
* @param Un entier theta entre 0 et 90
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void TendreVoile(int theta);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Associe un chaine de caractère a une valeur d'angle de voile
|
|
||||||
* @note
|
|
||||||
* @param theta : un entier entre 10 valeurs possibles [5,10,20,30,40,50,60,70,80,90]
|
|
||||||
* @retval Une chaine de caractère représentant l'angle de voile
|
|
||||||
*/
|
|
||||||
char * TensionVoileToString(int theta);
|
|
||||||
|
|
||||||
#endif
|
|
204
Src/Voilier.c
204
Src/Voilier.c
|
@ -1,204 +0,0 @@
|
||||||
#include "Allure.h"
|
|
||||||
#include "Gouvernail.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
|
|
||||||
#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
|
|
||||||
|
|
||||||
|
|
||||||
/* PERSONNES QUI ONT TRAVAILLE SUR CE MODULE : PAUL, ELIES, AURIANE, ELIES */
|
|
||||||
|
|
||||||
|
|
||||||
void SystemClock_Config(void);
|
|
||||||
|
|
||||||
void ConfSysTick(void){
|
|
||||||
SysTick_Config(7200000);
|
|
||||||
NVIC_EnableIRQ(SysTick_IRQn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief configure tous les periphs qu'on va utiliser en appelant les
|
|
||||||
fonctions de config de chaque "module"
|
|
||||||
* @note
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void Setup(){
|
|
||||||
|
|
||||||
ConfSecurite();
|
|
||||||
ConfAllure();
|
|
||||||
ConfVoile();
|
|
||||||
ConfGouvernail();
|
|
||||||
ConfTransmission();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
* @note
|
|
||||||
* @param
|
|
||||||
* @retval
|
|
||||||
*/
|
|
||||||
void Envoi3s(){
|
|
||||||
EnvoiRegulier(AllureToString(RecupAllure()), TensionVoileToString(RecupTensionVoile()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief tache qui va fonctionner en fond qui gere l'orientation
|
|
||||||
des voiles, le gouvernail et aussi le systeme anti-chavirement
|
|
||||||
* @note Le temps d'exécution de cette tache a été mesuré à environ 3.14ms,
|
|
||||||
on peut donc largement la lancer toutes les 100ms en interruption sans risque de trop mobiliser le CPU
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void Task100ms(){
|
|
||||||
|
|
||||||
int dangerRoulis = 0; //Variable qui permet de ne pas tendre les voiles si il y a trop de roulis
|
|
||||||
|
|
||||||
//Anti-Chavirement
|
|
||||||
if(CalculerDangerChavirement(RecupRouli())){//renvoi boolean : int à 0 si faux et 1 si vrai
|
|
||||||
dangerRoulis = 1; //Pour pas retendre directement les voiles juste après.
|
|
||||||
TendreVoile(0); //si il y a danger on relache les voiles (relacher les voiles = les mettre <20> 90)
|
|
||||||
EnvoiExceptionnel("Risque de chavirement, voiles choquees");//Et on prévient l'utilisateur
|
|
||||||
}
|
|
||||||
|
|
||||||
//Anti-Chavirement
|
|
||||||
if(CalculerDangerNiveauBatterie(RecupNiveauBatterie())){//renvoi boolean : int à 0 si faux et 1 si vrai
|
|
||||||
EnvoiExceptionnel("Batterie faible");//Et on prévient l'utilisateur
|
|
||||||
}
|
|
||||||
|
|
||||||
//Voiles
|
|
||||||
if (!dangerRoulis){ //On vérifie qu'il n'y ait pas de roulis avant de tendre les voiles selon l'allure
|
|
||||||
TendreVoile(CalculerTension(RecupAllure())); //on tend la voile grace à la tension obtenue a partir du calcul et de l'allure lue
|
|
||||||
}
|
|
||||||
|
|
||||||
//Gouvernail
|
|
||||||
CommanderMoteur(LireTelecommande()); //On commande le moteur pour aller à la vitesse lue a la télécommande
|
|
||||||
}
|
|
||||||
|
|
||||||
void SysTick_Handler(void) { /* SysTick interrupt Handler. */
|
|
||||||
static int compteur = 0;
|
|
||||||
compteur++;
|
|
||||||
if (compteur == 30) {
|
|
||||||
Envoi3s();
|
|
||||||
compteur = 0;
|
|
||||||
} else {
|
|
||||||
Task100ms();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
|
|
||||||
SystemClock_Config();
|
|
||||||
|
|
||||||
Setup();
|
|
||||||
|
|
||||||
EnvoiExceptionnel("Veuillez faire tourner la girouette SVP.");
|
|
||||||
|
|
||||||
while(!GirouetteInitialisee()) {
|
|
||||||
EnvoyerCaractere();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfSysTick();
|
|
||||||
|
|
||||||
while(1){
|
|
||||||
EnvoyerCaractere();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief System Clock Configuration
|
|
||||||
* The system Clock is configured as follow :
|
|
||||||
* System Clock source = PLL (HSE)
|
|
||||||
* SYSCLK(Hz) = 72000000
|
|
||||||
* HCLK(Hz) = 72000000
|
|
||||||
* AHB Prescaler = 1
|
|
||||||
* APB1 Prescaler = 2
|
|
||||||
* APB2 Prescaler = 1
|
|
||||||
* HSE Frequency(Hz) = 8000000
|
|
||||||
* PLLMUL = 9
|
|
||||||
* Flash Latency(WS) = 2
|
|
||||||
* @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<63>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<75>r<EFBFBD>e
|
|
||||||
|
|
||||||
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
|
|
||||||
LL_SetSystemCoreClock(72000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* METTRE SYSTEMCLOCKCONFIG */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============== BOARD SPECIFIC CONFIGURATION CODE END ============== */
|
|
||||||
|
|
||||||
#ifdef USE_FULL_ASSERT
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reports the name of the source file and the source line number
|
|
||||||
* where the assert_param error has occurred.
|
|
||||||
* @param file: pointer to the source file name
|
|
||||||
* @param line: assert_param error line source number
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void assert_failed(uint8_t *file, uint32_t line)
|
|
||||||
{
|
|
||||||
/* User can add his own implementation to report the file name and line number,
|
|
||||||
ex: printf("Wrong parameters value: file %s on line %d", file, line) */
|
|
||||||
|
|
||||||
/* Infinite loop */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
int abs(int a) {
|
|
||||||
if (a<0) {
|
|
||||||
return -a;
|
|
||||||
} else {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
11
Src/maths.h
11
Src/maths.h
|
@ -1,11 +0,0 @@
|
||||||
#ifndef MATHS_H
|
|
||||||
#define MATHS_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Valeur absolue.
|
|
||||||
* @note Si a < 0 renvoi -a, sinon, a
|
|
||||||
* @param a : un entier
|
|
||||||
* @retval La valeur absolue de a
|
|
||||||
*/
|
|
||||||
int abs(int a);
|
|
||||||
#endif
|
|
20
Src/string.c
20
Src/string.c
|
@ -1,20 +0,0 @@
|
||||||
int Concatenate(char * chaine1, char * chaine2, int sizechaine1, int sizechaine2, int sizemax) {
|
|
||||||
if ((sizechaine1 + sizechaine2 - 1) <= sizemax) {
|
|
||||||
int j;
|
|
||||||
for (j=0; j < sizechaine1; j++) {
|
|
||||||
chaine2[(sizechaine2 - 1 )+ j] = chaine1[j];
|
|
||||||
}
|
|
||||||
return sizechaine1 + sizechaine2 - 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int size_of(char * chaine) {
|
|
||||||
int i = 0;
|
|
||||||
while (chaine[i] != '\0') {
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i+1;
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
#ifndef STRING_H
|
|
||||||
#define STRING_H
|
|
||||||
|
|
||||||
int Concatenate(char * chaine1, char * chaine2, int sizechaine1, int sizechaine2, int sizemax);
|
|
||||||
|
|
||||||
int size_of(char * chaine);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in a new issue