Merge branch 'RF' into develop
This commit is contained in:
commit
1fcc556499
7 changed files with 239 additions and 59 deletions
|
@ -305,7 +305,7 @@
|
||||||
<sDllPa></sDllPa>
|
<sDllPa></sDllPa>
|
||||||
<sDlgDll></sDlgDll>
|
<sDlgDll></sDlgDll>
|
||||||
<sDlgPa></sDlgPa>
|
<sDlgPa></sDlgPa>
|
||||||
<sIfile></sIfile>
|
<sIfile>..\..\inifiles\Simu_Pulse.ini</sIfile>
|
||||||
<tDll></tDll>
|
<tDll></tDll>
|
||||||
<tDllPa></tDllPa>
|
<tDllPa></tDllPa>
|
||||||
<tDlgDll></tDlgDll>
|
<tDlgDll></tDlgDll>
|
||||||
|
@ -317,7 +317,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=504,37,1150,710,0)(110=60,88,280,548,0)(111=752,104,972,564,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=864,64,1285,491,0)(121=892,96,1313,523,0)(122=674,103,1095,530,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=709,11,1303,762,0)(131=736,17,1330,768,0)(132=599,17,1193,768,0)(133=295,17,889,768,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)(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=504,37,1150,710,0)(110=60,88,280,548,0)(111=752,104,972,564,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=874,38,1295,465,0)(121=892,96,1313,523,0)(122=674,103,1095,530,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=517,8,1111,759,0)(131=150,13,744,764,0)(132=599,17,1193,768,0)(133=-1,-1,-1,-1,0)(160=674,53,1122,467,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
@ -350,24 +350,7 @@
|
||||||
<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>25</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134219120</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
|
||||||
<Filename>F:\Etudes\4A\µC - Périphériques\Periph-Voilier\Services\Moteur.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression>\\NUCLEO_F103RB\../Services/Moteur.c\25</Expression>
|
|
||||||
</Bp>
|
|
||||||
</Breakpoint>
|
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
|
@ -379,7 +362,7 @@
|
||||||
<Mm>
|
<Mm>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<SubType>0</SubType>
|
<SubType>0</SubType>
|
||||||
<ItemText>My_GPIO_Init_Struct</ItemText>
|
<ItemText>0x08001778</ItemText>
|
||||||
<AccSizeX>0</AccSizeX>
|
<AccSizeX>0</AccSizeX>
|
||||||
</Mm>
|
</Mm>
|
||||||
</MemoryWindow1>
|
</MemoryWindow1>
|
||||||
|
@ -391,7 +374,7 @@
|
||||||
<periodic>1</periodic>
|
<periodic>1</periodic>
|
||||||
<aLwin>1</aLwin>
|
<aLwin>1</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>0</aSer1>
|
<aSer1>1</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
<aPa>0</aPa>
|
<aPa>0</aPa>
|
||||||
<viewmode>1</viewmode>
|
<viewmode>1</viewmode>
|
||||||
|
@ -428,13 +411,8 @@
|
||||||
<LogicAnalyzers>
|
<LogicAnalyzers>
|
||||||
<Wi>
|
<Wi>
|
||||||
<IntNumber>0</IntNumber>
|
<IntNumber>0</IntNumber>
|
||||||
<FirstString>((porta & 0x00000002) >> 1 & 0x2) >> 1</FirstString>
|
<FirstString>((porta & 0x00000800) >> 11 & 0x800) >> 11</FirstString>
|
||||||
<SecondString>00800000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F0B00000000000000000000000000000000000000320F0008</SecondString>
|
<SecondString>00800000000000000000000000000000E0FFEF400000000000000000000000000000000028706F7274612026203078303030303038303029203E3E2031310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F170000000000000000000000000000000000000076150008</SecondString>
|
||||||
</Wi>
|
|
||||||
<Wi>
|
|
||||||
<IntNumber>1</IntNumber>
|
|
||||||
<FirstString>((porta & 0x00000004) >> 2 & 0x4) >> 2</FirstString>
|
|
||||||
<SecondString>00008000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303030303429203E3E2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F0B00000000000000000000000000000000000000320F0008</SecondString>
|
|
||||||
</Wi>
|
</Wi>
|
||||||
</LogicAnalyzers>
|
</LogicAnalyzers>
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
|
@ -480,8 +458,8 @@
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Services\Moteur.c</PathWithFileName>
|
<PathWithFileName>..\Services\MyRF.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>Moteur.c</FilenameWithoutPath>
|
<FilenameWithoutPath>MyRF.c</FilenameWithoutPath>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
|
@ -517,6 +495,18 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>3</GroupNumber>
|
||||||
|
<FileNumber>5</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\MyDrivers\MyUSART.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>MyUSART.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -527,7 +517,7 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>4</GroupNumber>
|
<GroupNumber>4</GroupNumber>
|
||||||
<FileNumber>5</FileNumber>
|
<FileNumber>6</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -539,7 +529,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>4</GroupNumber>
|
<GroupNumber>4</GroupNumber>
|
||||||
<FileNumber>6</FileNumber>
|
<FileNumber>7</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -551,7 +541,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>4</GroupNumber>
|
<GroupNumber>4</GroupNumber>
|
||||||
<FileNumber>7</FileNumber>
|
<FileNumber>8</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -563,7 +553,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>4</GroupNumber>
|
<GroupNumber>4</GroupNumber>
|
||||||
<FileNumber>8</FileNumber>
|
<FileNumber>9</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -575,7 +565,7 @@
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>4</GroupNumber>
|
<GroupNumber>4</GroupNumber>
|
||||||
<FileNumber>9</FileNumber>
|
<FileNumber>10</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -595,7 +585,7 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>5</GroupNumber>
|
<GroupNumber>5</GroupNumber>
|
||||||
<FileNumber>10</FileNumber>
|
<FileNumber>11</FileNumber>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -615,7 +605,7 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>6</GroupNumber>
|
<GroupNumber>6</GroupNumber>
|
||||||
<FileNumber>11</FileNumber>
|
<FileNumber>12</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@ -635,7 +625,7 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>7</GroupNumber>
|
<GroupNumber>7</GroupNumber>
|
||||||
<FileNumber>12</FileNumber>
|
<FileNumber>13</FileNumber>
|
||||||
<FileType>2</FileType>
|
<FileType>2</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
|
|
@ -393,9 +393,9 @@
|
||||||
<GroupName>User Services</GroupName>
|
<GroupName>User Services</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Moteur.c</FileName>
|
<FileName>MyRF.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Services\Moteur.c</FilePath>
|
<FilePath>..\Services\MyRF.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -412,6 +412,11 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\MyDrivers\MyPWM.c</FilePath>
|
<FilePath>..\MyDrivers\MyPWM.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>MyUSART.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\MyDrivers\MyUSART.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -866,9 +871,9 @@
|
||||||
<GroupName>User Services</GroupName>
|
<GroupName>User Services</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Moteur.c</FileName>
|
<FileName>MyRF.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Services\Moteur.c</FilePath>
|
<FilePath>..\Services\MyRF.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -885,6 +890,11 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\MyDrivers\MyPWM.c</FilePath>
|
<FilePath>..\MyDrivers\MyPWM.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>MyUSART.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\MyDrivers\MyUSART.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
|
|
@ -55,6 +55,7 @@ void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, uint32_t CompareValue, int
|
||||||
else LL_TIM_OC_SetCompareCH4(Timer, CompareValue);
|
else LL_TIM_OC_SetCompareCH4(Timer, CompareValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int MyPWM_Duty_Cycle_Permilles(TIM_TypeDef * Timer, int channel1, int channel2) {
|
int MyPWM_Duty_Cycle_Permilles(TIM_TypeDef * Timer, int channel1, int channel2) {
|
||||||
if(channel1 == LL_TIM_CHANNEL_CH1 && channel2 == LL_TIM_CHANNEL_CH2) {
|
if(channel1 == LL_TIM_CHANNEL_CH1 && channel2 == LL_TIM_CHANNEL_CH2) {
|
||||||
return LL_TIM_IC_GetCaptureCH2(Timer) / LL_TIM_IC_GetCaptureCH1(Timer) * 1000;
|
return LL_TIM_IC_GetCaptureCH2(Timer) / LL_TIM_IC_GetCaptureCH1(Timer) * 1000;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef PWM_H
|
#ifndef MYPWM_H
|
||||||
#define PWM_H
|
#define MYPWM_H
|
||||||
|
|
||||||
#include "stm32f103xb.h"
|
#include "stm32f103xb.h"
|
||||||
|
|
||||||
|
|
158
Services/MyRF.c
Normal file
158
Services/MyRF.c
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
#include "MyRF.h"
|
||||||
|
#include "MyTimer.h"
|
||||||
|
#include "MyPWM.h"
|
||||||
|
#include "MyUSART.h"
|
||||||
|
|
||||||
|
#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges
|
||||||
|
#include "stm32f1xx_ll_tim.h"
|
||||||
|
#include "stm32f1xx_ll_gpio.h"
|
||||||
|
#include "stm32f1xx_ll_usart.h"
|
||||||
|
|
||||||
|
|
||||||
|
void MyRF_Conf(void) {
|
||||||
|
|
||||||
|
//RX
|
||||||
|
//Activation horloge du GPIO
|
||||||
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef My_GPIO_Init_Struct;
|
||||||
|
LL_GPIO_StructInit(&My_GPIO_Init_Struct);
|
||||||
|
|
||||||
|
//PB.6 en floating input
|
||||||
|
My_GPIO_Init_Struct.Pin = PinCH1;
|
||||||
|
LL_GPIO_Init(GPIOIn, &My_GPIO_Init_Struct);
|
||||||
|
|
||||||
|
//PB.7 en floating input
|
||||||
|
My_GPIO_Init_Struct.Pin = PinCH2;
|
||||||
|
LL_GPIO_Init(GPIOIn, &My_GPIO_Init_Struct);
|
||||||
|
|
||||||
|
|
||||||
|
//Configuration et lancment du Timer PWM Input
|
||||||
|
MyTimer_Conf(TimerCC,0xFFAD,0x15);
|
||||||
|
MyPWM_Conf_Input(TimerCC, channelCC1, channelCC2);
|
||||||
|
MyTimer_Start(TimerCC);
|
||||||
|
|
||||||
|
//TX
|
||||||
|
//Activation horloge du GPIO
|
||||||
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
||||||
|
|
||||||
|
LL_GPIO_StructInit(&My_GPIO_Init_Struct);
|
||||||
|
|
||||||
|
//PA.9 en alternate output pp
|
||||||
|
My_GPIO_Init_Struct.Pin = PinOut;
|
||||||
|
My_GPIO_Init_Struct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
My_GPIO_Init_Struct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
LL_GPIO_Init(GPIOOut, &My_GPIO_Init_Struct);
|
||||||
|
|
||||||
|
//PA.11 en output pp
|
||||||
|
My_GPIO_Init_Struct.Pin = PinTXEn;
|
||||||
|
My_GPIO_Init_Struct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
My_GPIO_Init_Struct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
LL_GPIO_Init(GPIOOut, &My_GPIO_Init_Struct);
|
||||||
|
|
||||||
|
//Configuration de l'USART
|
||||||
|
MyUSART_Conf(USARTOut, TransferDirTX);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int MyRF_Input_Duty_Cycle(void) {
|
||||||
|
int duty_cycle_RC = MyPWM_Duty_Cycle_Permilles(TimerCC, channelCC1, channelCC2);
|
||||||
|
if (74<duty_cycle_RC && duty_cycle_RC<77) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (duty_cycle_RC - 75) * 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyRF_Transmit_3s(void) {
|
||||||
|
|
||||||
|
//Récupérer :
|
||||||
|
char bordage[3] = "";
|
||||||
|
char heure[2] = "xx";
|
||||||
|
char min[2] = "xx";
|
||||||
|
char sec[2] = "xx";
|
||||||
|
int allure_ref = 3;
|
||||||
|
|
||||||
|
char allure[7][16]= {"vent debout.",
|
||||||
|
"au plus près.",
|
||||||
|
"au près.",
|
||||||
|
"au bon plein.",
|
||||||
|
"au travers.",
|
||||||
|
"au grand largue.",
|
||||||
|
"au vent arrière."
|
||||||
|
};
|
||||||
|
char data1[14] = "\" - Bordage : ";
|
||||||
|
char data2[24] = " === Le voilier navigue ";
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
//Activation de l'émetteur RF
|
||||||
|
LL_GPIO_SetOutputPin(GPIOOut ,PinTXEn);
|
||||||
|
|
||||||
|
//Heure
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, heure[0]);
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, heure[1]);
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, 'h');
|
||||||
|
//Minutes
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, min[0]);
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, min[1]);
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, '\'');
|
||||||
|
//Secondes
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, sec[0]);
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, sec[1]);
|
||||||
|
//Texte 1 (bordage)
|
||||||
|
for(i=0; i<14; i++) {
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, data1[i]);
|
||||||
|
}
|
||||||
|
//Bordage
|
||||||
|
for(i=0; i<3; i++) {
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, bordage[i]);
|
||||||
|
}
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, '%');
|
||||||
|
//Texte 2 (allure)
|
||||||
|
for(i=0; i<24; i++) {
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, data2[i]);
|
||||||
|
}
|
||||||
|
//Allure
|
||||||
|
for(i=0; i<16; i++) {
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, allure[allure_ref][i]);
|
||||||
|
}
|
||||||
|
//Newline (fin)
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, '\n');
|
||||||
|
|
||||||
|
//Désactivation de l'émetteur RF
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOOut ,PinTXEn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyRF_Transmit_Batterie_Faible(void) {
|
||||||
|
|
||||||
|
//Activation de l'émetteur RF
|
||||||
|
LL_GPIO_SetOutputPin(GPIOOut ,PinTXEn);
|
||||||
|
|
||||||
|
char data[24] = "/!\\ BATTERIE FAIBLE /!\\\n";
|
||||||
|
for(int i = 0; i<24; i++) {
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Désactivation de l'émetteur RF
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOOut ,PinTXEn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyRF_Transmit_Limite_Roulis(void) {
|
||||||
|
|
||||||
|
//Activation de l'émetteur RF
|
||||||
|
LL_GPIO_SetOutputPin(GPIOOut ,PinTXEn);
|
||||||
|
|
||||||
|
char data[30] = "/!\\ RISQUE DE CHAVIREMENT /!\\\n";
|
||||||
|
for(int i = 0; i<30; i++) {
|
||||||
|
MyUSART_Transmit_Data_8b(USARTOut, data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Désactivation de l'émetteur RF
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOOut ,PinTXEn);
|
||||||
|
|
||||||
|
}
|
29
Services/MyRF.h
Normal file
29
Services/MyRF.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef MYRF_H
|
||||||
|
#define MYRF_H
|
||||||
|
|
||||||
|
#include "stm32f103xb.h"
|
||||||
|
|
||||||
|
#define PinCH1 LL_GPIO_PIN_6
|
||||||
|
#define PinCH2 LL_GPIO_PIN_7
|
||||||
|
#define PinOut LL_GPIO_PIN_9
|
||||||
|
#define PinTXEn LL_GPIO_PIN_11
|
||||||
|
#define GPIOIn GPIOB
|
||||||
|
#define GPIOOut GPIOA
|
||||||
|
#define TimerCC TIM4
|
||||||
|
#define channelCC1 LL_TIM_CHANNEL_CH1
|
||||||
|
#define channelCC2 LL_TIM_CHANNEL_CH2
|
||||||
|
#define USARTOut USART1
|
||||||
|
#define TransferDirTX LL_USART_DIRECTION_TX
|
||||||
|
|
||||||
|
|
||||||
|
void MyRF_Conf(void);
|
||||||
|
|
||||||
|
int MyRF_Duty_Cycle_Moteur(void);
|
||||||
|
|
||||||
|
void MyRF_Transmit_3s(void);
|
||||||
|
|
||||||
|
void MyRF_Transmit_Batterie_Faible(void);
|
||||||
|
|
||||||
|
void MyRF_Transmit_Limite_Roulis(void);
|
||||||
|
|
||||||
|
#endif
|
18
Src/main.c
18
Src/main.c
|
@ -22,7 +22,7 @@
|
||||||
#include "stm32f1xx_ll_gpio.h"
|
#include "stm32f1xx_ll_gpio.h"
|
||||||
#include "MyTimer.h"
|
#include "MyTimer.h"
|
||||||
#include "MyPWM.h"
|
#include "MyPWM.h"
|
||||||
#include "Moteur.h"
|
#include "MyRF.h"
|
||||||
|
|
||||||
void SystemClock_Config(void);
|
void SystemClock_Config(void);
|
||||||
|
|
||||||
|
@ -40,22 +40,14 @@ int main(void)
|
||||||
/* Configure the system clock to 72 MHz */
|
/* Configure the system clock to 72 MHz */
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
|
|
||||||
/*===Test Moteur===*/
|
MyRF_Conf();
|
||||||
|
|
||||||
//INIT GPIO MARCHE PAS->PB PIN
|
for(int i=0; i<0xCFFF; i++) {
|
||||||
Moteur_Conf();
|
|
||||||
|
|
||||||
Moteur_Speed(30);
|
|
||||||
Moteur_Sens(0);
|
|
||||||
|
|
||||||
/* Infinite loop */
|
|
||||||
for (int i =0; i<0xFFFF; i++)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Moteur_Speed(60);
|
MyRF_Transmit_3s();
|
||||||
Moteur_Sens(1);
|
|
||||||
|
|
||||||
|
/* Infinite loop */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue