Dependencies:
USBDevice
mbed
« Back to documentation index
SMC.cpp File Reference
Stepper motor control module uses 1/8 microstepping.
More...
Go to the source code of this file.
static volatile int smc_walker = 0
Motor control LUT index.
static volatile int smc_dir = 1
Director in lookup table (unused)
static volatile int smc_steps = -1
Remaining steps.
static volatile int smc_free = 1
Argument to free motor when done.
static volatile int smc_abort = 0
Set when motor control should quit by itself.
static volatile int smc_steptime = 0
Time used to make 1 step.
static volatile int smc_isPaused = 0
Boolean for paused state of control.
DigitalOut HIFET_1 (P0_16)
Hi Side FET 1 of bridge 1.
DigitalOut HIFET_2 (P0_17)
Hi Side FET 2 of bridge 1.
DigitalOut HIFET_3 (P0_18)
Hi Side FET 3 of bridge 2.
DigitalOut HIFET_4 (P0_19)
Hi Side FET 4 of bridge 2.
void SMC_init (void)
Initializes Stepper Motor Control.
void SMC_deinit (void)
De-Initializes Stepper Motor Control.
void SMC_routine (void)
Routine called by interrupt to modify H-Bridge states.
int SMC_step (int steps, uint8_t dir, uint32_t time_ms, uint8_t free)
Stepper motor control main command.
uint32_t SMC_idle (void)
Return 1 of stepper motor control is idle.
void SMC_brake (void)
Puts motor in brake mode, enable all low-side mosfets.
void SMC_free (void)
Puts motor in free mode, disables all mosfets.
void SMC_pause (void)
Pause current stepping command.
void SMC_continue (void)
Continue from pause.
int SMC_getState (void)
Return remaining steps, negative if paused.
void SMC_egg (void)
Egg, open it to find out.
Detailed Description
Stepper motor control module uses 1/8 microstepping.
Author: Jeroen Lodder
Date: Oktober 2013
Definition in file SMC.cpp .
Function Documentation
DigitalOut HIFET_1
(
P0_16
)
Hi Side FET 1 of bridge 1.
DigitalOut HIFET_2
(
P0_17
)
Hi Side FET 2 of bridge 1.
DigitalOut HIFET_3
(
P0_18
)
Hi Side FET 3 of bridge 2.
DigitalOut HIFET_4
(
P0_19
)
Hi Side FET 4 of bridge 2.
Puts motor in brake mode, enable all low-side mosfets.
Definition at line 229 of file SMC.cpp .
void SMC_continue
(
void
)
Continue from pause.
Definition at line 265 of file SMC.cpp .
De-Initializes Stepper Motor Control.
Definition at line 53 of file SMC.cpp .
Egg, open it to find out.
Definition at line 289 of file SMC.cpp .
Puts motor in free mode, disables all mosfets.
Definition at line 242 of file SMC.cpp .
int SMC_getState
(
void
)
Return remaining steps, negative if paused.
Definition at line 275 of file SMC.cpp .
uint32_t SMC_idle
(
void
)
Return 1 of stepper motor control is idle.
Definition at line 219 of file SMC.cpp .
Initializes Stepper Motor Control.
Definition at line 36 of file SMC.cpp .
Pause current stepping command.
Definition at line 255 of file SMC.cpp .
void SMC_routine
(
void
)
Routine called by interrupt to modify H-Bridge states.
Definition at line 73 of file SMC.cpp .
int SMC_step
(
int
steps ,
uint8_t
dir ,
uint32_t
time_ms ,
uint8_t
free
)
Stepper motor control main command.
Parameters:
[in] steps Number of steps to take
[in] dir Direction to step in, 1 or 0
[in] time_ms Time to take for these steps
[in] free Free or lock motor when done 1 or 0 respectively
Returns: -1 when illegal command or mode
Definition at line 189 of file SMC.cpp .
Variable Documentation
Set when motor control should quit by itself.
Definition at line 29 of file SMC.cpp .
Director in lookup table (unused)
Definition at line 26 of file SMC.cpp .
Argument to free motor when done.
Definition at line 28 of file SMC.cpp .
Boolean for paused state of control.
Definition at line 31 of file SMC.cpp .
Remaining steps.
Definition at line 27 of file SMC.cpp .
Time used to make 1 step.
Definition at line 30 of file SMC.cpp .
Motor control LUT index.
Definition at line 25 of file SMC.cpp .