rusefi-1/firmware/hw_layer/stepper.h

38 lines
757 B
C
Raw Normal View History

2014-12-24 16:05:31 -08:00
/**
* @file stepper.h
*
* @date Dec 24, 2014
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-12-24 16:05:31 -08:00
*/
#ifndef STEPPER_H_
#define STEPPER_H_
#include "main.h"
class StepperMotor {
public:
2015-03-29 16:04:56 -07:00
StepperMotor();
2015-04-15 07:05:24 -07:00
void initialize(brain_pin_e stepPin, brain_pin_e directionPin, float reactionTime, int totalSteps,
brain_pin_e enablePin);
2014-12-24 16:05:31 -08:00
void pulse();
2015-04-14 20:05:50 -07:00
void setTargetPosition(int targetPosition);
int getTargetPosition();
2015-01-04 10:04:12 -08:00
GPIO_TypeDef * directionPort;
ioportmask_t directionPin;
2015-03-29 16:04:56 -07:00
int currentPosition;
2015-04-14 17:08:04 -07:00
float reactionTime;
int totalSteps;
2014-12-24 16:05:31 -08:00
private:
2015-04-14 20:05:50 -07:00
int targetPosition;
2014-12-24 16:05:31 -08:00
GPIO_TypeDef * stepPort;
ioportmask_t stepPin;
2015-04-17 18:04:22 -07:00
GPIO_TypeDef * enablePort;
ioportmask_t enablePin;
2014-12-24 16:05:31 -08:00
THD_WORKING_AREA(stThreadStack, UTILITY_THREAD_STACK_SIZE);
};
#endif /* STEPPER_H_ */