Browse Source

update

master
zhaohe 2 years ago
parent
commit
082e9e9a12
  1. 10
      .cproject
  2. 2
      .project
  3. 0
      graphite_digester_io_board.cfg
  4. 4
      graphite_digester_io_board.ioc
  5. 12
      graphite_digester_io_board.launch
  6. 2
      sdk
  7. 95
      usrc/board.h
  8. 92
      usrc/main.cpp
  9. 4
      usrc/project_configs.h

10
.cproject

@ -30,7 +30,7 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat.176411214" name="Use float with scanf from newlib-nano (-u _scanf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.164943344" name="Use float with printf from newlib-nano (-u _printf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.553838709" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
<builder buildPath="${workspace_loc:/graphite_digester_tmc5160}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.764087106" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
<builder buildPath="${workspace_loc:/graphite_digester_io_board}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.764087106" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1243726437" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.1007535807" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g3" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.definedsymbols.830905432" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.definedsymbols" valueType="definedSymbols">
@ -147,7 +147,7 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.506604305" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F407VETx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy | ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/CMSIS/Include || || || USE_HAL_DRIVER | STM32F407xx || || Drivers | Core/Startup | Middlewares | Core || || || ${workspace_loc:/${ProjName}/STM32F407VETX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.540585524" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="144" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.959571701" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
<builder buildPath="${workspace_loc:/graphite_digester_tmc5160}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.948513973" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
<builder buildPath="${workspace_loc:/graphite_digester_io_board}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.948513973" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1716174684" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.401584422" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g0" valueType="enumerated"/>
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.1470391345" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
@ -222,7 +222,7 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.pathentry"/>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="graphite_digester_tmc5160.null.1922813466" name="graphite_digester_tmc5160"/>
<project id="graphite_digester_io_board.null.1922813466" name="graphite_digester_io_board"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
@ -243,10 +243,10 @@
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/graphite_digester_tmc5160"/>
<resource resourceType="PROJECT" workspacePath="/graphite_digester_io_board"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/graphite_digester_tmc5160"/>
<resource resourceType="PROJECT" workspacePath="/graphite_digester_io_board"/>
</configuration>
</storageModule>
</cproject>

2
.project

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>graphite_digester_tmc5160</name>
<name>graphite_digester_io_board</name>
<comment></comment>
<projects>
</projects>

0
graphite_digester_tmc5160.cfg → graphite_digester_io_board.cfg

4
graphite_digester_tmc5160.ioc → graphite_digester_io_board.ioc

@ -217,8 +217,8 @@ ProjectManager.MainLocation=Core/Src
ProjectManager.NoMain=false
ProjectManager.PreviousToolchain=STM32CubeIDE
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=graphite_digester_tmc5160.ioc
ProjectManager.ProjectName=graphite_digester_tmc5160
ProjectManager.ProjectFileName=graphite_digester_io_board.ioc
ProjectManager.ProjectName=graphite_digester_io_board
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x1000

12
graphite_digester_tmc5160.launch → graphite_digester_io_board.launch

@ -12,7 +12,7 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.enabled" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.value" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;Debug/graphite_digester_tmc5160.elf&quot;,&quot;fProjectName&quot;:&quot;graphite_digester_tmc5160&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;Debug/graphite_digester_io_board.elf&quot;,&quot;fProjectName&quot;:&quot;graphite_digester_io_board&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
@ -37,7 +37,7 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.OPENOCD_NAME" value="&quot;${stm32cubeide_openocd_path}\openocd.exe&quot;"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.OPENOCD_OTHER_OPTIONS" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.OPENOCD_RESTART_CONFIGURATIONS" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset halt&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Reset halt&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Reset halt&quot;,&quot;fLaunchAttribute&quot;:&quot;monitor reset halt&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset halt&quot;],&quot;fCmdOptions&quot;:[]},{&quot;fDisplayName&quot;:&quot;Reset init&quot;,&quot;fLaunchAttribute&quot;:&quot;monitor reset init&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset init&quot;],&quot;fCmdOptions&quot;:[]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true},{&quot;fDisplayName&quot;:&quot;Reset init&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Reset init&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Reset halt&quot;,&quot;fLaunchAttribute&quot;:&quot;monitor reset halt&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset halt&quot;],&quot;fCmdOptions&quot;:[]},{&quot;fDisplayName&quot;:&quot;Reset init&quot;,&quot;fLaunchAttribute&quot;:&quot;monitor reset init&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset init&quot;],&quot;fCmdOptions&quot;:[]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.OPENOCD_SCRIPT" value="${ProjDirPath}\graphite_digester_tmc5160 Debug.cfg"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.OPENOCD_SCRIPT" value="${ProjDirPath}\graphite_digester_io_board Debug.cfg"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.OPENOCD_SCRIPT_CHOICE" value="automated"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.openocdenable_rtos" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
@ -47,7 +47,7 @@
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="D:\workspace\project_boditech_vidas_a8000_v2\graphite_digester_tmc5160\Debug\st-link_gdbserver_log.txt"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="D:\workspace\project_boditech_vidas_a8000_v2\graphite_digester_io_board\Debug\st-link_gdbserver_log.txt"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="disable"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="system_reset"/>
@ -82,13 +82,13 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/graphite_digester_tmc5160.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="graphite_digester_tmc5160"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/graphite_digester_io_board.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="graphite_digester_io_board"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1853947771"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/graphite_digester_tmc5160"/>
<listEntry value="/graphite_digester_io_board"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>

2
sdk

@ -1 +1 @@
Subproject commit cc77054006205d1a3d1b238d6ecdd59038c007d6
Subproject commit 1163d8803f5a9bd75ec05d8ab6104148056801c9

95
usrc/board.h

@ -1,41 +1,56 @@
#pragma once
#define TMC_MOTOR_SPI hspi1
// #define TMC_DIAG1 PB0
// #define TMC_DIAG0 PB1
#define ID0_IO PC0
#define ID1_IO PC1
#define ID2_IO PC2
#define ID3_IO PC3
#define ID4_IO PC4
#define SENSOR_INT0 PD0
#define SENSOR_INT1 PD1
#define SENSOR_INT2 PD2
#define SENSOR_INT3 PD3
#define SENSOR_INT4 PD4
#define SENSOR_INT5 PD5
#define SENSOR_INT6 PD6
#define SENSOR_INT7 PD7
#define SENSOR_INT8 PD8
#define SENSOR_INT9 PD9
// MOTOR0
#define MOTOR0_CSN PA4
#define MOTOR0_ENN PB7
#define MOTOR0_SPI_MODE_SELECT PB4
#define MOTOR0_REFL SENSOR_INT0
#define MOTOR0_REFR SENSOR_INT1
// 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"
#define TAG_SOLENOID_VALVE00 PD0
#define TAG_SOLENOID_VALVE01 PD1
#define TAG_SOLENOID_VALVE02 PD2
#define TAG_SOLENOID_VALVE03 PD3
#define TAG_SOLENOID_VALVE04 PD4
#define TAG_SOLENOID_VALVE05 PD5
#define TAG_SOLENOID_VALVE06 PD6
#define TAG_SOLENOID_VALVE07 PD7
#define TAG_SOLENOID_VALVE08 PD8
#define TAG_SOLENOID_VALVE09 PD9
#define TAG_SOLENOID_VALVE10 PD10
#define TAG_SOLENOID_VALVE11 PD11
#define SOLENOID_VALVE00 TAG_SOLENOID_VALVE07
#define SOLENOID_VALVE01 TAG_SOLENOID_VALVE06
#define SOLENOID_VALVE02 TAG_SOLENOID_VALVE05
#define SOLENOID_VALVE03 TAG_SOLENOID_VALVE04
#define SOLENOID_VALVE04 TAG_SOLENOID_VALVE03
#define SOLENOID_VALVE05 TAG_SOLENOID_VALVE02
#define SOLENOID_VALVE06 TAG_SOLENOID_VALVE01
#define SOLENOID_VALVE07 TAG_SOLENOID_VALVE00
#define SOLENOID_VALVE08 TAG_SOLENOID_VALVE11
#define SOLENOID_VALVE09 TAG_SOLENOID_VALVE10
#define SOLENOID_VALVE10 TAG_SOLENOID_VALVE09
#define SOLENOID_VALVE11 TAG_SOLENOID_VALVE08
// ¹âµç´«¸ÐÆ÷
#define TAG_SENSOR_INT0 PC0
#define TAG_SENSOR_INT1 PC1
#define TAG_SENSOR_INT2 PC2
#define TAG_SENSOR_INT3 PC3
#define TAG_SENSOR_INT4 PC4
#define TAG_SENSOR_INT5 PC5
#define TAG_SENSOR_INT6 PC6
#define TAG_SENSOR_INT7 PC7
#define TAG_SENSOR_INT8 PC8
#define TAG_SENSOR_INT9 PC9
#define SENSOR_INT0 TAG_SENSOR_INT9
#define SENSOR_INT1 TAG_SENSOR_INT8
#define SENSOR_INT2 TAG_SENSOR_INT7
#define SENSOR_INT3 TAG_SENSOR_INT6
#define SENSOR_INT4 TAG_SENSOR_INT0
#define SENSOR_INT5 TAG_SENSOR_INT1
#define SENSOR_INT6 TAG_SENSOR_INT2
#define SENSOR_INT7 TAG_SENSOR_INT3
#define SENSOR_INT8 TAG_SENSOR_INT4
#define SENSOR_INT9 TAG_SENSOR_INT5
#define ID0_IO PB11
#define ID1_IO PB12
#define ID2_IO PB13
#define ID3_IO PB14
#define ID4_IO PB15

92
usrc/main.cpp

@ -52,75 +52,43 @@ static int32_t getDeviceId() {
* INIT_SUBMODULE *
*******************************************************************************/
void nvs_init_cb() {}
static void initsubmodule() {
osDelay(1000);
{
static TMC5130 g_motor;
static StepMotorCtrlModule g_stepMotorCtrlModule;
TMC5130::cfg_t cfg = {
.spi = &TMC_MOTOR_SPI, //
.csgpio = MOTOR0_CSN, //
.ennPin = MOTOR0_ENN, //
.spi_mode_select = MOTOR0_SPI_MODE_SELECT, //
};
g_motor.initialize(&cfg);
ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
g_motor.enable(true);
g_motor.setMotorShaft(false);
// g_motor.setAcceleration(100);
// g_motor.setDeceleration(100);
// g_motor.setIHOLD_IRUN(1,8, 10);
// g_motor.rotate(1000);
static ZGPIO input[10];
input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false);
input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false);
StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
StepMotorCtrlModule::create_default_cfg(smcm_cfg);
smcm_cfg.base_param.motor_one_circle_pulse = 100;
smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
smcm_cfg.base_param.stepmotor_ihold = 1;
smcm_cfg.base_param.stepmotor_irun = 15;
smcm_cfg.base_param.motor_shaft = false;
smcm_cfg.base_param.motor_default_velocity = 200;
smcm_cfg.base_param.motor_run_to_zero_speed = 100;
smcm_cfg.base_param.max_d = 0;
smcm_cfg.base_param.min_d = 0;
g_stepMotorCtrlModule.initialize(initer.get_module_id(1), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
initer.register_module(&g_stepMotorCtrlModule);
}
{
// 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(2), &feiteservomotor_bus, 1, &cfg);
initer.register_module(&mini_servo);
}
}
static void initsubmodule() { osDelay(1000); }
/*******************************************************************************
* MAIN *
*******************************************************************************/
void umain() {
ZCancmderSubboardIniter::cfg_t cfg = //
{
{ //
.deviceId = getDeviceId(),
.input_gpio = {},
.output_gpio = {},
};
.input_gpio =
{
{.pin = SENSOR_INT0, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT1, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT2, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT3, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT4, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT5, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT6, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT7, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT8, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
{.pin = SENSOR_INT9, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
},
.output_gpio = {
{.pin = PD7, /*SOLENOID_VALVE00*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD6, /*SOLENOID_VALVE01*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD5, /*SOLENOID_VALVE02*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD4, /*SOLENOID_VALVE03*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD3, /*SOLENOID_VALVE04*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD2, /*SOLENOID_VALVE05*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD1, /*SOLENOID_VALVE06*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD0, /*SOLENOID_VALVE07*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD11, /*SOLENOID_VALVE08*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD10, /*SOLENOID_VALVE09*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD9, /*SOLENOID_VALVE10*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
{.pin = PD8, /*SOLENOID_VALVE11*/ .mode = ZGPIO::kMode_nopull, .mirror = true, .initLevel = false, .log_when_setstate = false},
}};
initer.init(&cfg);
initsubmodule();
initer.loop();

4
usrc/project_configs.h

@ -1,13 +1,13 @@
#pragma once
#define PC_VERSION "v1.0.0"
#define PC_MANUFACTURER "http://www.iflytop.com/"
#define PC_PROJECT_NAME "graphite_digester_tmc5160"
#define PC_PROJECT_NAME "graphite_digester_io_board"
#define PC_IFLYTOP_ENABLE_OS 1
#define PC_DEBUG_UART huart1
#define PC_DEBUG_UART_DMA_HANDLER hdma_usart1_rx
#define PC_DEBUG_UART_RX_BUF_SIZE 1024
#define PC_DEBUG_LIGHT_GPIO PE2
#define PC_DEBUG_LIGHT_GPIO PE8
#define PC_SYS_DELAY_US_TIMER htim6 // USÑÓʱ¶¨Ê±Æ÷
#define PC_SYS_ZTICKET_TIMER TIM11 // ϵͳticket¶¨Ê±Æ÷

Loading…
Cancel
Save