diff --git a/.cproject b/.cproject
index e971721..84d355c 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..f5a5f8e 100644
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
- a8000_cliptip_module
+ a8000_inlet_and_outlet_module
diff --git a/README.md b/README.md
index fe07e76..eecd6a5 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ ref:https://iflytop1.feishu.cn/wiki/PbUHwG2o6ikWagkmsiqcTFwAnjp
#define ID3 PC3
#define ID4 PC4
-// 调试串口zwsd@192.168.1.3:project_boditech_vidas_a8000_v2/a8000_cliptip_module.git
+// 调试串口zwsd@192.168.1.3:project_boditech_vidas_a8000_v2/a8000_inlet_and_outlet_module.git
#define DEBUG_UART huart1
// 调试指示灯
#define DEBUG_LIGHT_GPIO PE2
diff --git a/a8000_cliptip_module.cfg b/a8000_inlet_and_outlet_module.cfg
similarity index 100%
rename from a8000_cliptip_module.cfg
rename to a8000_inlet_and_outlet_module.cfg
diff --git a/a8000_cliptip_module.ioc b/a8000_inlet_and_outlet_module.ioc
similarity index 99%
rename from a8000_cliptip_module.ioc
rename to a8000_inlet_and_outlet_module.ioc
index 874efda..6a6f9dc 100644
--- a/a8000_cliptip_module.ioc
+++ b/a8000_inlet_and_outlet_module.ioc
@@ -227,8 +227,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=a8000_inlet_and_outlet_module.ioc
+ProjectManager.ProjectName=a8000_inlet_and_outlet_module
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x1000
diff --git a/a8000_cliptip_module.launch b/a8000_inlet_and_outlet_module.launch
similarity index 95%
rename from a8000_cliptip_module.launch
rename to a8000_inlet_and_outlet_module.launch
index 40be9f4..799aa86 100644
--- a/a8000_cliptip_module.launch
+++ b/a8000_inlet_and_outlet_module.launch
@@ -12,7 +12,7 @@
-
+
@@ -37,7 +37,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
@@ -82,13 +82,13 @@
-
-
+
+
-
+
diff --git a/sdk b/sdk
index af685a1..0208551 160000
--- a/sdk
+++ b/sdk
@@ -1 +1 @@
-Subproject commit af685a17a8fd229ca4773a9c62949db89369c55f
+Subproject commit 02085518d805ab20d8ca41db8911a56ca7913a3d
diff --git a/usrc/main.cpp b/usrc/main.cpp
index 33dca7b..343c083 100644
--- a/usrc/main.cpp
+++ b/usrc/main.cpp
@@ -10,6 +10,7 @@
#include "sdk\components\flash\znvs.hpp"
//
#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp"
+#include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
#include "sdk\components\pipette_module\pipette_ctrl_module_v2.hpp"
#include "sdk\components\sensors\m3078\m3078_code_scaner.hpp"
#include "sdk\components\sensors\tmp117\tmp117.hpp"
@@ -19,6 +20,7 @@
#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module.hpp"
#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module_factory.cpp"
#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module_factory.hpp"
+#include "sdk\components\zcancmder\zcan_board_module.hpp"
// #include "M3078CodeScanner"
#define TAG "main"
@@ -36,71 +38,133 @@ extern DMA_HandleTypeDef hdma_usart2_tx;
static ZCanCmder g_zcanCmder;
static ZIProtocolParser g_ziProtocolParser;
//
-static TMC5130 g_motor;
-static StepMotorCtrlModule g_stepMotorCtrlModule;
+static TMC5130 g_motor[3];
//
static PipetteModule g_pipetteModule;
// USART4_TX
-void init_and_reg_motor() {
+void initmodule() {
osDelay(1000);
+
+ {
+ static ZCanBoardModule::hardware_config_t cfg = {
+ .input =
+ {
+ {PD0, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD1, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD2, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD3, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD4, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD5, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD6, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD7, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ {PD8, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false},
+ },
+ };
+ static ZCanBoardModule boardmodule;
+ boardmodule.initialize(BOARD_ID * 10 + 0, &cfg);
+ g_ziProtocolParser.registerModule(&boardmodule);
+ }
+
{
+ static TMC5130 motor;
+ static StepMotorCtrlModule stepMotorCtrlModule;
+
TMC5130::cfg_t cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR0_CSN, //
.ennPin = MOTOR0_ENN, //
+ .spi_mode_select = MOTOR0_SPI_MODE_SELECT, //
+ };
+ motor.initialize(&cfg);
+ motor.setMotorShaft(false);
+ ZLOGI(TAG, "motora initialize 5160:%x ", motor.readICVersion());
+
+ static ZGPIO input[2];
+ 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);
+
+ stepMotorCtrlModule.initialize(BOARD_ID * 10 + 1, &motor, input, ZARRAY_SIZE(input), nullptr);
+ g_ziProtocolParser.registerModule(&stepMotorCtrlModule);
+ }
+
+ {
+ static TMC5130 motor;
+ static StepMotorCtrlModule 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);
- g_motor.setMotorShaft(false);
- ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
+ motor.initialize(&cfg);
+ motor.setMotorShaft(false);
+ ZLOGI(TAG, "motora initialize 5160:%x ", motor.readICVersion());
+
+ static ZGPIO input[2];
+ 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);
+
+ stepMotorCtrlModule.initialize(BOARD_ID * 10 + 2, &motor, input, ZARRAY_SIZE(input), nullptr);
+ g_ziProtocolParser.registerModule(&stepMotorCtrlModule);
}
- g_motor.setAcceleration(100);
- g_motor.setDeceleration(100);
- g_motor.setIHOLD_IRUN(0, 8, 10);
+ {
+ static TMC5130 motor;
+ static StepMotorCtrlModule stepMotorCtrlModule;
- static ZGPIO input[10];
- input[0].initAsInput(PD1 /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[1].initAsInput(PD2 /*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);
+ 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, "motora initialize 5160:%x ", motor.readICVersion());
- g_stepMotorCtrlModule.initialize(BOARD_ID * 10 + 1, &g_motor, input, ZARRAY_SIZE(input), MOTOR_CFG_FLASH_MARK);
- g_ziProtocolParser.registerModule(&g_stepMotorCtrlModule);
-}
+ 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);
-void init_and_reg_cliptip_module() {
- // # RS232输出压力流
- // /1U2!0R\r
- // # 设置移液枪最大行程100,防止设备误操作导致吸入液体到设备中
- // /1u1,100R\r
- PipetteModule::config_t cfg = {
- .limit_ul = 100,
- };
-
- PipetteModule::hardward_config_t hardwarecfg = {
- .uart = &huart2,
- .hdma_rx = &hdma_usart2_rx,
- .hdma_tx = &hdma_usart2_tx,
- };
- g_pipetteModule.initialize(BOARD_ID * 10 + 2, &cfg, &hardwarecfg);
- g_ziProtocolParser.registerModule(&g_pipetteModule);
-}
+ stepMotorCtrlModule.initialize(BOARD_ID * 10 + 3, &motor, input, ZARRAY_SIZE(input), nullptr);
+ g_ziProtocolParser.registerModule(&stepMotorCtrlModule);
+ }
-void init_and_reg_m3078() { //
- static M3078CodeScanner codescanner;
- static M3078CodeScanner::hardware_config_t cfg = {
- .uart = &huart2,
- .hdma_rx = nullptr,
- .hdma_tx = nullptr,
-
- .codeReadOkPin = PinNull,
- .rstPin = PinNull,
- .triggerPin = PD15,
- };
- codescanner.initialize(BOARD_ID * 10 + 3, &cfg);
- g_ziProtocolParser.registerModule(&codescanner);
+ {
+ 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(BOARD_ID * 10 + 4, &cfg);
+ g_ziProtocolParser.registerModule(&codescanner);
+ }
+
+ {
+ // 115200
+ static FeiTeServoMotor feiteservomotor_bus; // 飞特舵机总线
+ static MiniRobotCtrlModule mini_servo[4];
+
+ ZASSERT(huart2.Init.BaudRate == 115200); // 飞特舵机总线
+ feiteservomotor_bus.initialize(&huart2, &hdma_usart2_rx, &hdma_usart2_tx); // 飞特舵机总线
+
+ mini_servo[0].initialize(BOARD_ID * 10 + 5, &feiteservomotor_bus, 1);
+ mini_servo[1].initialize(BOARD_ID * 10 + 6, &feiteservomotor_bus, 2);
+ mini_servo[2].initialize(BOARD_ID * 10 + 7, &feiteservomotor_bus, 3);
+ mini_servo[3].initialize(BOARD_ID * 10 + 8, &feiteservomotor_bus, 4);
+
+ g_ziProtocolParser.registerModule(&mini_servo[0]);
+ g_ziProtocolParser.registerModule(&mini_servo[1]);
+ g_ziProtocolParser.registerModule(&mini_servo[2]);
+ g_ziProtocolParser.registerModule(&mini_servo[3]);
+ }
}
void umain() {
@@ -131,10 +195,7 @@ void umain() {
g_zcanCmder.init(zcanCmder_cfg);
g_ziProtocolParser.initialize(&g_zcanCmder);
- init_and_reg_motor();
- init_and_reg_cliptip_module();
- init_and_reg_m3078();
-
+ initmodule();
while (true) {
OSDefaultSchduler::getInstance()->loop();
g_zcanCmder.loop();
diff --git a/usrc/project_configs.h b/usrc/project_configs.h
index ade27e7..14d5659 100644
--- a/usrc/project_configs.h
+++ b/usrc/project_configs.h
@@ -2,7 +2,7 @@
#define VERSION "v1.0.0"
#define MANUFACTURER "http://www.iflytop.com/"
-#define PROJECT_NAME "a8000_cliptip_module"
+#define PROJECT_NAME "a8000_inlet_and_outlet_module"
#define DEBUG_UART huart1
#define DEBUG_LIGHT_GPIO PE2
@@ -13,21 +13,34 @@
#define IFLYTOP_ENABLE_OS 1
#define IFLYTOP_PREEMPTPRIORITY_DEFAULT 5
-
/****************************************FLASH***************************************/
#define IFLYTOP_NVS_CONFIG_FLASH_SECTOR 8
/*********************************************************************************/
// MOTOR1
#define TMC_MOTOR_SPI hspi1
-#define TMC5130_MOTOR_NUM 1
+// JL_CSN
#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
+// SL_CSN
+#define MOTOR1_CSN PA8
+#define MOTOR1_ENN PE6
#define MOTOR1_SPI_MODE_SELECT PinNull
+#define MOTOR1_REFL PD11
+#define MOTOR1_REFR PD12
+// CL_CSN
+#define MOTOR2_CSN PA15
+#define MOTOR2_ENN PE7
+#define MOTOR2_SPI_MODE_SELECT PinNull
+#define MOTOR2_REFL PD9
+#define MOTOR2_REFR PD10
#define MOTOR_CFG_FLASH_MARK "MOTOR_CFG_FLASH_MARK"
-#define BOARD_ID 2
+#define BOARD_ID 5
#if 0
#define STEPPER_MOTOR_ZERO_SENSOR SENSOR_INT0
@@ -40,4 +53,3 @@
#define ID2_IO PD13
#define ID3_IO PD14
#define ID4_IO PD15
-