rusefi/firmware/hw_layer/stepper.h

38 lines
917 B
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file stepper.h
*
* @date Dec 24, 2014
2018-12-30 16:13:28 -08:00
* @author Andrey Belomutskiy, (c) 2012-2018
2015-07-10 06:01:56 -07:00
*/
#ifndef STEPPER_H_
#define STEPPER_H_
2018-09-16 19:26:57 -07:00
#include "global.h"
2019-03-29 06:11:13 -07:00
#include "efi_gpio.h"
#include "backup_ram.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, pin_output_mode_e enablePinMode, Logging *sharedLogger);
2015-07-10 06:01:56 -07:00
void pulse();
void setTargetPosition(int targetPosition);
int getTargetPosition() const;
void setDirection(bool isIncrementing);
2015-07-10 06:01:56 -07:00
OutputPin directionPin, stepPin, enablePin;
2015-07-10 06:01:56 -07:00
int currentPosition;
bool currentDirection;
2015-07-10 06:01:56 -07:00
float reactionTime;
int totalSteps;
private:
int targetPosition;
pin_output_mode_e directionPinMode, stepPinMode, enablePinMode;
2017-06-13 06:28:05 -07:00
2015-07-10 06:01:56 -07:00
THD_WORKING_AREA(stThreadStack, UTILITY_THREAD_STACK_SIZE);
};
#endif /* STEPPER_H_ */