Skip to content

Commit

Permalink
Method for adding defaults using defines for resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
blckmn committed Feb 9, 2023
1 parent 01df7f3 commit 0a22ef5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/pg/motor.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,23 @@ void pgResetFn_motorConfig(motorConfig_t *motorConfig)
for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS; motorIndex++) {
motorConfig->dev.ioTags[motorIndex] = timerioTagGetByUsage(TIM_USE_MOTOR, motorIndex);
}
#else
#ifdef MOTOR1_PIN
motorConfig->dev.ioTags[0] = IO_TAG(MOTOR1_PIN);
#endif
#ifdef MOTOR2_PIN
motorConfig->dev.ioTags[1] = IO_TAG(MOTOR2_PIN);
#endif
#ifdef MOTOR3_PIN
motorConfig->dev.ioTags[2] = IO_TAG(MOTOR3_PIN);
#endif
#ifdef MOTOR4_PIN
motorConfig->dev.ioTags[3] = IO_TAG(MOTOR4_PIN);
#endif
/*
NOTE as we predominantly build for quads, the default motor pin defines is 4,
add more if a specific configuration ever requires it.
*/
#endif

motorConfig->motorPoleCount = 14; // Most brushes motors that we use are 14 poles
Expand Down

0 comments on commit 0a22ef5

Please sign in to comment.