@@ -224,6 +224,20 @@ void motorsInit(const MotorPerifDef** motorMapSelect)
224
224
225
225
DEBUG_PRINT ("Using %s motor driver\n" , motorMap [0 ]-> drvType == BRUSHED ? "brushed" : "brushless" );
226
226
227
+ if (motorMap [MOTOR_M1 ]-> hasPC15ESCReset )
228
+ {
229
+ MOTORS_RCC_GPIO_CMD (RCC_AHB1Periph_GPIOC , ENABLE );
230
+ // Configure the GPIO for CF-BL ESC RST
231
+ GPIO_StructInit (& GPIO_InitStructure );
232
+ GPIO_InitStructure .GPIO_Mode = GPIO_Mode_OUT ;
233
+ GPIO_InitStructure .GPIO_OType = GPIO_OType_OD ;
234
+ GPIO_InitStructure .GPIO_Speed = GPIO_Speed_2MHz ;
235
+ GPIO_InitStructure .GPIO_Pin = GPIO_Pin_15 ;
236
+ GPIO_Init (GPIOC , & GPIO_InitStructure );
237
+ // Hold reset for all CF-BL ESC:s by pulling low.
238
+ GPIO_WriteBit (GPIOC , GPIO_Pin_15 , Bit_RESET );
239
+ }
240
+
227
241
for (i = 0 ; i < NBR_OF_MOTORS ; i ++ )
228
242
{
229
243
//Clock the gpio and the timers
@@ -243,16 +257,6 @@ void motorsInit(const MotorPerifDef** motorMapSelect)
243
257
GPIO_WriteBit (motorMap [i ]-> gpioPowerswitchPort , motorMap [i ]-> gpioPowerswitchPin , 1 );
244
258
}
245
259
246
- // Configure the GPIO for CF-BL ESC RST
247
- GPIO_StructInit (& GPIO_InitStructure );
248
- GPIO_InitStructure .GPIO_Mode = GPIO_Mode_OUT ;
249
- GPIO_InitStructure .GPIO_OType = GPIO_OType_OD ;
250
- GPIO_InitStructure .GPIO_Speed = GPIO_Speed_2MHz ;
251
- GPIO_InitStructure .GPIO_Pin = GPIO_Pin_15 ;
252
- GPIO_Init (GPIOC , & GPIO_InitStructure );
253
- // Hold reset for all CF-BL ESC:s by pulling low.
254
- GPIO_WriteBit (GPIOC , GPIO_Pin_15 , Bit_RESET );
255
-
256
260
// Configure the GPIO for the timer output
257
261
GPIO_StructInit (& GPIO_InitStructure );
258
262
GPIO_InitStructure .GPIO_Mode = MOTORS_GPIO_MODE ;
@@ -283,9 +287,11 @@ void motorsInit(const MotorPerifDef** motorMapSelect)
283
287
motorMap [i ]-> ocInit (motorMap [i ]-> tim , & TIM_OCInitStructure );
284
288
motorMap [i ]-> preloadConfig (motorMap [i ]-> tim , TIM_OCPreload_Enable );
285
289
}
290
+
286
291
#ifdef CONFIG_MOTORS_ESC_PROTOCOL_DSHOT
287
292
motorsDshotDMASetup ();
288
293
#endif
294
+
289
295
// Start the timers
290
296
for (i = 0 ; i < NBR_OF_MOTORS ; i ++ )
291
297
{
@@ -296,9 +302,12 @@ void motorsInit(const MotorPerifDef** motorMapSelect)
296
302
297
303
// Output zero power
298
304
motorsStop ();
299
- // Release reset for all CF-BL ESC:s after motor signal is activated
300
- GPIO_WriteBit (GPIOC , GPIO_Pin_15 , Bit_SET );
301
305
306
+ if (motorMap [MOTOR_M1 ]-> hasPC15ESCReset )
307
+ {
308
+ // Release reset for all CF-BL ESC:s after motor signal is activated
309
+ GPIO_WriteBit (GPIOC , GPIO_Pin_15 , Bit_SET );
310
+ }
302
311
}
303
312
304
313
void motorsDeInit (const MotorPerifDef * * motorMapSelect )
0 commit comments