Skip to content

Commit

Permalink
6 motors for Arduino Due
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch Bradley committed Feb 9, 2019
1 parent 911c054 commit b93e221
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 37 deletions.
42 changes: 23 additions & 19 deletions g2core/board/ArduinoDue/board_stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,31 @@ StepDirStepper<Motate::kSocket4_StepPinNumber,
Motate::kSocket4_VrefPinNumber>
motor_4{M4_STEP_POLARITY, M4_ENABLE_POLARITY};

// StepDirStepper<
// Motate::kSocket5_StepPinNumber,
// Motate::kSocket5_DirPinNumber,
// Motate::kSocket5_EnablePinNumber,
// Motate::kSocket5_Microstep_0PinNumber,
// Motate::kSocket5_Microstep_1PinNumber,
// Motate::kSocket5_Microstep_2PinNumber,
// Motate::kSocket5_VrefPinNumber>
// motor_5 {M5_STEP_POLARITY, M5_ENABLE_POLARITY};
#if (MOTORS >= 5)
StepDirStepper<
Motate::kSocket5_StepPinNumber,
Motate::kSocket5_DirPinNumber,
Motate::kSocket5_EnablePinNumber,
Motate::kSocket5_Microstep_0PinNumber,
Motate::kSocket5_Microstep_1PinNumber,
Motate::kSocket5_Microstep_2PinNumber,
Motate::kSocket5_VrefPinNumber>
motor_5 {M5_STEP_POLARITY, M5_ENABLE_POLARITY};
#endif

// StepDirStepper<
// Motate::kSocket6_StepPinNumber,
// Motate::kSocket6_DirPinNumber,
// Motate::kSocket6_EnablePinNumber,
// Motate::kSocket6_Microstep_0PinNumber,
// Motate::kSocket6_Microstep_1PinNumber,
// Motate::kSocket6_Microstep_2PinNumber,
// Motate::kSocket6_VrefPinNumber>
// motor_6 {M6_STEP_POLARITY, M6_ENABLE_POLARITY};
#if (MOTORS >= 6)
StepDirStepper<
Motate::kSocket6_StepPinNumber,
Motate::kSocket6_DirPinNumber,
Motate::kSocket6_EnablePinNumber,
Motate::kSocket6_Microstep_0PinNumber,
Motate::kSocket6_Microstep_1PinNumber,
Motate::kSocket6_Microstep_2PinNumber,
Motate::kSocket6_VrefPinNumber>
motor_6 {M6_STEP_POLARITY, M6_ENABLE_POLARITY};
#endif

Stepper* Motors[MOTORS] = {&motor_1, &motor_2, &motor_3, &motor_4};
Stepper* Motors[MOTORS] = {&motor_1, &motor_2, &motor_3, &motor_4, &motor_5, &motor_6};

void board_stepper_init() {
for (uint8_t motor = 0; motor < MOTORS; motor++) { Motors[motor]->init(); }
Expand Down
38 changes: 21 additions & 17 deletions g2core/board/ArduinoDue/board_stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,30 @@ extern StepDirStepper<Motate::kSocket4_StepPinNumber,
Motate::kSocket4_VrefPinNumber>
motor_4;

// extern StepDirStepper<
// Motate::kSocket5_StepPinNumber,
// Motate::kSocket5_DirPinNumber,
// Motate::kSocket5_EnablePinNumber,
// Motate::kSocket5_Microstep_0PinNumber,
// Motate::kSocket5_Microstep_1PinNumber,
// Motate::kSocket5_Microstep_2PinNumber,
// Motate::kSocket5_VrefPinNumber> motor_5;
#if (MOTORS >= 5)
extern StepDirStepper<Motate::kSocket5_StepPinNumber,
Motate::kSocket5_DirPinNumber,
Motate::kSocket5_EnablePinNumber,
Motate::kSocket5_Microstep_0PinNumber,
Motate::kSocket5_Microstep_1PinNumber,
Motate::kSocket5_Microstep_2PinNumber,
Motate::kSocket5_VrefPinNumber>
motor_5;
#endif

// extern StepDirStepper<
// Motate::kSocket6_StepPinNumber,
// Motate::kSocket6_DirPinNumber,
// Motate::kSocket6_EnablePinNumber,
// Motate::kSocket6_Microstep_0PinNumber,
// Motate::kSocket6_Microstep_1PinNumber,
// Motate::kSocket6_Microstep_2PinNumber,
// Motate::kSocket6_VrefPinNumber> motor_6 {};
#if (MOTORS >= 6)
extern StepDirStepper<Motate::kSocket6_StepPinNumber,
Motate::kSocket6_DirPinNumber,
Motate::kSocket6_EnablePinNumber,
Motate::kSocket6_Microstep_0PinNumber,
Motate::kSocket6_Microstep_1PinNumber,
Motate::kSocket6_Microstep_2PinNumber,
Motate::kSocket6_VrefPinNumber>
motor_6;
#endif

extern Stepper* Motors[MOTORS];

void board_stepper_init();

#endif // BOARD_STEPPER_H_ONCE
#endif // BOARD_STEPPER_H_ONCE
2 changes: 1 addition & 1 deletion g2core/board/ArduinoDue/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// These must be defines (not enums) so expressions like this:
// #if (MOTORS >= 6) will work

#define MOTORS 4 // number of motors supported the hardware
#define MOTORS 6 // number of motors supported the hardware
#define PWMS 2 // number of PWM channels supported the hardware

/*************************
Expand Down

0 comments on commit b93e221

Please sign in to comment.