|
@ -33,7 +33,7 @@ stepmotor_control_matrix_t onestepsq2[] = { |
|
|
|
|
|
|
|
|
#define MAX_STEP_TABLE_OFF (ZARRAY_SIZE(onestepsq1) - 1)
|
|
|
#define MAX_STEP_TABLE_OFF (ZARRAY_SIZE(onestepsq1) - 1)
|
|
|
|
|
|
|
|
|
void StepMotor45::initialize(cfg_t cfg) { |
|
|
|
|
|
|
|
|
void StepMotor45::initialize(StepMotor45Scheduler* scheduler, cfg_t cfg) { |
|
|
m_cfg = cfg; |
|
|
m_cfg = cfg; |
|
|
|
|
|
|
|
|
// ³õʼ»¯GPIO
|
|
|
// ³õʼ»¯GPIO
|
|
@ -54,6 +54,7 @@ void StepMotor45::initialize(cfg_t cfg) { |
|
|
m_zeroPinZGPIO->initAsInput(cfg.zeroPin, ZGPIO::kMode_pullup, ZGPIO::kIRQ_noIrq, cfg.zeroPinMirror); |
|
|
m_zeroPinZGPIO->initAsInput(cfg.zeroPin, ZGPIO::kMode_pullup, ZGPIO::kIRQ_noIrq, cfg.zeroPinMirror); |
|
|
} |
|
|
} |
|
|
setdriverpinstate(1, 1, 1, 1); |
|
|
setdriverpinstate(1, 1, 1, 1); |
|
|
|
|
|
scheduler->addMotor(this); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -221,7 +222,7 @@ int32_t StepMotor45::move_to(int to, int speed) { |
|
|
CriticalContext cc; |
|
|
CriticalContext cc; |
|
|
|
|
|
|
|
|
if (to == m_pos) { |
|
|
if (to == m_pos) { |
|
|
return (int32_t)0; |
|
|
|
|
|
|
|
|
return (int32_t)0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (to <= m_pos) { |
|
|
if (to <= m_pos) { |
|
|