Browse Source

Ajout activation/desact. module RF (PA.11)

Neluji 3 years ago
parent
commit
d91e0bc8ed
5 changed files with 38 additions and 10 deletions
  1. 3
    3
      MDK-ARM/Project.uvoptx
  2. 1
    0
      MyDrivers/MyPWM.c
  3. 29
    6
      Services/MyRF.c
  4. 0
    1
      Services/MyRF.h
  5. 5
    0
      Src/main.c

+ 3
- 3
MDK-ARM/Project.uvoptx View File

@@ -317,7 +317,7 @@
317 317
         <SetRegEntry>
318 318
           <Number>0</Number>
319 319
           <Key>DLGDARM</Key>
320
-          <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=521,17,1115,768,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>
320
+          <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>
321 321
         </SetRegEntry>
322 322
         <SetRegEntry>
323 323
           <Number>0</Number>
@@ -411,8 +411,8 @@
411 411
       <LogicAnalyzers>
412 412
         <Wi>
413 413
           <IntNumber>0</IntNumber>
414
-          <FirstString>((porta &amp; 0x00000200) &gt;&gt; 9 &amp; 0x200) &gt;&gt; 9</FirstString>
415
-          <SecondString>00008000000000000000000000000000E0FFEF400200000000000000000000000000000028706F7274612026203078303030303032303029203E3E2039000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000900000001000000000000000000F03F17000000000000000000000000000000000000003E160008</SecondString>
414
+          <FirstString>((porta &amp; 0x00000800) &gt;&gt; 11 &amp; 0x800) &gt;&gt; 11</FirstString>
415
+          <SecondString>00800000000000000000000000000000E0FFEF400000000000000000000000000000000028706F7274612026203078303030303038303029203E3E2031310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F170000000000000000000000000000000000000076150008</SecondString>
416 416
         </Wi>
417 417
       </LogicAnalyzers>
418 418
       <DebugDescription>

+ 1
- 0
MyDrivers/MyPWM.c View File

@@ -55,6 +55,7 @@ void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, uint32_t CompareValue, int
55 55
 	else  LL_TIM_OC_SetCompareCH4(Timer, CompareValue);
56 56
 }
57 57
 
58
+
58 59
 int MyPWM_Duty_Cycle_Permilles(TIM_TypeDef * Timer, int channel1, int channel2) {
59 60
 	if(channel1 == LL_TIM_CHANNEL_CH1 && channel2 == LL_TIM_CHANNEL_CH2) {
60 61
 		return LL_TIM_IC_GetCaptureCH2(Timer) / LL_TIM_IC_GetCaptureCH1(Timer) * 1000;

+ 29
- 6
Services/MyRF.c View File

@@ -43,16 +43,16 @@ void MyRF_Conf(void) {
43 43
 	My_GPIO_Init_Struct.Mode = LL_GPIO_MODE_ALTERNATE;
44 44
 	My_GPIO_Init_Struct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
45 45
 	LL_GPIO_Init(GPIOOut, &My_GPIO_Init_Struct);
46
+	
47
+	//PA.11 en output pp
48
+	My_GPIO_Init_Struct.Pin = PinTXEn;
49
+	My_GPIO_Init_Struct.Mode = LL_GPIO_MODE_OUTPUT;
50
+	My_GPIO_Init_Struct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
51
+	LL_GPIO_Init(GPIOOut, &My_GPIO_Init_Struct);
46 52
 
47 53
 	//Configuration de l'USART
48 54
 	MyUSART_Conf(USARTOut, TransferDirTX);
49 55
 	
50
-	//Configuration Timer (interruption à 3s, callback MyRF_Transmit_3s) et lancement
51
-	MyTimer_Conf(TimerRF,65533,3295);
52
-	MyTimer_IT_Conf(TimerRF,MyRF_Transmit_3s,3);
53
-	MyTimer_IT_Enable(TimerRF);
54
-	MyTimer_Start(TimerRF);
55
-	
56 56
 }
57 57
 
58 58
 int MyRF_Input_Duty_Cycle(void) {
@@ -87,6 +87,10 @@ void MyRF_Transmit_3s(void) {
87 87
 	
88 88
 	int i;
89 89
 	
90
+	
91
+	//Activation de l'émetteur RF
92
+	LL_GPIO_SetOutputPin(GPIOOut ,PinTXEn);
93
+	
90 94
 	//Heure
91 95
 	MyUSART_Transmit_Data_8b(USARTOut, heure[0]);
92 96
 	MyUSART_Transmit_Data_8b(USARTOut, heure[1]);
@@ -118,18 +122,37 @@ void MyRF_Transmit_3s(void) {
118 122
 	//Newline (fin)
119 123
 	MyUSART_Transmit_Data_8b(USARTOut, '\n');
120 124
 	
125
+	//Désactivation de l'émetteur RF
126
+	LL_GPIO_ResetOutputPin(GPIOOut ,PinTXEn);
127
+	
121 128
 }
122 129
 
123 130
 void MyRF_Transmit_Batterie_Faible(void) {
131
+	
132
+	//Activation de l'émetteur RF
133
+	LL_GPIO_SetOutputPin(GPIOOut ,PinTXEn);
134
+	
124 135
 	char data[24] = "/!\\ BATTERIE FAIBLE /!\\\n";
125 136
 	for(int i = 0; i<24; i++) {
126 137
 		MyUSART_Transmit_Data_8b(USARTOut, data[i]);
127 138
 	}
139
+	
140
+	//Désactivation de l'émetteur RF
141
+	LL_GPIO_ResetOutputPin(GPIOOut ,PinTXEn);
142
+	
128 143
 }
129 144
 
130 145
 void MyRF_Transmit_Limite_Roulis(void) {
146
+	
147
+	//Activation de l'émetteur RF
148
+	LL_GPIO_SetOutputPin(GPIOOut ,PinTXEn);
149
+	
131 150
 	char data[30] = "/!\\ RISQUE DE CHAVIREMENT /!\\\n";
132 151
 	for(int i = 0; i<30; i++) {
133 152
 		MyUSART_Transmit_Data_8b(USARTOut, data[i]);
134 153
 	}
154
+	
155
+	//Désactivation de l'émetteur RF
156
+	LL_GPIO_ResetOutputPin(GPIOOut ,PinTXEn);
157
+	
135 158
 }

+ 0
- 1
Services/MyRF.h View File

@@ -14,7 +14,6 @@
14 14
 #define channelCC2 LL_TIM_CHANNEL_CH2
15 15
 #define USARTOut USART1
16 16
 #define TransferDirTX LL_USART_DIRECTION_TX
17
-#define TimerRF TIM1
18 17
 
19 18
 
20 19
 void MyRF_Conf(void);

+ 5
- 0
Src/main.c View File

@@ -41,6 +41,11 @@ int main(void)
41 41
   SystemClock_Config();
42 42
 	
43 43
 	MyRF_Conf();
44
+	
45
+	for(int i=0; i<0xCFFF; i++) {
46
+	}
47
+	
48
+	MyRF_Transmit_3s();
44 49
   
45 50
   /* Infinite loop */
46 51
   while (1)

Loading…
Cancel
Save