10 changed files with 56 additions and 366 deletions
-
2a8000_protocol
-
2sdk
-
4usrc/main.cpp
-
58usrc/subboards/subboard10_hbot/pri_board.h
-
117usrc/subboards/subboard10_hbot/subboard10_hbot.cpp
-
25usrc/subboards/subboard10_hbot/subboard10_hbot.hpp
-
41usrc/subboards/subboard10_hbot/subboard10_hbot_board.c
-
12usrc/subboards/subboard10_hbot/subboard10_hbot_board.h
-
60usrc/subboards/subboard10_hbot_v2/pri_board.h
-
75usrc/subboards/subboard10_hbot_v2/subboard10_hbot_v2.cpp
@ -1 +1 @@ |
|||||
Subproject commit e4a80570d108c0a711401236f95bbc95b4ae7ecf |
|
||||
|
Subproject commit 044d6a286e8a6e7298cc15e5f5746f401ad68b7a |
@ -1 +1 @@ |
|||||
Subproject commit e5ce8da2008bafe1ec519432807a1dfbfd12f17e |
|
||||
|
Subproject commit 0f185e7634bc9edb53206e3219a7021bca3abd9f |
@ -1,58 +0,0 @@ |
|||||
#pragma once |
|
||||
|
|
||||
/*********************************************************************************************************************** |
|
||||
* 板载扩展IO * |
|
||||
***********************************************************************************************************************/ |
|
||||
#define EXT_INPUT_IO0 PD4, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true |
|
||||
#define EXT_INPUT_IO1 PD5, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true |
|
||||
#define EXT_INPUT_IO2 PD6, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true |
|
||||
#define EXT_INPUT_IO3 PD7, 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 |
|
||||
|
|
||||
/*********************************************************************************************************************** |
|
||||
* 左右移动 * |
|
||||
***********************************************************************************************************************/ |
|
||||
|
|
||||
// MOTOR1 |
|
||||
#define TMC_MOTOR1_CHANNEL 1 |
|
||||
#define TMC_MOTOR1_SPI_SELECT1_IO PA4 |
|
||||
#define TMC_MOTOR1_nFREEZE_IO PC2 |
|
||||
#define TMC_MOTOR1_nRESET_IO PB3 |
|
||||
#define TMC_MOTOR1_SUB_IC_ENN_IO PC3 |
|
||||
#define TMC_MOTOR1_ENN_IO // unused |
|
||||
|
|
||||
// MOTOR2 |
|
||||
#define TMC_MOTOR2_CHANNEL 2 |
|
||||
#define TMC_MOTOR2_SPI_SELECT1_IO PA8 |
|
||||
#define TMC_MOTOR2_nFREEZE_IO PC6 |
|
||||
#define TMC_MOTOR2_nRESET_IO PB2 |
|
||||
#define TMC_MOTOR2_SUB_IC_ENN_IO PC7 |
|
||||
#define TMC_MOTOR2_ENN_IO // unused |
|
||||
|
|
||||
#define ARM_X_ZERO PD0 |
|
||||
#define ARM_X_LIMIT PD1 |
|
||||
#define ARM_Y_ZERO PD2 |
|
||||
#define ARM_Y_LIMIT PD3 |
|
||||
|
|
||||
#define ARM_SENSOR5_GPIO PD4 |
|
||||
#define ARM_SENSOR6_GPIO PD5 |
|
||||
#define ARM_SENSOR7_GPIO PD6 |
|
||||
#define ARM_SENSOR8_GPIO PD7 |
|
@ -1,117 +0,0 @@ |
|||||
#include "subboard10_hbot.hpp"
|
|
||||
extern "C" { |
|
||||
#include "subboard10_hbot_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"
|
|
||||
#include "sdk\components\xy_robot_ctrl_module\xy_robot_ctrl_module.hpp"
|
|
||||
|
|
||||
#define TAG "Subboard10Hbot"
|
|
||||
|
|
||||
using namespace iflytop; |
|
||||
|
|
||||
/***********************************************************************************************************************
|
|
||||
* IMPL * |
|
||||
***********************************************************************************************************************/ |
|
||||
void Subboard10Hbot::initialize() { |
|
||||
IO_INIT(); |
|
||||
GService::inst()->getZCanProtocolParser()->registerModule(this); |
|
||||
#if 1
|
|
||||
/***********************************************************************************************************************
|
|
||||
* ID1 * |
|
||||
***********************************************************************************************************************/ |
|
||||
static XYRobotCtrlModule xyRobotCtrlModule; |
|
||||
static TMC4361A motora; // 1
|
|
||||
static TMC4361A motorb; // 2
|
|
||||
{ |
|
||||
TMC4361A::cfg_t cfg = { |
|
||||
.spi = &TMC_MOTOR_SPI, //
|
|
||||
.csgpio = TMC_MOTOR1_SPI_SELECT1_IO, //
|
|
||||
.resetPin = TMC_MOTOR1_nRESET_IO, //
|
|
||||
.fREEZEPin = TMC_MOTOR1_nFREEZE_IO, //
|
|
||||
.ennPin = PinNull, //
|
|
||||
.driverIC_ennPin = TMC_MOTOR1_SUB_IC_ENN_IO, //
|
|
||||
.driverIC_resetPin = PinNull, //
|
|
||||
}; |
|
||||
motora.initialize(&cfg); |
|
||||
motora.setMotorShaft(false); |
|
||||
motora.setGlobalScale(31); |
|
||||
ZLOGI(TAG, "motora initialize TMC4361A:%x DriverIC:%x", motora.readICVersion(), motora.driverIC_readICVersion()); |
|
||||
} |
|
||||
|
|
||||
{ |
|
||||
TMC4361A::cfg_t cfg = { |
|
||||
.spi = &TMC_MOTOR_SPI, //
|
|
||||
.csgpio = TMC_MOTOR2_SPI_SELECT1_IO, //
|
|
||||
.resetPin = TMC_MOTOR2_nRESET_IO, //
|
|
||||
.fREEZEPin = TMC_MOTOR2_nFREEZE_IO, //
|
|
||||
.ennPin = PinNull, //
|
|
||||
.driverIC_ennPin = TMC_MOTOR2_SUB_IC_ENN_IO, //
|
|
||||
.driverIC_resetPin = PinNull, //
|
|
||||
}; |
|
||||
motorb.initialize(&cfg); |
|
||||
motorb.setMotorShaft(false); |
|
||||
motorb.setGlobalScale(31); |
|
||||
ZLOGI(TAG, "motorb initialize TMC4361A:%x DriverIC:%x", motorb.readICVersion(), motorb.driverIC_readICVersion()); |
|
||||
} |
|
||||
|
|
||||
motora.setAcceleration(300); |
|
||||
motora.setDeceleration(300); |
|
||||
motora.setIHOLD_IRUN(0, 4, 10); |
|
||||
|
|
||||
motorb.setAcceleration(300); |
|
||||
motorb.setDeceleration(300); |
|
||||
motorb.setIHOLD_IRUN(0, 4, 10); |
|
||||
|
|
||||
motora.rotate(0); |
|
||||
motorb.rotate(0); |
|
||||
|
|
||||
/*******************************************************************************
|
|
||||
* zcanXYRobotCtrlModule * |
|
||||
*******************************************************************************/ |
|
||||
static ZGPIO input[4]; |
|
||||
input[0].initAsInput(ARM_X_ZERO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
||||
input[1].initAsInput(ARM_Y_ZERO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
||||
input[2].initAsInput(ARM_X_LIMIT, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
||||
input[3].initAsInput(ARM_Y_LIMIT, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
||||
|
|
||||
static XYRobotCtrlModule::config_t xy_defaultcfg; |
|
||||
XYRobotCtrlModule::create_default_cfg(xy_defaultcfg); |
|
||||
xy_defaultcfg.configInited = true; |
|
||||
xy_defaultcfg.robot_type = 1; |
|
||||
|
|
||||
xy_defaultcfg.robot_type = XYRobotCtrlModule::khbot; |
|
||||
xy_defaultcfg.x_shaft = 0; |
|
||||
xy_defaultcfg.y_shaft = 1; |
|
||||
xy_defaultcfg.ihold = 3; |
|
||||
xy_defaultcfg.irun = 31; |
|
||||
xy_defaultcfg.iholddelay = 100; |
|
||||
xy_defaultcfg.distance_scale = 7344; |
|
||||
xy_defaultcfg.shift_x = 0; |
|
||||
xy_defaultcfg.shift_y = 0; |
|
||||
|
|
||||
// limit
|
|
||||
xy_defaultcfg.acc = 400; |
|
||||
xy_defaultcfg.dec = 400; |
|
||||
xy_defaultcfg.min_x = 0; |
|
||||
xy_defaultcfg.max_x = 0; |
|
||||
xy_defaultcfg.min_y = 0; |
|
||||
xy_defaultcfg.max_y = 0; |
|
||||
xy_defaultcfg.default_velocity = 300; |
|
||||
|
|
||||
xy_defaultcfg.run_to_zero_speed = 40; |
|
||||
xy_defaultcfg.look_zero_edge_speed = 10; |
|
||||
|
|
||||
xyRobotCtrlModule.initialize(getmoduleId(1), &motora, &motorb, &input[0], 4, xy_defaultcfg); |
|
||||
|
|
||||
GService::inst()->registerModule(&xyRobotCtrlModule); |
|
||||
|
|
||||
#endif
|
|
||||
} |
|
@ -1,25 +0,0 @@ |
|||||
#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"
|
|
||||
#include "public_service/public_service.hpp"
|
|
||||
|
|
||||
namespace iflytop { |
|
||||
class Subboard10Hbot : public ExtBoardImpl { |
|
||||
public: |
|
||||
static Subboard10Hbot *ins() { |
|
||||
static Subboard10Hbot instance; |
|
||||
return &instance; |
|
||||
} |
|
||||
|
|
||||
void initialize(); |
|
||||
}; |
|
||||
|
|
||||
} // namespace iflytop
|
|
||||
|
|
@ -1,41 +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; |
|
||||
} |
|
||||
/** |
|
||||
* @brief 板夹仓初始化 |
|
||||
*/ |
|
||||
|
|
||||
void subboard10_hbot_board_init() { |
|
||||
common_hardware_init(); |
|
||||
MX_SPI1_Init(); |
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
#pragma once |
|
||||
#include "main.h" |
|
||||
|
|
||||
#ifdef __cplusplus |
|
||||
extern "C" { |
|
||||
#endif |
|
||||
|
|
||||
void subboard10_hbot_board_init(); |
|
||||
|
|
||||
#ifdef __cplusplus |
|
||||
} |
|
||||
#endif |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue