Added timer2 for proper start point

This commit is contained in:
Hakan Bastedt
2024-02-02 21:43:58 +01:00
parent 0384646972
commit 2b2704bb17
4 changed files with 10 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ private:
volatile double_t requestedPosition;
volatile uint8_t enabled;
HardwareTimer *MyTim;
HardwareTimer *MyTim2;
uint16_t stepsPerMM;
uint8_t dirPin;
PinName stepPin;

View File

@@ -18,6 +18,7 @@ private:
volatile int32_t oldStepPosition;
volatile uint8_t enabled;
HardwareTimer *MyTim;
HardwareTimer *MyTim2;
int16_t stepsPerMM;
uint8_t dirPin;
PinName stepPin;
@@ -33,7 +34,7 @@ public:
static uint32_t sync0CycleTime;
volatile uint32_t lcncCycleTime; // Linuxcnc nominal cycle time (1 ms often)
StepGen2(TIM_TypeDef *Timer, uint32_t timerChannel, PinName stepPin, uint8_t dirPin, void irq(void));
StepGen2(TIM_TypeDef *Timer, TIM_TypeDef *Timer2, uint32_t _timerChannel, PinName _stepPin, uint8_t _dirPin, void irq(void));
uint32_t handleStepper(void);
void timerCB();
@@ -50,7 +51,6 @@ public:
void setScale(int16_t spm) { stepsPerMM = spm; }
int16_t getScale() { return stepsPerMM; }
uint32_t updatePosAndReturn(int32_t stepPosStop, uint32_t i);
};
#endif