From 35064b53e99f2af984ee46a6d5e4f7aea27ec782 Mon Sep 17 00:00:00 2001 From: Simen Svale Skogsrud Date: Tue, 25 Jan 2011 23:33:19 +0100 Subject: [PATCH] made local variables static --- gcode.c | 2 +- serial_protocol.c | 4 ++-- stepper.c | 22 +++++++++++----------- stepper_plan.c | 5 +++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gcode.c b/gcode.c index 323b8a8..10ccad4 100644 --- a/gcode.c +++ b/gcode.c @@ -89,7 +89,7 @@ typedef struct { int16_t spindle_speed; /* RPM/100 */ uint8_t plane_axis_0, plane_axis_1, plane_axis_2; // The axes of the selected plane } parser_state_t; -parser_state_t gc; +static parser_state_t gc; #define FAIL(status) gc.status_code = status; diff --git a/serial_protocol.c b/serial_protocol.c index 25fca16..6e6fd75 100644 --- a/serial_protocol.c +++ b/serial_protocol.c @@ -28,8 +28,8 @@ #include #define LINE_BUFFER_SIZE 50 -char line[LINE_BUFFER_SIZE]; -uint8_t char_counter; +static char line[LINE_BUFFER_SIZE]; +static uint8_t char_counter; void prompt() { printPgmString(PSTR("ok\r\n")); diff --git a/stepper.c b/stepper.c index 834696a..a73ac14 100644 --- a/stepper.c +++ b/stepper.c @@ -39,21 +39,21 @@ void set_step_events_per_minute(uint32_t steps_per_minute); #define MINIMUM_STEPS_PER_MINUTE 1200 #define CYCLES_PER_ACCELERATION_TICK ((TICKS_PER_MICROSECOND*1000000)/ACCELERATION_TICKS_PER_SECOND) -block_t *current_block; // A convenience pointer to the block currently being traced +static block_t *current_block; // A convenience pointer to the block currently being traced // Variables used by The Stepper Driver Interrupt -uint8_t out_bits; // The next stepping-bits to be output -int32_t counter_x, - counter_y, - counter_z; // counter variables for the bresenham line tracer -uint32_t step_events_completed; // The number of step events executed in the current block -volatile int busy; // TRUE when SIG_OUTPUT_COMPARE1A is being serviced. Used to avoid retriggering that handler. +static uint8_t out_bits; // The next stepping-bits to be output +static int32_t counter_x, // Counter variables for the bresenham line tracer + counter_y, + counter_z; +static uint32_t step_events_completed; // The number of step events executed in the current block +volatile int busy; // TRUE when SIG_OUTPUT_COMPARE1A is being serviced. Used to avoid retriggering that handler. // Variables used by the trapezoid generation -uint32_t cycles_per_step_event; // The number of machine cycles between each step event -uint32_t trapezoid_tick_cycle_counter; // The cycles since last trapezoid_tick. Used to generate ticks at a steady - // pace without allocating a separate timer -uint32_t trapezoid_adjusted_rate; // The current rate of step_events according to the trapezoid generator +static uint32_t cycles_per_step_event; // The number of machine cycles between each step event +static uint32_t trapezoid_tick_cycle_counter; // The cycles since last trapezoid_tick. Used to generate ticks at a steady + // pace without allocating a separate timer +static uint32_t trapezoid_adjusted_rate; // The current rate of step_events according to the trapezoid generator // Two trapezoids: // __________________________ diff --git a/stepper_plan.c b/stepper_plan.c index 0d6a7c2..613e745 100644 --- a/stepper_plan.c +++ b/stepper_plan.c @@ -60,10 +60,11 @@ #include "config.h" #include "wiring_serial.h" -block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions +block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions volatile int block_buffer_head; // Index of the next block to be pushed volatile int block_buffer_tail; // Index of the block to process now -uint8_t acceleration_management; // Acceleration management active? + +static uint8_t acceleration_management; // Acceleration management active? // NOTE: See bottom of this module for a comment outlining the reasoning behind the mathematics of the