Browse Source

init

master
zhaohe 1 year ago
parent
commit
d185131fe1
  1. 2
      .gitmodules
  2. 1
      .vscode
  3. 2
      sdk
  4. 111
      usrc/main.cpp

2
.gitmodules

@ -1,6 +1,6 @@
[submodule "sdk"]
path = sdk
url = zwsd@192.168.1.3:manufacturer_stm32/iflytop_stm32_os_sdk.git
url = zwsd@192.168.1.3:project_boditech_vidas_a8000_v3/a8000_subboard_sdk.git
[submodule ".vscode"]
path = .vscode
url = zwsd@192.168.1.3:project_boditech_vidas_a8000_v3/a8000_subboard_vscode_cfg.git

1
.vscode

@ -0,0 +1 @@
Subproject commit 58b654f9593408be7f6c0349bebb519a932dd76b

2
sdk

@ -1 +1 @@
Subproject commit 488b00af87cf243c026274389904993be08acae3
Subproject commit 6f30b6d5d989f02e831655ec5439042b8b8126cf

111
usrc/main.cpp

@ -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
}
/*******************************************************************************

Loading…
Cancel
Save