rusefi/firmware/hw_layer/stepper.h

40 lines
833 B
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file stepper.h
*
* @date Dec 24, 2014
2017-01-03 03:05:22 -08:00
* @author Andrey Belomutskiy, (c) 2012-2017
2015-07-10 06:01:56 -07:00
*/
#ifndef STEPPER_H_
#define STEPPER_H_
#include "main.h"
2017-06-13 06:28:05 -07:00
#include "efiGpio.h"
2015-07-10 06:01:56 -07:00
class StepperMotor {
public:
StepperMotor();
2017-06-13 06:28:05 -07:00
void initialize(brain_pin_e stepPin, brain_pin_e directionPin, pin_output_mode_e directionPinMode, float reactionTime, int totalSteps,
brain_pin_e enablePin, Logging *sharedLogger);
2015-07-10 06:01:56 -07:00
void pulse();
void setTargetPosition(int targetPosition);
int getTargetPosition();
2017-06-13 06:28:05 -07:00
OutputPin directionPin;
2015-07-10 06:01:56 -07:00
int currentPosition;
float reactionTime;
int totalSteps;
private:
int targetPosition;
2016-02-04 09:01:41 -08:00
ioportid_t stepPort;
2015-07-10 06:01:56 -07:00
ioportmask_t stepPin;
2016-02-04 09:01:41 -08:00
ioportid_t enablePort;
2015-07-10 06:01:56 -07:00
ioportmask_t enablePin;
2017-06-13 06:28:05 -07:00
pin_output_mode_e directionPinMode;
2015-07-10 06:01:56 -07:00
THD_WORKING_AREA(stThreadStack, UTILITY_THREAD_STACK_SIZE);
};
#endif /* STEPPER_H_ */