diff --git a/.cproject b/.cproject
index e971721..92b708c 100644
--- a/.cproject
+++ b/.cproject
@@ -30,7 +30,7 @@
-
+
-
+
@@ -222,7 +222,7 @@
-
+
@@ -243,10 +243,10 @@
-
+
-
+
\ No newline at end of file
diff --git a/.project b/.project
index a7e0697..3d38565 100644
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
- a8000_cliptip_module
+ Intelligent_winding_robot_zarm
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 48cb063..a021519 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/a8000_cliptip_module.cfg b/Intelligent_winding_robot_zarm.cfg
similarity index 100%
rename from a8000_cliptip_module.cfg
rename to Intelligent_winding_robot_zarm.cfg
diff --git a/a8000_cliptip_module.ioc b/Intelligent_winding_robot_zarm.ioc
similarity index 99%
rename from a8000_cliptip_module.ioc
rename to Intelligent_winding_robot_zarm.ioc
index 2397f94..e7a600b 100644
--- a/a8000_cliptip_module.ioc
+++ b/Intelligent_winding_robot_zarm.ioc
@@ -259,8 +259,8 @@ ProjectManager.MainLocation=Core/Src
ProjectManager.NoMain=false
ProjectManager.PreviousToolchain=STM32CubeIDE
ProjectManager.ProjectBuild=false
-ProjectManager.ProjectFileName=a8000_cliptip_module.ioc
-ProjectManager.ProjectName=a8000_cliptip_module
+ProjectManager.ProjectFileName=Intelligent_winding_robot_zarm.ioc
+ProjectManager.ProjectName=Intelligent_winding_robot_zarm
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x1000
diff --git a/a8000_cliptip_module.launch b/Intelligent_winding_robot_zarm.launch
similarity index 95%
rename from a8000_cliptip_module.launch
rename to Intelligent_winding_robot_zarm.launch
index 558eaa2..281c803 100644
--- a/a8000_cliptip_module.launch
+++ b/Intelligent_winding_robot_zarm.launch
@@ -12,7 +12,7 @@
-
+
@@ -37,7 +37,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
@@ -82,13 +82,13 @@
-
-
+
+
-
+
diff --git a/usrc/board.h b/usrc/board.h
index 9f7093b..ea6eb85 100644
--- a/usrc/board.h
+++ b/usrc/board.h
@@ -1,11 +1,20 @@
#pragma once
+#define TMC_MOTOR_SPI hspi1
+#define TMC_DIAG1 PB0
+#define TMC_DIAG0 PB1
-// MOTOR1
-#define TMC_MOTOR_SPI hspi1
-#define TMC5130_MOTOR_NUM 1
+// MOTOR0
#define MOTOR0_CSN PA4
-#define MOTOR0_ENN PD0
+#define MOTOR0_ENN PE3
+#define MOTOR0_SPI_MODE_SELECT PinNull
+#define MOTOR0_REFL PD13
+#define MOTOR0_REFR PD14
+
+// MOTOR1
+#define MOTOR1_CSN PA8
+#define MOTOR1_ENN PE6
#define MOTOR1_SPI_MODE_SELECT PinNull
+#define MOTOR1_REFL PD11
+#define MOTOR1_REFR PD12
#define MOTOR_CFG_FLASH_MARK "MOTOR_CFG_FLASH_MARK"
-
diff --git a/usrc/main.cpp b/usrc/main.cpp
index 56430e0..f07f931 100644
--- a/usrc/main.cpp
+++ b/usrc/main.cpp
@@ -41,7 +41,7 @@ static void initsubmodule() {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR0_CSN, //
.ennPin = MOTOR0_ENN, //
- .spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
+ .spi_mode_select = MOTOR0_SPI_MODE_SELECT, //
};
g_motor.initialize(&cfg);
ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
@@ -52,10 +52,8 @@ static void initsubmodule() {
g_motor.setIHOLD_IRUN(0, 8, 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};
StepMotorCtrlModule::create_default_cfg(smcm_cfg);
@@ -74,34 +72,78 @@ 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 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);
+
+ 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);
}
{
- //
- static M3078CodeScanner codescanner;
- static M3078CodeScanner::hardware_config_t cfg = {
- .uart = &huart4,
- .hdma_rx = nullptr,
- .hdma_tx = nullptr,
-
- .codeReadOkPin = PinNull,
- .rstPin = PinNull,
- .triggerPin = PD15,
- };
- codescanner.initialize(initer.get_module_id(3), &cfg);
- initer.register_module(&codescanner);
+ {
+ {
+ /*******************************************************************************
+ * 试管夹舵机 *
+ *******************************************************************************/
+ static FeiTeServoMotor feiteservomotor_bus; // 飞特舵机总线
+ static MiniRobotCtrlModule mini_servo;
+
+ // 飞特舵机总线
+ ZASSERT(huart2.Init.BaudRate == 115200);
+ feiteservomotor_bus.initialize(&huart2, &hdma_usart2_rx, &hdma_usart2_tx);
+
+ static MiniRobotCtrlModule::flash_config_t cfg = {0};
+ cfg.default_torque = 100;
+ mini_servo.initialize(initer.get_module_id(3), &feiteservomotor_bus, 1, &cfg);
+ initer.register_module(&mini_servo);
+ }
+
+ // {
+ // // 115200
+ // /*******************************************************************************
+ // *******************************************************************************/
+ // static FeiTeServoMotor feiteservomotor_bus; // 飞特舵机总线
+ // static MiniRobotCtrlModule mini_servo;
+
+ // // 飞特舵机总线
+ // ZASSERT(huart3.Init.BaudRate == 115200);
+ // feiteservomotor_bus.initialize(&huart3, &hdma_usart3_rx, &hdma_usart3_tx);
+
+ // static MiniRobotCtrlModule::flash_config_t cfg = {0};
+ // cfg.default_torque = 330;
+ // mini_servo.initialize(initer.get_module_id(4), &feiteservomotor_bus, 2, &cfg);
+ // initer.register_module(&mini_servo);
+ // }
+ }
}
}
diff --git a/usrc/project_configs.h b/usrc/project_configs.h
index 1808110..7718615 100644
--- a/usrc/project_configs.h
+++ b/usrc/project_configs.h
@@ -1,7 +1,7 @@
#pragma once
#define PC_VERSION "v1.0.1"
#define PC_MANUFACTURER "http://www.iflytop.com/"
-#define PC_PROJECT_NAME "a8000_cliptip_module"
+#define PC_PROJECT_NAME "Intelligent_winding_robot_zarm"
#define PC_IFLYTOP_ENABLE_OS 1
#define PC_DEBUG_UART huart1
@@ -18,4 +18,4 @@
#define PC_NVS_ENABLE 1
#define PC_NVS_CONFIG_FLASH_SECTOR 8
-#define BOARD_ID 8
+#define BOARD_ID 3