Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion TinyG2/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ static OutputPin<kGRBL_FeedHoldPinNumber> grbl_feedhold_pin;
static OutputPin<kGRBL_CycleStartPinNumber> grbl_cycle_start_pin;

static OutputPin<kGRBL_CommonEnablePinNumber> motor_common_enable_pin;
static OutputPin<kSpindle_EnablePinNumber> spindle_enable_pin;

//Delay driving spindle output enable until we get the polarity setting
static OutputPin<kSpindle_EnablePinNumber> spindle_enable_pin(kNoInit);
static OutputPin<kSpindle_DirPinNumber> spindle_dir_pin;
static PWMOutputPin<kSpindle_PwmPinNumber> spindle_pwm_pin;
static PWMOutputPin<kSpindle_Pwm2PinNumber> secondary_pwm_pin;
Expand Down
2 changes: 2 additions & 0 deletions TinyG2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ void application_init_startup(void)
canonical_machine_reset();
spindle_init(); // should be after PWM and canonical machine inits and config_init()
spindle_reset();
// We delayed driving spindle enable until we know the enable polarity
spindle_enable_pin.init();
// MOVED: report the system is ready is now in xio
}

Expand Down
5 changes: 4 additions & 1 deletion TinyG2/motate/utility/SamPins.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ namespace Motate {

// For use on PWM pins only!
kPWMPinInverted = 1<<7,

// Delay calling init()
kNoInit = 0xffff,
};

enum PinInterruptOptions {
Expand Down Expand Up @@ -201,7 +204,7 @@ namespace Motate {
template<int8_t pinNum>
struct OutputPin : Pin<pinNum> {
OutputPin() : Pin<pinNum>(kOutput) {};
OutputPin(const PinOptions options) : Pin<pinNum>(kOutput, options) {};
OutputPin(const PinOptions options) { if(options!=kNoInit) Pin<pinNum>::init(kOutput, options, true);};
void init(const PinOptions options = kNormal) {Pin<pinNum>::init(kOutput, options);};
uint32_t get() {
return Pin<pinNum>::getOutputValue();
Expand Down