Both steppers work in simulated environment
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class StepGen
|
class StepGen
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
volatile uint8_t timerIsRunning;
|
volatile uint8_t timerIsRunning;
|
||||||
volatile int32_t timerStepPosition;
|
volatile int32_t timerStepPosition;
|
||||||
volatile int32_t timerStepDirection;
|
volatile int32_t timerStepDirection;
|
||||||
@@ -17,7 +17,6 @@ public:
|
|||||||
volatile uint8_t enabled;
|
volatile uint8_t enabled;
|
||||||
HardwareTimer *MyTim;
|
HardwareTimer *MyTim;
|
||||||
uint16_t stepsPerMM;
|
uint16_t stepsPerMM;
|
||||||
static uint32_t sync0CycleTime;
|
|
||||||
uint8_t dirPin;
|
uint8_t dirPin;
|
||||||
PinName stepPin;
|
PinName stepPin;
|
||||||
uint32_t timerChan;
|
uint32_t timerChan;
|
||||||
@@ -25,6 +24,9 @@ public:
|
|||||||
volatile uint32_t prevFreq1 = 0;
|
volatile uint32_t prevFreq1 = 0;
|
||||||
volatile uint32_t prevFreq2 = 0;
|
volatile uint32_t prevFreq2 = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static uint32_t sync0CycleTime;
|
||||||
|
|
||||||
StepGen(TIM_TypeDef *Timer, uint32_t timerChannel, PinName stepPin, uint8_t dirPin, void irq(void));
|
StepGen(TIM_TypeDef *Timer, uint32_t timerChannel, PinName stepPin, uint8_t dirPin, void irq(void));
|
||||||
void reqPos(double_t pos);
|
void reqPos(double_t pos);
|
||||||
double reqPos();
|
double reqPos();
|
||||||
|
|||||||
@@ -19,17 +19,19 @@ void indexPulseEncoderCB1(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "StepGen.h"
|
#include "StepGen.h"
|
||||||
|
|
||||||
void timerCallbackStep1(void);
|
void timerCallbackStep1(void);
|
||||||
StepGen Step1(TIM1, 4, PA_11, PA12, timerCallbackStep1);
|
StepGen Step1(TIM1, 4, PA_11, PA12, timerCallbackStep1);
|
||||||
void timerCallbackStep1(void)
|
void timerCallbackStep1(void)
|
||||||
{
|
{
|
||||||
Step1.timerCB();
|
Step1.timerCB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void timerCallbackStep2(void);
|
void timerCallbackStep2(void);
|
||||||
StepGen Step2(TIM3, 4, PC_9, PC10, timerCallbackStep2);
|
StepGen Step2(TIM3, 4, PC_9, PC10, timerCallbackStep2);
|
||||||
void timerCallbackStep2(void)
|
void timerCallbackStep2(void)
|
||||||
{
|
{
|
||||||
//Step2.timerCB();
|
Step2.timerCB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_set_outputs(void) // Master outputs gets here, slave inputs, first operation
|
void cb_set_outputs(void) // Master outputs gets here, slave inputs, first operation
|
||||||
|
|||||||
Reference in New Issue
Block a user