|
@ -41,7 +41,7 @@ static void initsubmodule() { |
|
|
.spi = &TMC_MOTOR_SPI, //
|
|
|
.spi = &TMC_MOTOR_SPI, //
|
|
|
.csgpio = MOTOR0_CSN, //
|
|
|
.csgpio = MOTOR0_CSN, //
|
|
|
.ennPin = MOTOR0_ENN, //
|
|
|
.ennPin = MOTOR0_ENN, //
|
|
|
.spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
|
|
|
|
|
|
|
|
|
.spi_mode_select = MOTOR0_SPI_MODE_SELECT, //
|
|
|
}; |
|
|
}; |
|
|
g_motor.initialize(&cfg); |
|
|
g_motor.initialize(&cfg); |
|
|
ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion()); |
|
|
ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion()); |
|
@ -52,10 +52,8 @@ static void initsubmodule() { |
|
|
g_motor.setIHOLD_IRUN(0, 8, 10); |
|
|
g_motor.setIHOLD_IRUN(0, 8, 10); |
|
|
|
|
|
|
|
|
static ZGPIO input[10]; |
|
|
static ZGPIO input[10]; |
|
|
input[0].initAsInput(PD2 /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
input[1].initAsInput(PD1 /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
input[2].initAsInput(PD3 /*DIAG0*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
input[3].initAsInput(PD4 /*DIAG1*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
|
|
|
input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
|
|
|
I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; |
|
|
I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; |
|
|
StepMotorCtrlModule::create_default_cfg(smcm_cfg); |
|
|
StepMotorCtrlModule::create_default_cfg(smcm_cfg); |
|
@ -74,34 +72,40 @@ static void initsubmodule() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
static PipetteModule g_pipetteModule; |
|
|
|
|
|
PipetteModule::config_t cfg = { |
|
|
|
|
|
.limit_ul = 30, |
|
|
|
|
|
|
|
|
static TMC5130 g_motor; |
|
|
|
|
|
static StepMotorCtrlModule g_stepMotorCtrlModule; |
|
|
|
|
|
TMC5130::cfg_t cfg = { |
|
|
|
|
|
.spi = &TMC_MOTOR_SPI, //
|
|
|
|
|
|
.csgpio = MOTOR1_CSN, //
|
|
|
|
|
|
.ennPin = MOTOR1_ENN, //
|
|
|
|
|
|
.spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
|
|
|
}; |
|
|
}; |
|
|
|
|
|
g_motor.initialize(&cfg); |
|
|
|
|
|
ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion()); |
|
|
|
|
|
|
|
|
PipetteModule::hardward_config_t hardwarecfg = { |
|
|
|
|
|
.uart = &huart2, |
|
|
|
|
|
.hdma_rx = &hdma_usart2_rx, |
|
|
|
|
|
.hdma_tx = &hdma_usart2_tx, |
|
|
|
|
|
}; |
|
|
|
|
|
g_pipetteModule.initialize(initer.get_module_id(2), &cfg, &hardwarecfg); |
|
|
|
|
|
initer.register_module(&g_pipetteModule); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
g_motor.setMotorShaft(false); |
|
|
|
|
|
g_motor.setAcceleration(100); |
|
|
|
|
|
g_motor.setDeceleration(100); |
|
|
|
|
|
g_motor.setIHOLD_IRUN(0, 8, 10); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
//
|
|
|
|
|
|
static M3078CodeScanner codescanner; |
|
|
|
|
|
static M3078CodeScanner::hardware_config_t cfg = { |
|
|
|
|
|
.uart = &huart4, |
|
|
|
|
|
.hdma_rx = nullptr, |
|
|
|
|
|
.hdma_tx = nullptr, |
|
|
|
|
|
|
|
|
static ZGPIO input[10]; |
|
|
|
|
|
input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
|
|
|
.codeReadOkPin = PinNull, |
|
|
|
|
|
.rstPin = PinNull, |
|
|
|
|
|
.triggerPin = PD15, |
|
|
|
|
|
}; |
|
|
|
|
|
codescanner.initialize(initer.get_module_id(3), &cfg); |
|
|
|
|
|
initer.register_module(&codescanner); |
|
|
|
|
|
|
|
|
I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; |
|
|
|
|
|
StepMotorCtrlModule::create_default_cfg(smcm_cfg); |
|
|
|
|
|
smcm_cfg.base_param.distance_scale = 80; |
|
|
|
|
|
smcm_cfg.base_param.distance_scale_denominator = 1; |
|
|
|
|
|
smcm_cfg.base_param.ihold = 1; |
|
|
|
|
|
smcm_cfg.base_param.irun = 8; |
|
|
|
|
|
smcm_cfg.base_param.x_shaft = false; |
|
|
|
|
|
smcm_cfg.base_param.maxspeed = 500; |
|
|
|
|
|
smcm_cfg.base_param.run_to_zero_speed = 100; |
|
|
|
|
|
smcm_cfg.base_param.max_x = 0; |
|
|
|
|
|
smcm_cfg.base_param.min_x = 0; |
|
|
|
|
|
|
|
|
|
|
|
g_stepMotorCtrlModule.initialize(initer.get_module_id(2), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); |
|
|
|
|
|
initer.register_module(&g_stepMotorCtrlModule); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|