Example #1
0
	// Set enable pin high to disconnect
	pin_set(motor->enable, (connected) ? FALSE : TRUE );

}

static void step(STEPPER_MOTOR* stepper){
	POLOLU_A4983* motor = (POLOLU_A4983*)stepper;

	// Send a 1uS pulse to the step pin
	pin_high(motor->pulse);
	pin_low(motor->pulse);
}

static void	init(STEPPER_MOTOR* stepper){
	POLOLU_A4983* motor = (POLOLU_A4983*)stepper;

	// Make pins into outputs with initial values
	pin_make_output(motor->direction, FALSE);// clockwise
	pin_make_output(motor->enable, TRUE);	// disconnected
	pin_make_output(motor->pulse, FALSE);

	pin_make_output(motor->reset, FALSE);	// start reset the device
	pin_make_output(motor->reset, TRUE);	// end reset the device - will now respond to pulses

}

STEPPER_MOTOR_IMPL const c_a4983 = MAKE_STEPPER_MOTOR_IMPL(&init, &setSpeed,&setConnected,&step);


Example #2
0
File: L297.c Project: bechu/hexapod
	L297* motor = (L297*)stepper;

	// Set enable pin low to disconnect
	pin_set(motor->enable, connected);

}

static void step(STEPPER_MOTOR* stepper){
	L297* motor = (L297*)stepper;

	// Send a 1uS pulse to the step pin
	pin_low(motor->pulse);
	pin_high(motor->pulse);
}

static void	init(STEPPER_MOTOR* stepper){
	L297* motor = (L297*)stepper;

	// Make pins into outputs with initial values
	pin_make_output(motor->direction, FALSE);// clockwise
	pin_make_output(motor->enable, FALSE);	// disconnected
	pin_make_output(motor->pulse, TRUE);

	pin_make_output(motor->reset, FALSE);	// start reset the device
	pin_make_output(motor->reset, TRUE);	// end reset the device - will now respond to pulses

}

STEPPER_MOTOR_IMPL c_l297 = MAKE_STEPPER_MOTOR_IMPL(&init, &setSpeed,&setConnected,&step);