Browse Source

add 20 board

master
zhaohe 1 year ago
parent
commit
1d3c44f5c3
  1. 1
      usrc/public_service/gins.c
  2. 1
      usrc/public_service/gins.h
  3. 91
      usrc/public_service/instance_init.hpp
  4. 1
      usrc/public_service/public_service.hpp
  5. 85
      usrc/subboards/subboard20_plate_clamp_case/pri_board.h
  6. 106
      usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case.cpp
  7. 44
      usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case.hpp
  8. 73
      usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case_board.c
  9. 12
      usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case_board.h
  10. 139
      usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp
  11. 140
      usrc/subboards/subboard60_inlet_and_outlet_module/subboard60_inlet_and_outlet_module.cpp
  12. 52
      usrc/subboards/subboard70_incubation_turntable/subboard70_incubation_turntable.cpp
  13. 44
      usrc/subboards/subboard80_cliptip/subboard80_cliptip.cpp

1
usrc/public_service/gins.c

@ -30,6 +30,7 @@ DEFINE_GLOBAL(DMA_HandleTypeDef, hdma4_stream2);
DEFINE_GLOBAL(DMA_HandleTypeDef, hdma4_stream3);
DEFINE_GLOBAL(SPI_HandleTypeDef, hspi1);
DEFINE_GLOBAL(SPI_HandleTypeDef, hspi2);
/***********************************************************************************************************************
* PTR *

1
usrc/public_service/gins.h

@ -52,6 +52,7 @@ EXTERN_GLOBAL(DMA_HandleTypeDef, hdma4_stream2);
EXTERN_GLOBAL(DMA_HandleTypeDef, hdma4_stream3);
EXTERN_GLOBAL(SPI_HandleTypeDef, hspi1);
EXTERN_GLOBAL(SPI_HandleTypeDef, hspi2);
/***********************************************************************************************************************
* PTR *

91
usrc/public_service/instance_init.hpp

@ -0,0 +1,91 @@
#define TMC5130_MOTOR_INITER(MOTOR_INDEX, _id) \
{ \
static TMC5130 motor; \
static StepMotorCtrlModule module; \
int subid = _id; \
\
TMC5130::cfg_t tmc5130cfg = { \
.spi = &TMC_MOTOR_SPI, \
.csgpio = MOTOR##MOTOR_INDEX##_CSN, \
.ennPin = MOTOR##MOTOR_INDEX##_ENN, \
.spi_mode_select = MOTOR##MOTOR_INDEX##_SPI_MODE_SELECT, \
}; \
motor.initialize(&tmc5130cfg); \
motor.setMotorShaft(false); \
\
static ZGPIO input[2]; \
input[0].initAsInput(MOTOR##MOTOR_INDEX##_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR##MOTOR_INDEX##_REFL_MIRROR); \
input[1].initAsInput(MOTOR##MOTOR_INDEX##_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR##MOTOR_INDEX##_REFR_MIRROR); \
\
StepMotorCtrlModule::config_t stepcfg = {0}; \
StepMotorCtrlModule::create_default_cfg(stepcfg); \
\
stepcfg.motor_shaft = MOTOR##MOTOR_INDEX##_MOTOR_SHAFT; \
stepcfg.motor_one_circle_pulse = MOTOR##MOTOR_INDEX##_MOTOR_ONE_CIRCLE_PULSE; \
stepcfg.motor_one_circle_pulse_denominator = MOTOR##MOTOR_INDEX##_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR; \
stepcfg.stepmotor_ihold = MOTOR##MOTOR_INDEX##_STEPMOTOR_IHOLD; \
stepcfg.stepmotor_irun = MOTOR##MOTOR_INDEX##_STEPMOTOR_IRUN; \
stepcfg.stepmotor_iholddelay = MOTOR##MOTOR_INDEX##_STEPMOTOR_IHOLDDELAY; \
stepcfg.stepmotor_iglobalscaler = MOTOR##MOTOR_INDEX##_STEPMOTOR_IGLOBALSCALER; \
stepcfg.motor_default_acc = MOTOR##MOTOR_INDEX##_MOTOR_DEFAULT_ACC; \
stepcfg.motor_default_dec = MOTOR##MOTOR_INDEX##_MOTOR_DEFAULT_DEC; \
stepcfg.motor_default_velocity = MOTOR##MOTOR_INDEX##_MOTOR_DEFAULT_VELOCITY; \
stepcfg.min_d = MOTOR##MOTOR_INDEX##_MIN_D; \
stepcfg.max_d = MOTOR##MOTOR_INDEX##_MAX_D; \
stepcfg.motor_run_to_zero_speed = MOTOR##MOTOR_INDEX##_MOTOR_RUN_TO_ZERO_SPEED; \
stepcfg.motor_run_to_zero_dec = MOTOR##MOTOR_INDEX##_MOTOR_RUN_TO_ZERO_DEC; \
stepcfg.motor_look_zero_edge_speed = MOTOR##MOTOR_INDEX##_MOTOR_LOOK_ZERO_EDGE_SPEED; \
stepcfg.motor_look_zero_edge_dec = MOTOR##MOTOR_INDEX##_MOTOR_LOOK_ZERO_EDGE_DEC; \
\
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg); \
GService::inst()->getZCanProtocolParser()->registerModule(&module); \
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion()); \
}
#define TMC4361_MOTOR_INITER(MOTOR_INDEX, _id) \
{ \
static TMC4361A motor; \
static StepMotorCtrlModule module; \
int subid = _id; \
\
TMC4361A::cfg_t motorcfg = { \
.spi = &TMC_MOTOR_SPI, \
.csgpio = MOTOR##MOTOR_INDEX##_CSN, \
.resetPin = MOTOR##MOTOR_INDEX##_nRESET_IO, \
.fREEZEPin = MOTOR##MOTOR_INDEX##_nFREEZE_IO, \
.ennPin = MOTOR##MOTOR_INDEX##_ENN, \
.driverIC_ennPin = MOTOR##MOTOR_INDEX##_SUB_IC_ENN_IO, \
.driverIC_resetPin = PinNull, \
}; \
\
motor.initialize(&motorcfg); \
\
static ZGPIO input[2]; \
input[0].initAsInput(MOTOR##MOTOR_INDEX##_REFL, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR##MOTOR_INDEX##_REFL_MIRROR); \
input[1].initAsInput(MOTOR##MOTOR_INDEX##_REFR, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR##MOTOR_INDEX##_REFR_MIRROR); \
\
StepMotorCtrlModule::config_t module_cfg = {0}; \
StepMotorCtrlModule::create_default_cfg(module_cfg); \
\
module_cfg.motor_shaft = MOTOR##MOTOR_INDEX##_MOTOR_SHAFT; \
module_cfg.motor_one_circle_pulse = MOTOR##MOTOR_INDEX##_MOTOR_ONE_CIRCLE_PULSE; \
module_cfg.motor_one_circle_pulse_denominator = MOTOR##MOTOR_INDEX##_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR; \
module_cfg.stepmotor_ihold = MOTOR##MOTOR_INDEX##_STEPMOTOR_IHOLD; \
module_cfg.stepmotor_irun = MOTOR##MOTOR_INDEX##_STEPMOTOR_IRUN; \
module_cfg.stepmotor_iholddelay = MOTOR##MOTOR_INDEX##_STEPMOTOR_IHOLDDELAY; \
module_cfg.stepmotor_iglobalscaler = MOTOR##MOTOR_INDEX##_STEPMOTOR_IGLOBALSCALER; \
module_cfg.motor_default_acc = MOTOR##MOTOR_INDEX##_MOTOR_DEFAULT_ACC; \
module_cfg.motor_default_dec = MOTOR##MOTOR_INDEX##_MOTOR_DEFAULT_DEC; \
module_cfg.motor_default_velocity = MOTOR##MOTOR_INDEX##_MOTOR_DEFAULT_VELOCITY; \
module_cfg.min_d = MOTOR##MOTOR_INDEX##_MIN_D; \
module_cfg.max_d = MOTOR##MOTOR_INDEX##_MAX_D; \
module_cfg.motor_run_to_zero_speed = MOTOR##MOTOR_INDEX##_MOTOR_RUN_TO_ZERO_SPEED; \
module_cfg.motor_run_to_zero_dec = MOTOR##MOTOR_INDEX##_MOTOR_RUN_TO_ZERO_DEC; \
module_cfg.motor_look_zero_edge_speed = MOTOR##MOTOR_INDEX##_MOTOR_LOOK_ZERO_EDGE_SPEED; \
module_cfg.motor_look_zero_edge_dec = MOTOR##MOTOR_INDEX##_MOTOR_LOOK_ZERO_EDGE_DEC; \
\
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &module_cfg); \
GService::inst()->getZCanProtocolParser()->registerModule(&module); \
\
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion()); \
}

1
usrc/public_service/public_service.hpp

@ -3,3 +3,4 @@
#include "common_hardware_init.h"
#include "gins.h"
#include "gservice.hpp"
#include "instance_init.hpp"

85
usrc/subboards/subboard20_plate_clamp_case/pri_board.h

@ -0,0 +1,85 @@
#pragma once
/***********************************************************************************************************************
* IO *
***********************************************************************************************************************/
#define EXT_INPUT_IO0 PinNull
#define EXT_INPUT_IO1 PinNull
#define EXT_INPUT_IO2 PinNull
#define EXT_INPUT_IO3 PinNull
#define EXT_INPUT_IO4 PinNull
#define EXT_INPUT_IO0_MIRROR true
#define EXT_INPUT_IO1_MIRROR true
#define EXT_INPUT_IO2_MIRROR true
#define EXT_INPUT_IO3_MIRROR true
#define EXT_INPUT_IO4_MIRROR true
#define TMC_MOTOR_SPI hspi1
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
#define MOTOR1_CSN PA4
#define MOTOR1_ENN PE3
#define MOTOR1_SPI_MODE_SELECT PinNull
#define MOTOR1_nFREEZE_IO PE12
#define MOTOR1_nRESET_IO PinNull
#define MOTOR1_SUB_IC_ENN_IO PE11
#define MOTOR1_REFL PD2
#define MOTOR1_REFR PD1
#define MOTOR1_REFL_MIRROR true
#define MOTOR1_REFR_MIRROR true
#define MOTOR1_MOTOR_SHAFT false //
#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE 80 // 3600 = 93圈, 3600/93 = 38.70967741935484
#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1 //
#define MOTOR1_STEPMOTOR_IHOLD 1
#define MOTOR1_STEPMOTOR_IRUN 8
#define MOTOR1_STEPMOTOR_IHOLDDELAY 100
#define MOTOR1_STEPMOTOR_IGLOBALSCALER 1
#define MOTOR1_MOTOR_DEFAULT_ACC 300
#define MOTOR1_MOTOR_DEFAULT_DEC 300
#define MOTOR1_MOTOR_DEFAULT_VELOCITY 500
#define MOTOR1_MIN_D 0
#define MOTOR1_MAX_D 0
#define MOTOR1_MOTOR_RUN_TO_ZERO_SPEED 100
#define MOTOR1_MOTOR_RUN_TO_ZERO_DEC 300
#define MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED 50
#define MOTOR1_MOTOR_LOOK_ZERO_EDGE_DEC 600
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
#define MOTOR2_CSN PA4
#define MOTOR2_ENN PE3
#define MOTOR2_SPI_MODE_SELECT PinNull
#define MOTOR2_nFREEZE_IO PE12
#define MOTOR2_nRESET_IO PinNull
#define MOTOR2_SUB_IC_ENN_IO PE11
#define MOTOR2_REFL PD2
#define MOTOR2_REFR PD1
#define MOTOR2_REFL_MIRROR true
#define MOTOR2_REFR_MIRROR true
#define MOTOR2_MOTOR_SHAFT false //
#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE 80 // 3600 = 93圈, 3600/93 = 38.70967741935484
#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 1
#define MOTOR2_MOTOR_DEFAULT_ACC 300
#define MOTOR2_MOTOR_DEFAULT_DEC 300
#define MOTOR2_MOTOR_DEFAULT_VELOCITY 500
#define MOTOR2_MIN_D 0
#define MOTOR2_MAX_D 0
#define MOTOR2_MOTOR_RUN_TO_ZERO_SPEED 100
#define MOTOR2_MOTOR_RUN_TO_ZERO_DEC 300
#define MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED 50
#define MOTOR2_MOTOR_LOOK_ZERO_EDGE_DEC 600

106
usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case.cpp

@ -0,0 +1,106 @@
#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 "ShakeModule"
using namespace iflytop;
static ZGPIO IO[5];
Subboard20PlateClampCase::Subboard20PlateClampCase(/* args */) {}
Subboard20PlateClampCase::~Subboard20PlateClampCase() {}
int32_t Subboard20PlateClampCase::getmoduleId(int off) { return zdevice_id_mgr_get_device_id() + off; }
Subboard20PlateClampCase *Subboard20PlateClampCase::ins() {
static Subboard20PlateClampCase instance;
return &instance;
}
/***********************************************************************************************************************
* PRI *
***********************************************************************************************************************/
int32_t Subboard20PlateClampCase::getid(int32_t *id) {
*id = getmoduleId(0);
return 0;
}
int32_t Subboard20PlateClampCase::module_xxx_reg(int32_t param_id, bool read, int32_t &val) { return err::kmodule_not_find_reg; }
int32_t Subboard20PlateClampCase::board_read_ext_io(int32_t ioindex, int32_t *val) {
if (ioindex < 0 || ioindex >= ZARRAY_SIZE(IO)) {
return err::kparam_out_of_range;
}
*val = IO[ioindex].getState();
return 0;
}
int32_t Subboard20PlateClampCase::board_write_ext_io(int32_t ioindex, int32_t val) { return 0; }
int32_t Subboard20PlateClampCase::board_read_muti_io(int32_t *val) {
for (int i = 0; i < ZARRAY_SIZE(IO); i++) {
*val |= IO[i].getState() << i;
}
return 0;
}
/***********************************************************************************************************************
* IMPL *
***********************************************************************************************************************/
void Subboard20PlateClampCase::initialize() {
IO[0].initAsInput(EXT_INPUT_IO0, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, EXT_INPUT_IO0_MIRROR);
IO[1].initAsInput(EXT_INPUT_IO1, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, EXT_INPUT_IO1_MIRROR);
IO[2].initAsInput(EXT_INPUT_IO2, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, EXT_INPUT_IO2_MIRROR);
IO[3].initAsInput(EXT_INPUT_IO3, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, EXT_INPUT_IO3_MIRROR);
IO[4].initAsInput(EXT_INPUT_IO4, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, EXT_INPUT_IO4_MIRROR);
GService::inst()->getZCanProtocolParser()->registerModule(this);
#if 1
/***********************************************************************************************************************
* ID1 *
***********************************************************************************************************************/
{ TMC5130_MOTOR_INITER(1, 1); }
{ TMC5130_MOTOR_INITER(2, 2); }
{
static PipetteModule module;
int subid = 2;
PipetteModule::config_t cfg = {
.limit_ul = 30,
};
PipetteModule::hardward_config_t hardwarecfg = {
.uart = &huart2,
.hdma_rx = hdma_usart2_rx,
.hdma_tx = hdma_usart2_tx,
};
module.initialize(getmoduleId(subid), &cfg, &hardwarecfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
}
{
static M3078CodeScanner codescanner;
int subid = 3;
static M3078CodeScanner::hardware_config_t cfg = {
.uart = &huart4,
.hdma_rx = nullptr,
.hdma_tx = nullptr,
.codeReadOkPin = PinNull,
.rstPin = PinNull,
.triggerPin = PD15,
};
codescanner.initialize(getmoduleId(subid), &cfg);
GService::inst()->getZCanProtocolParser()->registerModule(&codescanner);
}
#endif
}

44
usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case.hpp

@ -0,0 +1,44 @@
#include <stddef.h>
#include <stdio.h>
//
#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"
namespace iflytop {
class Subboard20PlateClampCase : public ZIBoard, public ZIModule {
ENABLE_MODULE(Subboard20PlateClampCase, kboard, 1);
private:
/* data */
public:
Subboard20PlateClampCase(/* args */);
~Subboard20PlateClampCase();
static Subboard20PlateClampCase *ins();
void initialize();
public:
/***********************************************************************************************************************
* ZIModule *
***********************************************************************************************************************/
virtual int32_t getid(int32_t *id);
virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t &val);
/***********************************************************************************************************************
* 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);
private:
int32_t getmoduleId(int off);
};
} // namespace iflytop

73
usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case_board.c

@ -0,0 +1,73 @@
#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();
}

12
usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case_board.h

@ -0,0 +1,12 @@
#pragma once
#include "main.h"
#ifdef __cplusplus
extern "C" {
#endif
void subboard20_plate_clamp_case_board_init();
#ifdef __cplusplus
}
#endif

139
usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp

@ -55,142 +55,9 @@ void Subboard30ShakeModule::initialize() {
#if 1
/***********************************************************************************************************************
* ID1 *
***********************************************************************************************************************/
{
static TMC5130 motor;
static StepMotorCtrlModule module;
int subid = 1;
TMC5130::cfg_t tmc5130cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR1_CSN, //
.ennPin = MOTOR1_ENN, //
.spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
};
motor.initialize(&tmc5130cfg);
motor.setMotorShaft(false);
static ZGPIO input[2];
input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFL_MIRROR);
input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFR_MIRROR);
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.motor_shaft = MOTOR1_MOTOR_SHAFT;
stepcfg.motor_one_circle_pulse = MOTOR1_MOTOR_ONE_CIRCLE_PULSE;
stepcfg.motor_one_circle_pulse_denominator = MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
stepcfg.stepmotor_ihold = MOTOR1_STEPMOTOR_IHOLD;
stepcfg.stepmotor_irun = MOTOR1_STEPMOTOR_IRUN;
stepcfg.stepmotor_iholddelay = MOTOR1_STEPMOTOR_IHOLDDELAY;
stepcfg.stepmotor_iglobalscaler = MOTOR1_STEPMOTOR_IGLOBALSCALER;
stepcfg.motor_default_acc = MOTOR1_MOTOR_DEFAULT_ACC;
stepcfg.motor_default_dec = MOTOR1_MOTOR_DEFAULT_DEC;
stepcfg.motor_default_velocity = MOTOR1_MOTOR_DEFAULT_VELOCITY;
stepcfg.min_d = MOTOR1_MIN_D;
stepcfg.max_d = MOTOR1_MAX_D;
stepcfg.motor_run_to_zero_speed = MOTOR1_MOTOR_RUN_TO_ZERO_SPEED;
stepcfg.motor_run_to_zero_dec = MOTOR1_MOTOR_RUN_TO_ZERO_DEC;
stepcfg.motor_look_zero_edge_speed = MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED;
stepcfg.motor_look_zero_edge_dec = MOTOR1_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
/***********************************************************************************************************************
* ID2 *
***********************************************************************************************************************/
{
static TMC5130 motor;
static StepMotorCtrlModule module;
int subid = 2;
TMC5130::cfg_t tmc5130cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR2_CSN, //
.ennPin = MOTOR2_ENN, //
.spi_mode_select = MOTOR2_SPI_MODE_SELECT, //
};
motor.initialize(&tmc5130cfg);
motor.setMotorShaft(false);
static ZGPIO input[2];
input[0].initAsInput(MOTOR2_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR2_REFL_MIRROR);
input[1].initAsInput(MOTOR2_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR2_REFR_MIRROR);
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.motor_shaft = MOTOR2_MOTOR_SHAFT;
stepcfg.motor_one_circle_pulse = MOTOR2_MOTOR_ONE_CIRCLE_PULSE;
stepcfg.motor_one_circle_pulse_denominator = MOTOR2_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
stepcfg.stepmotor_ihold = MOTOR2_STEPMOTOR_IHOLD;
stepcfg.stepmotor_irun = MOTOR2_STEPMOTOR_IRUN;
stepcfg.stepmotor_iholddelay = MOTOR2_STEPMOTOR_IHOLDDELAY;
stepcfg.stepmotor_iglobalscaler = MOTOR2_STEPMOTOR_IGLOBALSCALER;
stepcfg.motor_default_acc = MOTOR2_MOTOR_DEFAULT_ACC;
stepcfg.motor_default_dec = MOTOR2_MOTOR_DEFAULT_DEC;
stepcfg.motor_default_velocity = MOTOR2_MOTOR_DEFAULT_VELOCITY;
stepcfg.min_d = MOTOR2_MIN_D;
stepcfg.max_d = MOTOR2_MAX_D;
stepcfg.motor_run_to_zero_speed = MOTOR2_MOTOR_RUN_TO_ZERO_SPEED;
stepcfg.motor_run_to_zero_dec = MOTOR2_MOTOR_RUN_TO_ZERO_DEC;
stepcfg.motor_look_zero_edge_speed = MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED;
stepcfg.motor_look_zero_edge_dec = MOTOR2_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
/***********************************************************************************************************************
* ID3 *
***********************************************************************************************************************/
{
static TMC5130 motor;
static StepMotorCtrlModule module;
int subid = 3;
TMC5130::cfg_t tmc5130cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR3_CSN, //
.ennPin = MOTOR3_ENN, //
.spi_mode_select = MOTOR3_SPI_MODE_SELECT, //
};
motor.initialize(&tmc5130cfg);
motor.setMotorShaft(false);
static ZGPIO input[2];
input[0].initAsInput(MOTOR3_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR3_REFL_MIRROR);
input[1].initAsInput(MOTOR3_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR3_REFR_MIRROR);
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.motor_shaft = MOTOR3_MOTOR_SHAFT;
stepcfg.motor_one_circle_pulse = MOTOR3_MOTOR_ONE_CIRCLE_PULSE;
stepcfg.motor_one_circle_pulse_denominator = MOTOR3_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
stepcfg.stepmotor_ihold = MOTOR3_STEPMOTOR_IHOLD;
stepcfg.stepmotor_irun = MOTOR3_STEPMOTOR_IRUN;
stepcfg.stepmotor_iholddelay = MOTOR3_STEPMOTOR_IHOLDDELAY;
stepcfg.stepmotor_iglobalscaler = MOTOR3_STEPMOTOR_IGLOBALSCALER;
stepcfg.motor_default_acc = MOTOR3_MOTOR_DEFAULT_ACC;
stepcfg.motor_default_dec = MOTOR3_MOTOR_DEFAULT_DEC;
stepcfg.motor_default_velocity = MOTOR3_MOTOR_DEFAULT_VELOCITY;
stepcfg.min_d = MOTOR3_MIN_D;
stepcfg.max_d = MOTOR3_MAX_D;
stepcfg.motor_run_to_zero_speed = MOTOR3_MOTOR_RUN_TO_ZERO_SPEED;
stepcfg.motor_run_to_zero_dec = MOTOR3_MOTOR_RUN_TO_ZERO_DEC;
stepcfg.motor_look_zero_edge_speed = MOTOR3_MOTOR_LOOK_ZERO_EDGE_SPEED;
stepcfg.motor_look_zero_edge_dec = MOTOR3_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
TMC5130_MOTOR_INITER(/*motorid:*/ 1, /*moduleid:*/ 1);
TMC5130_MOTOR_INITER(/*motorid:*/ 2, /*moduleid:*/ 2);
TMC5130_MOTOR_INITER(/*motorid:*/ 3, /*moduleid:*/ 3);
static FeiTeServoMotor feiteservomotor_bus; // 飞特舵机总线

140
usrc/subboards/subboard60_inlet_and_outlet_module/subboard60_inlet_and_outlet_module.cpp

@ -58,143 +58,9 @@ void Subboard60InjectAndOutletModule::initialize() {
GService::inst()->getZCanProtocolParser()->registerModule(this);
#if 1
/***********************************************************************************************************************
* ID1 *
***********************************************************************************************************************/
{
static TMC5130 motor;
static StepMotorCtrlModule module;
int subid = 1;
TMC5130::cfg_t tmc5130cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR1_CSN, //
.ennPin = MOTOR1_ENN, //
.spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
};
motor.initialize(&tmc5130cfg);
motor.setMotorShaft(false);
static ZGPIO input[2];
input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFL_MIRROR);
input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFR_MIRROR);
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.motor_shaft = MOTOR1_MOTOR_SHAFT;
stepcfg.motor_one_circle_pulse = MOTOR1_MOTOR_ONE_CIRCLE_PULSE;
stepcfg.motor_one_circle_pulse_denominator = MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
stepcfg.stepmotor_ihold = MOTOR1_STEPMOTOR_IHOLD;
stepcfg.stepmotor_irun = MOTOR1_STEPMOTOR_IRUN;
stepcfg.stepmotor_iholddelay = MOTOR1_STEPMOTOR_IHOLDDELAY;
stepcfg.stepmotor_iglobalscaler = MOTOR1_STEPMOTOR_IGLOBALSCALER;
stepcfg.motor_default_acc = MOTOR1_MOTOR_DEFAULT_ACC;
stepcfg.motor_default_dec = MOTOR1_MOTOR_DEFAULT_DEC;
stepcfg.motor_default_velocity = MOTOR1_MOTOR_DEFAULT_VELOCITY;
stepcfg.min_d = MOTOR1_MIN_D;
stepcfg.max_d = MOTOR1_MAX_D;
stepcfg.motor_run_to_zero_speed = MOTOR1_MOTOR_RUN_TO_ZERO_SPEED;
stepcfg.motor_run_to_zero_dec = MOTOR1_MOTOR_RUN_TO_ZERO_DEC;
stepcfg.motor_look_zero_edge_speed = MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED;
stepcfg.motor_look_zero_edge_dec = MOTOR1_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
/***********************************************************************************************************************
* ID2 *
***********************************************************************************************************************/
{
static TMC5130 motor;
static StepMotorCtrlModule module;
int subid = 2;
TMC5130::cfg_t tmc5130cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR2_CSN, //
.ennPin = MOTOR2_ENN, //
.spi_mode_select = MOTOR2_SPI_MODE_SELECT, //
};
motor.initialize(&tmc5130cfg);
motor.setMotorShaft(false);
static ZGPIO input[2];
input[0].initAsInput(MOTOR2_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR2_REFL_MIRROR);
input[1].initAsInput(MOTOR2_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR2_REFR_MIRROR);
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.motor_shaft = MOTOR2_MOTOR_SHAFT;
stepcfg.motor_one_circle_pulse = MOTOR2_MOTOR_ONE_CIRCLE_PULSE;
stepcfg.motor_one_circle_pulse_denominator = MOTOR2_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
stepcfg.stepmotor_ihold = MOTOR2_STEPMOTOR_IHOLD;
stepcfg.stepmotor_irun = MOTOR2_STEPMOTOR_IRUN;
stepcfg.stepmotor_iholddelay = MOTOR2_STEPMOTOR_IHOLDDELAY;
stepcfg.stepmotor_iglobalscaler = MOTOR2_STEPMOTOR_IGLOBALSCALER;
stepcfg.motor_default_acc = MOTOR2_MOTOR_DEFAULT_ACC;
stepcfg.motor_default_dec = MOTOR2_MOTOR_DEFAULT_DEC;
stepcfg.motor_default_velocity = MOTOR2_MOTOR_DEFAULT_VELOCITY;
stepcfg.min_d = MOTOR2_MIN_D;
stepcfg.max_d = MOTOR2_MAX_D;
stepcfg.motor_run_to_zero_speed = MOTOR2_MOTOR_RUN_TO_ZERO_SPEED;
stepcfg.motor_run_to_zero_dec = MOTOR2_MOTOR_RUN_TO_ZERO_DEC;
stepcfg.motor_look_zero_edge_speed = MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED;
stepcfg.motor_look_zero_edge_dec = MOTOR2_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
/***********************************************************************************************************************
* ID3 *
***********************************************************************************************************************/
{
static TMC5130 motor;
static StepMotorCtrlModule module;
int subid = 3;
TMC5130::cfg_t tmc5130cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR3_CSN, //
.ennPin = MOTOR3_ENN, //
.spi_mode_select = MOTOR3_SPI_MODE_SELECT, //
};
motor.initialize(&tmc5130cfg);
motor.setMotorShaft(false);
static ZGPIO input[2];
input[0].initAsInput(MOTOR3_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR3_REFL_MIRROR);
input[1].initAsInput(MOTOR3_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR3_REFR_MIRROR);
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.motor_shaft = MOTOR3_MOTOR_SHAFT;
stepcfg.motor_one_circle_pulse = MOTOR3_MOTOR_ONE_CIRCLE_PULSE;
stepcfg.motor_one_circle_pulse_denominator = MOTOR3_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
stepcfg.stepmotor_ihold = MOTOR3_STEPMOTOR_IHOLD;
stepcfg.stepmotor_irun = MOTOR3_STEPMOTOR_IRUN;
stepcfg.stepmotor_iholddelay = MOTOR3_STEPMOTOR_IHOLDDELAY;
stepcfg.stepmotor_iglobalscaler = MOTOR3_STEPMOTOR_IGLOBALSCALER;
stepcfg.motor_default_acc = MOTOR3_MOTOR_DEFAULT_ACC;
stepcfg.motor_default_dec = MOTOR3_MOTOR_DEFAULT_DEC;
stepcfg.motor_default_velocity = MOTOR3_MOTOR_DEFAULT_VELOCITY;
stepcfg.min_d = MOTOR3_MIN_D;
stepcfg.max_d = MOTOR3_MAX_D;
stepcfg.motor_run_to_zero_speed = MOTOR3_MOTOR_RUN_TO_ZERO_SPEED;
stepcfg.motor_run_to_zero_dec = MOTOR3_MOTOR_RUN_TO_ZERO_DEC;
stepcfg.motor_look_zero_edge_speed = MOTOR3_MOTOR_LOOK_ZERO_EDGE_SPEED;
stepcfg.motor_look_zero_edge_dec = MOTOR3_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
TMC5130_MOTOR_INITER(/*motorid:*/ 1, /*moduleid:*/ 1);
TMC5130_MOTOR_INITER(/*motorid:*/ 2, /*moduleid:*/ 2);
TMC5130_MOTOR_INITER(/*motorid:*/ 3, /*moduleid:*/ 3);
{
static M3078CodeScanner codescanner;

52
usrc/subboards/subboard70_incubation_turntable/subboard70_incubation_turntable.cpp

@ -18,7 +18,7 @@ static ZGPIO IO[5];
Subboard70IncubationTurntable::Subboard70IncubationTurntable(/* args */) {}
Subboard70IncubationTurntable::~Subboard70IncubationTurntable() {}
int32_t Subboard70IncubationTurntable::getmoduleId(int off) { return zdevice_id_mgr_get_device_id() + off; }
int32_t Subboard70IncubationTurntable::getmoduleId(int off) { return zdevice_id_mgr_get_device_id() + off; }
Subboard70IncubationTurntable *Subboard70IncubationTurntable::ins() {
static Subboard70IncubationTurntable instance;
return &instance;
@ -61,55 +61,7 @@ void Subboard70IncubationTurntable::initialize() {
#if 1
/***********************************************************************************************************************
* ID1 *
***********************************************************************************************************************/
{
static TMC4361A motor;
static StepMotorCtrlModule module;
int subid = 1;
TMC4361A::cfg_t motorcfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR1_CSN, //
.resetPin = MOTOR1_nRESET_IO, //
.fREEZEPin = MOTOR1_nFREEZE_IO, //
.ennPin = MOTOR1_ENN, //
.driverIC_ennPin = MOTOR1_SUB_IC_ENN_IO, //
.driverIC_resetPin = PinNull, //
};
motor.initialize(&motorcfg);
static ZGPIO input[2];
input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFL_MIRROR);
input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFR_MIRROR);
StepMotorCtrlModule::config_t module_cfg = {0};
StepMotorCtrlModule::create_default_cfg(module_cfg);
module_cfg.motor_shaft = MOTOR1_MOTOR_SHAFT;
module_cfg.motor_one_circle_pulse = MOTOR1_MOTOR_ONE_CIRCLE_PULSE;
module_cfg.motor_one_circle_pulse_denominator = MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
module_cfg.stepmotor_ihold = MOTOR1_STEPMOTOR_IHOLD;
module_cfg.stepmotor_irun = MOTOR1_STEPMOTOR_IRUN;
module_cfg.stepmotor_iholddelay = MOTOR1_STEPMOTOR_IHOLDDELAY;
module_cfg.stepmotor_iglobalscaler = MOTOR1_STEPMOTOR_IGLOBALSCALER;
module_cfg.motor_default_acc = MOTOR1_MOTOR_DEFAULT_ACC;
module_cfg.motor_default_dec = MOTOR1_MOTOR_DEFAULT_DEC;
module_cfg.motor_default_velocity = MOTOR1_MOTOR_DEFAULT_VELOCITY;
module_cfg.min_d = MOTOR1_MIN_D;
module_cfg.max_d = MOTOR1_MAX_D;
module_cfg.motor_run_to_zero_speed = MOTOR1_MOTOR_RUN_TO_ZERO_SPEED;
module_cfg.motor_run_to_zero_dec = MOTOR1_MOTOR_RUN_TO_ZERO_DEC;
module_cfg.motor_look_zero_edge_speed = MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED;
module_cfg.motor_look_zero_edge_dec = MOTOR1_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &module_cfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
TMC4361_MOTOR_INITER(/*motorid*/ 1, /*moduleid*/ 1);
#endif
}

44
usrc/subboards/subboard80_cliptip/subboard80_cliptip.cpp

@ -65,49 +65,7 @@ void Subboard80Cliptip::initialize() {
/***********************************************************************************************************************
* ID1 *
***********************************************************************************************************************/
{
static TMC5130 motor;
static StepMotorCtrlModule module;
int subid = 1;
TMC5130::cfg_t tmc5130cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR1_CSN, //
.ennPin = MOTOR1_ENN, //
.spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
};
motor.initialize(&tmc5130cfg);
motor.setMotorShaft(false);
static ZGPIO input[2];
input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFL_MIRROR);
input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, MOTOR1_REFR_MIRROR);
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.motor_shaft = MOTOR1_MOTOR_SHAFT;
stepcfg.motor_one_circle_pulse = MOTOR1_MOTOR_ONE_CIRCLE_PULSE;
stepcfg.motor_one_circle_pulse_denominator = MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR;
stepcfg.stepmotor_ihold = MOTOR1_STEPMOTOR_IHOLD;
stepcfg.stepmotor_irun = MOTOR1_STEPMOTOR_IRUN;
stepcfg.stepmotor_iholddelay = MOTOR1_STEPMOTOR_IHOLDDELAY;
stepcfg.stepmotor_iglobalscaler = MOTOR1_STEPMOTOR_IGLOBALSCALER;
stepcfg.motor_default_acc = MOTOR1_MOTOR_DEFAULT_ACC;
stepcfg.motor_default_dec = MOTOR1_MOTOR_DEFAULT_DEC;
stepcfg.motor_default_velocity = MOTOR1_MOTOR_DEFAULT_VELOCITY;
stepcfg.min_d = MOTOR1_MIN_D;
stepcfg.max_d = MOTOR1_MAX_D;
stepcfg.motor_run_to_zero_speed = MOTOR1_MOTOR_RUN_TO_ZERO_SPEED;
stepcfg.motor_run_to_zero_dec = MOTOR1_MOTOR_RUN_TO_ZERO_DEC;
stepcfg.motor_look_zero_edge_speed = MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED;
stepcfg.motor_look_zero_edge_dec = MOTOR1_MOTOR_LOOK_ZERO_EDGE_DEC;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
TMC5130_MOTOR_INITER(/*motorid:*/ 1, /*moduleid:*/ 1);
{
static PipetteModule module;

Loading…
Cancel
Save