From 4efe59a959f31309311aad5192a03bad32f9393a Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 8 Jun 2024 19:27:35 +0800 Subject: [PATCH] update --- a8000_protocol | 2 +- sdk | 2 +- usrc/public_service/ext_board_impl.cpp | 24 +++-- usrc/public_service/ext_board_impl.hpp | 5 +- .../subboard10_plate_clamp_case/pri_board.h | 102 --------------------- .../subboard20_plate_clamp_case.cpp | 32 ------- .../subboard20_plate_clamp_case.hpp | 24 ----- .../subboard20_plate_clamp_case_board.c | 73 --------------- .../subboard20_plate_clamp_case_board.h | 12 --- 9 files changed, 21 insertions(+), 255 deletions(-) delete mode 100644 usrc/subboards/subboard10_plate_clamp_case/pri_board.h delete mode 100644 usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.cpp delete mode 100644 usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.hpp delete mode 100644 usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.c delete mode 100644 usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.h diff --git a/a8000_protocol b/a8000_protocol index 266886e..8ccdf22 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit 266886e64c71e471f0388ff741d0c57e3e46d300 +Subproject commit 8ccdf22fff4e116fb604884a5fcbf374bc64971c diff --git a/sdk b/sdk index 9dd9dbf..17460b5 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 9dd9dbfe74267ed056b86edcd454e5382c233b1d +Subproject commit 17460b56957334ee1c1544c35f99e75e08dd845c diff --git a/usrc/public_service/ext_board_impl.cpp b/usrc/public_service/ext_board_impl.cpp index 59f02e0..a105867 100644 --- a/usrc/public_service/ext_board_impl.cpp +++ b/usrc/public_service/ext_board_impl.cpp @@ -18,12 +18,8 @@ int32_t ExtBoardImpl::board_read_ext_io(int32_t ioindex, int32_t *val) { *val = IO[ioindex].getState(); return 0; } -int32_t ExtBoardImpl::board_write_ext_io(int32_t ioindex, int32_t val) { - if (ioindex < 0 || ioindex >= ZARRAY_SIZE(IO)) return err::kparam_out_of_range; - IO[ioindex].setState(val); - return 0; -} -int32_t ExtBoardImpl::board_read_muti_io(int32_t *val) { + +int32_t ExtBoardImpl::board_read_muti_inio(int32_t *val) { *val = 0; for (int i = 0; i < ZARRAY_SIZE(IO); i++) { *val |= IO[i].getState() << i; @@ -37,8 +33,20 @@ int32_t ExtBoardImpl::board_read_inio_index_in_stm32(int32_t ioindex, int32_t *v *val = IO[ioindex].getPin(); return 0; } + + +int32_t ExtBoardImpl::kboard_write_ext_outio(int32_t ioindex, int32_t val) { + if (ioindex < 0 || ioindex >= ZARRAY_SIZE(IO)) return err::kparam_out_of_range; + OutputIO[ioindex].setState(val); + return 0; +} int32_t ExtBoardImpl::board_read_outio_index_in_stm32(int32_t ioindex, int32_t *val) { if (ioindex < 0 || ioindex >= ZARRAY_SIZE(IO)) return err::kparam_out_of_range; - *val = IO[ioindex].getPin(); + *val = OutputIO[ioindex].getPin(); return 0; -} \ No newline at end of file +} +int32_t ExtBoardImpl::board_read_outio(int32_t ioindex, int32_t *val) { + if (ioindex < 0 || ioindex >= ZARRAY_SIZE(IO)) return err::kparam_out_of_range; + *val = OutputIO[ioindex].getState(); + return 0; +} diff --git a/usrc/public_service/ext_board_impl.hpp b/usrc/public_service/ext_board_impl.hpp index e37a4de..f77155f 100644 --- a/usrc/public_service/ext_board_impl.hpp +++ b/usrc/public_service/ext_board_impl.hpp @@ -33,10 +33,11 @@ class ExtBoardImpl : public ZIBoard, public ZIModule { * ZIBoard * ***********************************************************************************************************************/ virtual int32_t board_read_ext_io(int32_t ioindex, int32_t *val); - virtual int32_t board_write_ext_io(int32_t ioindex, int32_t val); - virtual int32_t board_read_muti_io(int32_t *val); + virtual int32_t kboard_write_ext_outio(int32_t ioindex, int32_t val); + virtual int32_t board_read_muti_inio(int32_t *val); virtual int32_t board_read_inio_index_in_stm32(int32_t ioindex, int32_t *val); virtual int32_t board_read_outio_index_in_stm32(int32_t ioindex, int32_t *val); + virtual int32_t board_read_outio(int32_t ioindex, int32_t *val); virtual int32_t getmoduleId(int off); }; diff --git a/usrc/subboards/subboard10_plate_clamp_case/pri_board.h b/usrc/subboards/subboard10_plate_clamp_case/pri_board.h deleted file mode 100644 index 23b0726..0000000 --- a/usrc/subboards/subboard10_plate_clamp_case/pri_board.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -/*********************************************************************************************************************** - * 板载扩展IO * - ***********************************************************************************************************************/ -#define EXT_INPUT_IO0 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO1 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO2 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO3 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO4 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO5 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO6 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO7 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO8 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true -#define EXT_INPUT_IO9 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true - -#define EXT_OUTPUT_IO0 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO1 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO2 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO3 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO4 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO5 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO6 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO7 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO8 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ -#define EXT_OUTPUT_IO9 PinNull, ZGPIO::kMode_nopull, false /*mirror*/, true /*init val*/ - -#define TMC_MOTOR_SPI hspi1 - -/*********************************************************************************************************************** - * 左右移动 * - ***********************************************************************************************************************/ - -#define MOTOR1_CSN PA4 -#define MOTOR1_ENN PD5 -#define MOTOR1_SPI_MODE_SELECT PinNull -#define MOTOR1_nFREEZE_IO PinNull -#define MOTOR1_nRESET_IO PinNull -#define MOTOR1_SUB_IC_ENN_IO PinNull - -#define MOTOR1_REFL PD0 -#define MOTOR1_REFR PD8 -#define MOTOR1_REFL_MIRROR true -#define MOTOR1_REFR_MIRROR true - -#define MOTOR1_MOTOR_SHAFT true -#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE 60 -#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1 -#define MOTOR1_STEPMOTOR_IHOLD 3 -#define MOTOR1_STEPMOTOR_IRUN 16 -#define MOTOR1_STEPMOTOR_IHOLDDELAY 100 -#define MOTOR1_STEPMOTOR_IGLOBALSCALER 0 -#define MOTOR1_MOTOR_DEFAULT_VELOCITY 500 -#define MOTOR1_MIN_D 0 -#define MOTOR1_MAX_D 0 -#define MOTOR1_MOTOR_RUN_TO_ZERO_SPEED 400 -#define MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED 50 -#define MOTOR1_MOTOR_VSTART TMC5130_DEFAULT__MOTOR_VSTART -#define MOTOR1_MOTOR_A1 TMC5130_DEFAULT__MOTOR_A1 -#define MOTOR1_MOTOR_AMAX 300 -#define MOTOR1_MOTOR_V1 TMC5130_DEFAULT__MOTOR_V1 -#define MOTOR1_MOTOR_DMAX 300 -#define MOTOR1_MOTOR_D1 TMC5130_DEFAULT__MOTOR_D1 -#define MOTOR1_MOTOR_VSTOP TMC5130_DEFAULT__MOTOR_VSTOP -#define MOTOR1_MOTOR_TZEROWAIT TMC5130_DEFAULT__MOTOR_TZEROWAIT - -/*********************************************************************************************************************** - * 推杆电机 * - ***********************************************************************************************************************/ - -#define MOTOR2_CSN PB1 -#define MOTOR2_ENN PD4 -#define MOTOR2_SPI_MODE_SELECT PinNull -#define MOTOR2_nFREEZE_IO PinNull -#define MOTOR2_nRESET_IO PinNull -#define MOTOR2_SUB_IC_ENN_IO PinNull - -#define MOTOR2_REFL PD2 -#define MOTOR2_REFR PD9 -#define MOTOR2_REFL_MIRROR true -#define MOTOR2_REFR_MIRROR true - -#define MOTOR2_MOTOR_SHAFT true -#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE 80 -#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1 -#define MOTOR2_STEPMOTOR_IHOLD 1 -#define MOTOR2_STEPMOTOR_IRUN 8 -#define MOTOR2_STEPMOTOR_IHOLDDELAY 100 -#define MOTOR2_STEPMOTOR_IGLOBALSCALER 0 -#define MOTOR2_MOTOR_DEFAULT_VELOCITY 500 -#define MOTOR2_MIN_D 0 -#define MOTOR2_MAX_D 0 -#define MOTOR2_MOTOR_RUN_TO_ZERO_SPEED 300 -#define MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED 50 -#define MOTOR2_MOTOR_VSTART TMC5130_DEFAULT__MOTOR_VSTART -#define MOTOR2_MOTOR_A1 TMC5130_DEFAULT__MOTOR_A1 -#define MOTOR2_MOTOR_AMAX 300 -#define MOTOR2_MOTOR_V1 TMC5130_DEFAULT__MOTOR_V1 -#define MOTOR2_MOTOR_DMAX 300 -#define MOTOR2_MOTOR_D1 TMC5130_DEFAULT__MOTOR_D1 -#define MOTOR2_MOTOR_VSTOP TMC5130_DEFAULT__MOTOR_VSTOP -#define MOTOR2_MOTOR_TZEROWAIT TMC5130_DEFAULT__MOTOR_TZEROWAIT diff --git a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.cpp b/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.cpp deleted file mode 100644 index ee8807f..0000000 --- a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "subboard20_plate_clamp_case.hpp" -extern "C" { -#include "subboard20_plate_clamp_case_board.h" -} -#include "pri_board.h" -#include "public_service/instance_init.hpp" -#include "public_service/public_service.hpp" -#include "sdk/components/mini_servo_motor/feite_servo_motor.hpp" -#include "sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.hpp" -#include "sdk/components/sensors/m3078/m3078_code_scaner.hpp" -#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp" -#include "sdk/components/tmc/ic/ztmc4361A.hpp" -#include "sdk\components\pipette_module\pipette_ctrl_module_v2.hpp" - -#define TAG "Subboard20PlateClampCase" - -using namespace iflytop; - -/*********************************************************************************************************************** - * IMPL * - ***********************************************************************************************************************/ -void Subboard20PlateClampCase::initialize() { - IO_INIT(); - GService::inst()->getZCanProtocolParser()->registerModule(this); -#if 1 - /*********************************************************************************************************************** - * ID1 * - ***********************************************************************************************************************/ - { TMC5130_MOTOR_INITER(1, 1); } - { TMC5130_MOTOR_INITER(2, 2); } -#endif -} diff --git a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.hpp b/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.hpp deleted file mode 100644 index 489c51a..0000000 --- a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -// -#include "configs/device_id_mgr.hpp" -#include "sdk/chip/chip.hpp" -#include "sdk/os/zos.hpp" -// -#include "sdk\components\step_motor_ctrl_module\step_motor_ctrl_module.hpp" -#include "sdk\components\tmc\ic\ztmc5130.hpp" -#include "public_service/public_service.hpp" - -namespace iflytop { -class Subboard20PlateClampCase : public ExtBoardImpl { - public: - static Subboard20PlateClampCase *ins() { - static Subboard20PlateClampCase instance; - return &instance; - } - - void initialize(); -}; - -} // namespace iflytop diff --git a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.c b/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.c deleted file mode 100644 index 9828f4e..0000000 --- a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.c +++ /dev/null @@ -1,73 +0,0 @@ -#include "main.h" -#include "public_service/public_service.h" - -/* SPI1 init function */ -static void MX_SPI1_Init(void) { - __HAL_RCC_SPI1_CLK_ENABLE(); - __HAL_RCC_GPIOA_CLK_ENABLE(); - - hspi1.Instance = SPI1; - hspi1.Init.Mode = SPI_MODE_MASTER; - hspi1.Init.Direction = SPI_DIRECTION_2LINES; - hspi1.Init.DataSize = SPI_DATASIZE_8BIT; - hspi1.Init.CLKPolarity = SPI_POLARITY_LOW; - hspi1.Init.CLKPhase = SPI_PHASE_1EDGE; - hspi1.Init.NSS = SPI_NSS_SOFT; - hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32; - hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB; - hspi1.Init.TIMode = SPI_TIMODE_DISABLE; - hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; - hspi1.Init.CRCPolynomial = 10; - if (HAL_SPI_Init(&hspi1) != HAL_OK) { - Error_Handler(); - } - GPIO_InitTypeDef GPIO_InitStruct = {0}; - GPIO_InitStruct.Pin = GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - - hspi1_enable = true; -} - -static void MX_SPI2_Init(void) { - __HAL_RCC_SPI2_CLK_ENABLE(); - __HAL_RCC_GPIOB_CLK_ENABLE(); - - hspi2.Instance = SPI2; - hspi2.Init.Mode = SPI_MODE_MASTER; - hspi2.Init.Direction = SPI_DIRECTION_2LINES; - hspi2.Init.DataSize = SPI_DATASIZE_8BIT; - hspi2.Init.CLKPolarity = SPI_POLARITY_LOW; - hspi2.Init.CLKPhase = SPI_PHASE_1EDGE; - hspi2.Init.NSS = SPI_NSS_SOFT; - hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64; - hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB; - hspi2.Init.TIMode = SPI_TIMODE_DISABLE; - hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; - hspi2.Init.CRCPolynomial = 10; - if (HAL_SPI_Init(&hspi2) != HAL_OK) { - Error_Handler(); - } - GPIO_InitTypeDef GPIO_InitStruct = {0}; - GPIO_InitStruct.Pin = GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - - hspi2_enable = true; -} - -/** - * @brief 板夹仓初始化 - */ - -void subboard20_plate_clamp_case_board_init() { - common_hardware_init(); - MX_SPI1_Init(); - MX_SPI2_Init(); -} diff --git a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.h b/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.h deleted file mode 100644 index 493efbd..0000000 --- a/usrc/subboards/subboard10_plate_clamp_case/subboard20_plate_clamp_case_board.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once -#include "main.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void subboard20_plate_clamp_case_board_init(); - -#ifdef __cplusplus -} -#endif