|
|
@ -55,104 +55,29 @@ static void initsubmodule() { |
|
|
|
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); |
|
|
|
|
|
|
|
I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; |
|
|
|
StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; |
|
|
|
StepMotorCtrlModule::create_default_cfg(smcm_cfg); |
|
|
|
smcm_cfg.base_param.distance_scale = 100; |
|
|
|
smcm_cfg.base_param.distance_scale_denominator = 1; |
|
|
|
smcm_cfg.base_param.irun = 24; |
|
|
|
smcm_cfg.base_param.ihold = 1; |
|
|
|
smcm_cfg.base_param.x_shaft = false; |
|
|
|
smcm_cfg.base_param.maxspeed = INLET_SPEED; |
|
|
|
smcm_cfg.base_param.run_to_zero_speed = 50; |
|
|
|
|
|
|
|
stepMotorCtrlModule.initialize(initer.get_module_id(1), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); |
|
|
|
initer.register_module(&stepMotorCtrlModule); |
|
|
|
} |
|
|
|
/**
|
|
|
|
* @brief Æ½ÒÆ |
|
|
|
*/ |
|
|
|
{ |
|
|
|
static TMC5130 motor; |
|
|
|
static StepMotorCtrlModule stepMotorCtrlModule; |
|
|
|
|
|
|
|
TMC5130::cfg_t cfg = { |
|
|
|
.spi = &TMC_MOTOR_SPI, //
|
|
|
|
.csgpio = MOTOR2_CSN, //
|
|
|
|
.ennPin = MOTOR2_ENN, //
|
|
|
|
.spi_mode_select = MOTOR2_SPI_MODE_SELECT, //
|
|
|
|
}; |
|
|
|
motor.initialize(&cfg); |
|
|
|
motor.setMotorShaft(false); |
|
|
|
ZLOGI(TAG, "motor2 initialize 5160:%x ", motor.readICVersion()); |
|
|
|
|
|
|
|
static ZGPIO input[2]; |
|
|
|
input[0].initAsInput(MOTOR2_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[1].initAsInput(MOTOR2_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
|
|
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.irun = 8; |
|
|
|
smcm_cfg.base_param.ihold = 1; |
|
|
|
smcm_cfg.base_param.x_shaft = false; |
|
|
|
smcm_cfg.base_param.maxspeed = TANSLATE_SPEED; |
|
|
|
smcm_cfg.base_param.run_to_zero_speed = 100; |
|
|
|
|
|
|
|
stepMotorCtrlModule.initialize(initer.get_module_id(2), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); |
|
|
|
initer.register_module(&stepMotorCtrlModule); |
|
|
|
} |
|
|
|
smcm_cfg.base_param.motor_shift = 0; |
|
|
|
smcm_cfg.base_param.motor_shaft = 0; |
|
|
|
smcm_cfg.base_param.motor_one_circle_pulse = 100; |
|
|
|
smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1; |
|
|
|
smcm_cfg.base_param.motor_default_velocity = INLET_SPEED; |
|
|
|
smcm_cfg.base_param.motor_default_acc = 300; |
|
|
|
smcm_cfg.base_param.motor_default_dec = 300; |
|
|
|
smcm_cfg.base_param.motor_run_to_zero_max_d = 5000; |
|
|
|
smcm_cfg.base_param.motor_look_zero_edge_max_d = 100; |
|
|
|
smcm_cfg.base_param.motor_run_to_zero_speed = 50; |
|
|
|
smcm_cfg.base_param.motor_run_to_zero_dec = 600; |
|
|
|
smcm_cfg.base_param.motor_look_zero_edge_speed = 100; |
|
|
|
smcm_cfg.base_param.motor_look_zero_edge_dec = 900; |
|
|
|
smcm_cfg.base_param.stepmotor_ihold = 1; |
|
|
|
smcm_cfg.base_param.stepmotor_irun = 24; |
|
|
|
smcm_cfg.base_param.stepmotor_iholddelay = 1000; |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief ³öÁÏ |
|
|
|
*/ |
|
|
|
{ |
|
|
|
static TMC5130 motor; |
|
|
|
static StepMotorCtrlModule stepMotorCtrlModule; |
|
|
|
|
|
|
|
TMC5130::cfg_t cfg = { |
|
|
|
.spi = &TMC_MOTOR_SPI, //
|
|
|
|
.csgpio = MOTOR3_CSN, //
|
|
|
|
.ennPin = MOTOR3_ENN, //
|
|
|
|
.spi_mode_select = MOTOR3_SPI_MODE_SELECT, //
|
|
|
|
}; |
|
|
|
motor.initialize(&cfg); |
|
|
|
motor.setMotorShaft(false); |
|
|
|
ZLOGI(TAG, "motor3 initialize 5160:%x ", motor.readICVersion()); |
|
|
|
|
|
|
|
static ZGPIO input[2]; |
|
|
|
input[0].initAsInput(MOTOR3_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[1].initAsInput(MOTOR3_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
|
|
I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; |
|
|
|
StepMotorCtrlModule::create_default_cfg(smcm_cfg); |
|
|
|
smcm_cfg.base_param.distance_scale = 100; |
|
|
|
smcm_cfg.base_param.distance_scale_denominator = 1; |
|
|
|
smcm_cfg.base_param.irun = 24; |
|
|
|
smcm_cfg.base_param.ihold = 1; |
|
|
|
smcm_cfg.base_param.x_shaft = true; |
|
|
|
smcm_cfg.base_param.maxspeed = OUTET_SPEED; |
|
|
|
smcm_cfg.base_param.run_to_zero_speed = 50; |
|
|
|
|
|
|
|
stepMotorCtrlModule.initialize(initer.get_module_id(3), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); |
|
|
|
stepMotorCtrlModule.initialize(initer.get_module_id(1), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); |
|
|
|
initer.register_module(&stepMotorCtrlModule); |
|
|
|
} |
|
|
|
#if 1
|
|
|
|
{ |
|
|
|
static M3078CodeScanner codescanner; |
|
|
|
static M3078CodeScanner::hardware_config_t cfg = { |
|
|
|
.uart = &huart3, |
|
|
|
.hdma_rx = nullptr, |
|
|
|
.hdma_tx = nullptr, |
|
|
|
|
|
|
|
.codeReadOkPin = PinNull, |
|
|
|
.rstPin = PinNull, |
|
|
|
.triggerPin = PE15, |
|
|
|
}; |
|
|
|
codescanner.initialize(initer.get_module_id(4), &cfg); |
|
|
|
initer.register_module(&codescanner); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|