Version Fonctionnelle : Girouette + Voiles + Prog principal (reste coefs a mettre en place)
This commit is contained in:
parent
89eebec4e3
commit
b0f9aa410b
7 changed files with 873 additions and 596 deletions
|
@ -103,7 +103,7 @@
|
|||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>0</nTsel>
|
||||
<nTsel>6</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
|
@ -114,7 +114,7 @@
|
|||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
|
@ -130,7 +130,7 @@
|
|||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGTARM</Key>
|
||||
<Name>(1010=668,263,1044,820,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1027,281,1448,686,0)(121=-1,-1,-1,-1,0)(122=348,235,769,640,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=87,183,486,528,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=784,58,1378,752,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
<Name>(1010=668,263,1044,820,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1027,281,1448,686,0)(121=-1,-1,-1,-1,0)(122=348,235,769,640,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=87,183,486,528,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=621,97,1215,791,0)(131=-1,-1,-1,-1,0)(132=784,58,1378,752,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
@ -145,7 +145,7 @@
|
|||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>-UAny -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
@ -157,38 +157,6 @@
|
|||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>59</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134218250</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>..\Src\Allure.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\NUCLEO_F103RB\../Src/Allure.c\59</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>1</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>93</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134218278</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>..\Src\Allure.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\NUCLEO_F103RB\../Src/Allure.c\93</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>2</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>56</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
|
@ -198,11 +166,18 @@
|
|||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\Src\Allure.c</Filename>
|
||||
<Filename>startup_stm32f103xb.s</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>allure</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
|
@ -223,7 +198,7 @@
|
|||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>1</aLa>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
|
@ -400,7 +375,7 @@
|
|||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>C:\Users\Hp\Documents\ProjetVoilier\Projet_Voilier_4IR\MyDrivers\MyTimer.c</Filename>
|
||||
<Filename>..\MyDrivers\MyTimer.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\NUCLEO_F103RB\../MyDrivers/MyTimer.c\99</Expression>
|
||||
</Bp>
|
||||
|
@ -485,7 +460,7 @@
|
|||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>1</aLa>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
|
@ -510,8 +485,8 @@
|
|||
<LogicAnalyzers>
|
||||
<Wi>
|
||||
<IntNumber>0</IntNumber>
|
||||
<FirstString>((PORTA & 0x00000100) >> 8 & 0x100) >> 8</FirstString>
|
||||
<SecondString>FF0000000000000000000000000000000000F03F0100000000000000000000000000000028504F5254412026203078303030303031303029203E3E2038000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000AC030008</SecondString>
|
||||
<FirstString>((TIM_TypeDef *)(0x40000000UL + 0x00000000UL))->CNT</FirstString>
|
||||
<SecondString>FF0000000000000000000000000000000000594000000000000000000000000000000000282854494D5F54797065446566202A292830783430303030303030554C202B2030783030303030303030554C29292D3E434E5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F1000000000000000000000000000000000000000B6020008</SecondString>
|
||||
</Wi>
|
||||
</LogicAnalyzers>
|
||||
<DebugDescription>
|
||||
|
@ -557,6 +532,18 @@
|
|||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<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>
|
||||
<FilenameWithoutPath>Allure.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@ -564,7 +551,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -576,7 +563,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -588,7 +575,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -600,7 +587,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -612,7 +599,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -624,7 +611,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -636,19 +623,43 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\MyTimer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>MyTimer.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Src\Allure.h</PathWithFileName>
|
||||
<FilenameWithoutPath>Allure.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\MyDrivers\MyTimer.h</PathWithFileName>
|
||||
<FilenameWithoutPath>MyTimer.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\maths.h</PathWithFileName>
|
||||
<FilenameWithoutPath>maths.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -668,7 +679,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -680,7 +691,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -692,7 +703,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -704,7 +715,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -716,7 +727,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -744,7 +755,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -764,7 +775,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
File diff suppressed because it is too large
Load diff
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
|
|
@ -4,7 +4,6 @@
|
|||
#include "stm32f1xx_ll_tim.h" // TIMER
|
||||
#include "stm32f1xx_ll_exti.h" // External Interrup
|
||||
|
||||
int allure;
|
||||
int initialized = 0;
|
||||
|
||||
/**
|
||||
|
@ -60,9 +59,9 @@ void ConfAllure(void) {
|
|||
|
||||
int RecupAllure(void) {
|
||||
if (!initialized) {
|
||||
return -1000;
|
||||
return 10000;
|
||||
} else {
|
||||
return ((int)LL_TIM_GetCounter(TIM3)) - 180;
|
||||
return ((int)LL_TIM_GetCounter(TIM3)) * 50;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,13 +39,14 @@ int RecupTension(void){
|
|||
|
||||
|
||||
int CalculerTension(int alpha){
|
||||
if (abs(alpha) > 45){
|
||||
return alpha;
|
||||
/*if (abs(alpha) > 45){
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
int res = alpha * coefa + coefb;
|
||||
return res;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
|
139
Src/Voilier.c
139
Src/Voilier.c
|
@ -11,46 +11,8 @@
|
|||
#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void SystemClock_Config(void);
|
||||
|
||||
/**
|
||||
* @brief configure tous les periphs qu'on va utiliser en appelant les
|
||||
|
@ -60,7 +22,6 @@ void SystemClock_Config(void)
|
|||
* @retval None
|
||||
*/
|
||||
void Setup(){
|
||||
SystemClock_Config();
|
||||
//ConfAntiChavirement();
|
||||
ConfAllure();
|
||||
ConfVoile();
|
||||
|
@ -95,7 +56,7 @@ void Background(){
|
|||
//Voiles
|
||||
int allure = RecupAllure(); //on recupere l'allulre via la girouette
|
||||
int tensionVoile = CalculerTension(allure); //grace à l'allure on peut calculer la tension à appliquer sur la voile
|
||||
TendreVoile(tensionVoile); //on tend la voile grâce à la tension obtenue
|
||||
TendreVoile(CalculerTension(RecupAllure())); //on tend la voile grâce à la tension obtenue
|
||||
|
||||
//Gouvernail
|
||||
/*int valeurTelecommande = LireTelecommande(); //on lit la valeur renvoyée par la télécommande
|
||||
|
@ -112,8 +73,104 @@ void Background(){
|
|||
}
|
||||
|
||||
int main(){
|
||||
|
||||
SystemClock_Config();
|
||||
|
||||
Setup();
|
||||
|
||||
while(1){
|
||||
Background();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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éo*********************************
|
||||
LL_RCC_HSE_EnableBypass();
|
||||
LL_RCC_HSE_Enable();
|
||||
while(LL_RCC_HSE_IsReady() != 1)
|
||||
{
|
||||
};
|
||||
|
||||
/* Main PLL configuration and activation */
|
||||
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9);
|
||||
|
||||
LL_RCC_PLL_Enable();
|
||||
while(LL_RCC_PLL_IsReady() != 1)
|
||||
{
|
||||
};
|
||||
|
||||
/* Sysclk activation on the main PLL */
|
||||
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
|
||||
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
|
||||
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
|
||||
{
|
||||
};
|
||||
|
||||
/* Set APB1 & APB2 prescaler*/
|
||||
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2);
|
||||
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
|
||||
|
||||
/* Set systick to 1ms in using frequency set to 72MHz */
|
||||
//LL_Init1msTick(72000000); !! décommenter que si l'IT est récupérée
|
||||
|
||||
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
|
||||
LL_SetSystemCoreClock(72000000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ============== 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****/
|
||||
|
||||
|
|
Loading…
Reference in a new issue