From 1c4097352dd089d6c445db491e76cc5dc9d4b6f7 Mon Sep 17 00:00:00 2001 From: Rob Brown Date: Fri, 3 Jan 2014 19:35:56 +0800 Subject: [PATCH] Update to fix compile error Update to fix compile error --- spindle_control.c | 10 +++++++++- spindle_control.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/spindle_control.c b/spindle_control.c index 5dfab0b..813ee8a 100644 --- a/spindle_control.c +++ b/spindle_control.c @@ -25,7 +25,10 @@ static uint8_t current_direction; static uint16_t current_rpm; -static uint8_t current_pwm; + +#ifdef VARIABLE_SPINDLE +static uint8_t current_pwm; // Stores the PWM set by the S value +#endif void spindle_init() { @@ -86,12 +89,17 @@ void spindle_run(int8_t direction, uint16_t rpm) { } } +#ifdef VARIABLE_SPINDLE uint8_t spindle_pwm() { + // This function can be used by the st_prep_buffer() to calculate what the spindle speed vs travel speed return current_pwm; } void spindle_pwm_update(uint8_t pwm) { + // This function can be used by the stepper interrupt to set the spindle speed OCR_REGISTER = pwm; + } +#endif \ No newline at end of file diff --git a/spindle_control.h b/spindle_control.h index 4af96f1..9e4384f 100644 --- a/spindle_control.h +++ b/spindle_control.h @@ -27,7 +27,10 @@ void spindle_init(); void spindle_run(int8_t direction, uint16_t rpm); void spindle_stop(); + +#ifdef VARIABLE_SPINDLE uint8_t spindle_pwm(); void spindle_pwm_update(uint8_t pwm); +#endif #endif