Browse Source

更新非阻塞延时闪烁

master
DESKTOP-1PDT1EL\10564 2 weeks ago
parent
commit
4c1d6099fa
  1. 112
      Core/Src/main.c
  2. BIN
      Debug/Core/Src/main.o
  3. 12
      Debug/Core/Src/main.su
  4. BIN
      Debug/Core/Startup/startup_stm32h743vgtx.o
  5. BIN
      Debug/EchoNewBB0825.bin
  6. BIN
      Debug/EchoNewBB0825.elf
  7. 9622
      Debug/EchoNewBB0825.hex
  8. 87064
      Debug/EchoNewBB0825.list
  9. 41097
      Debug/EchoNewBB0825.map
  10. BIN
      Debug/EchoNewSmallBB826.bin
  11. BIN
      Debug/EchoNewSmallBB826.elf
  12. 17704
      Debug/EchoNewSmallBB826.hex
  13. 106737
      Debug/EchoNewSmallBB826.list
  14. 3697
      Debug/EchoNewSmallBB826.map
  15. 79
      EchoNewSmallBB826.launch

112
Core/Src/main.c

@ -84,8 +84,68 @@ int can2_DispacherPeriod = 4;
/* Private variables ---------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */ /* USER CODE BEGIN PV */
typedef enum
{
ACT_UP = 0,
ACT_STOP1,
ACT_DOWN,
ACT_STOP2,
}ACT_STATE;
ACT_STATE g_state = ACT_UP;
uint32_t g_tick = 0;
/* USER CODE END PV */ void Actuator_Start(void) /*初始化*/
{
g_state = ACT_UP;
g_tick = HAL_GetTick();
GF_BSP_GPIO_SetIO(1,1);
GF_BSP_GPIO_SetIO(2,0);
}
void Actuator_Task(void) /*实现不阻塞延时*/
{
if(HAL_GetTick() - g_tick < 2000)
return;
g_tick = HAL_GetTick();
switch(g_state)
{
case ACT_UP:
// 上升
GF_BSP_GPIO_SetIO(1,1);
GF_BSP_GPIO_SetIO(2,0);
g_state = ACT_STOP1;
break;
case ACT_STOP1:
// 停止
GF_BSP_GPIO_SetIO(1,1);
GF_BSP_GPIO_SetIO(2,1);
g_state = ACT_DOWN;
break;
case ACT_DOWN:
// 下降
GF_BSP_GPIO_SetIO(1,0);
GF_BSP_GPIO_SetIO(2,1);
g_state = ACT_STOP2;
break;
case ACT_STOP2:
// 停止
GF_BSP_GPIO_SetIO(1,1);
GF_BSP_GPIO_SetIO(2,1);
// 如果只执行一轮
// return;
// 如果一直循环
g_state = ACT_UP;
break;
}
}/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void); void SystemClock_Config(void);
@ -207,7 +267,7 @@ int main(void)
/* TCP echo server Init */ /* TCP echo server Init */
tcp_server_init(5000); tcp_server_init(5000);
Actuator_Start();
char InputInfo[500]; char InputInfo[500];
/* USER CODE END 2 */ /* USER CODE END 2 */
@ -215,32 +275,28 @@ int main(void)
/* USER CODE BEGIN WHILE */ /* USER CODE BEGIN WHILE */
while (1) { while (1) {
// if (HAL_GetTick() - ledTick >= 3000) /*led翻转,表示程序运行状�?????*/ if (HAL_GetTick() - ledTick >= 1000) /*led翻转,表示程序运行状�?????*/
// { {
// ledTick = HAL_GetTick(); ledTick = HAL_GetTick();
// HAL_GPIO_TogglePin(IO_LED_GPIO_Port, IO_LED_Pin); //反转 HAL_GPIO_TogglePin(IO_LED_GPIO_Port, IO_LED_Pin); //反转
// HAL_GPIO_TogglePin(M_OUT1_GPIO_Port, M_OUT1_Pin); }
// HAL_GPIO_TogglePin(M_OUT2_GPIO_Port, M_OUT2_Pin); Actuator_Task();
// HAL_GPIO_TogglePin(M_OUT3_GPIO_Port, M_OUT3_Pin);
// HAL_GPIO_TogglePin(M_OUT4_GPIO_Port, M_OUT4_Pin); // GF_BSP_GPIO_SetIO(1,1); /* 上升 0亮 1灭 不能同时为0,不能同时亮,会烧保险丝,为了给继电器吸合的反应时间*/
// HAL_GPIO_TogglePin(M_OUT5_GPIO_Port, M_OUT5_Pin); // GF_BSP_GPIO_SetIO(2,0);/*推杆上升下降切换时时必须经过停止,延时1s*/
// HAL_GPIO_TogglePin(M_OUT6_GPIO_Port, M_OUT6_Pin); // HAL_Delay(2000);
// } //
GF_BSP_GPIO_SetIO(1,1); /* 上升 0亮 1灭 不能同时为0,不能同时亮,会烧保险丝,为了给继电器吸合的反应时间*/ // GF_BSP_GPIO_SetIO(1,1);/*停*/
GF_BSP_GPIO_SetIO(2,0);/*推杆上升下降切换时时必须经过停止,延时1s*/ // GF_BSP_GPIO_SetIO(2,1);
HAL_Delay(2000); // HAL_Delay(2000);
//
GF_BSP_GPIO_SetIO(1,1);/*停*/ // GF_BSP_GPIO_SetIO(1,0);/*下降*/
GF_BSP_GPIO_SetIO(2,1); // GF_BSP_GPIO_SetIO(2,1);
HAL_Delay(2000); // HAL_Delay(2000);
//
GF_BSP_GPIO_SetIO(1,0);/*下降*/ // GF_BSP_GPIO_SetIO(1,1);/*停*/
GF_BSP_GPIO_SetIO(2,1); // GF_BSP_GPIO_SetIO(2,1);
HAL_Delay(2000); // HAL_Delay(2000);
GF_BSP_GPIO_SetIO(1,1);/*停*/
GF_BSP_GPIO_SetIO(2,1);
HAL_Delay(2000);
memset(InputInfo, '\0', sizeof(InputInfo)); memset(InputInfo, '\0', sizeof(InputInfo));

BIN
Debug/Core/Src/main.o

Binary file not shown.

12
Debug/Core/Src/main.su

@ -1,5 +1,7 @@
../Core/Src/main.c:109:5:main 584 static,ignoring_inline_asm ../Core/Src/main.c:98:6:Actuator_Start 8 static
../Core/Src/main.c:282:6:SystemClock_Config 120 static ../Core/Src/main.c:106:6:Actuator_Task 8 static
../Core/Src/main.c:342:6:CV_GV_Init 64 static ../Core/Src/main.c:169:5:main 584 static,ignoring_inline_asm
../Core/Src/main.c:354:6:MPU_Config 24 static ../Core/Src/main.c:338:6:SystemClock_Config 120 static
../Core/Src/main.c:406:6:Error_Handler 4 static,ignoring_inline_asm ../Core/Src/main.c:398:6:CV_GV_Init 64 static
../Core/Src/main.c:410:6:MPU_Config 24 static
../Core/Src/main.c:462:6:Error_Handler 4 static,ignoring_inline_asm

BIN
Debug/Core/Startup/startup_stm32h743vgtx.o

Binary file not shown.

BIN
Debug/EchoNewBB0825.bin

Binary file not shown.

BIN
Debug/EchoNewBB0825.elf

Binary file not shown.

9622
Debug/EchoNewBB0825.hex

File diff suppressed because it is too large

87064
Debug/EchoNewBB0825.list

File diff suppressed because it is too large

41097
Debug/EchoNewBB0825.map

File diff suppressed because it is too large

BIN
Debug/EchoNewSmallBB826.bin

Binary file not shown.

BIN
Debug/EchoNewSmallBB826.elf

Binary file not shown.

17704
Debug/EchoNewSmallBB826.hex

File diff suppressed because it is too large

106737
Debug/EchoNewSmallBB826.list

File diff suppressed because it is too large

3697
Debug/EchoNewSmallBB826.map

File diff suppressed because it is too large

79
EchoNewSmallBB826.launch

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.st.stm32cube.ide.mcu.debug.launch.launchConfigurationType">
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
<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/EchoNewSmallBB826.elf&quot;,&quot;fProjectName&quot;:&quot;EchoNewSmallBB826&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"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_external_loader" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" 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:\cubeworkSpace2\EchoNewSmallBB826\Debug\st-link_gdbserver_log.txt"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
<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="connect_under_reset"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverAuto" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverPort" value="cortex_m0"/>
<intAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyPort" value="60000"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="com.st.stm32cube.ide.mcu.debug.stlink"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<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/EchoNewSmallBB826.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="EchoNewSmallBB826"/>
<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.494457847"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/EchoNewSmallBB826"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="process_factory_id" value="com.st.stm32cube.ide.mcu.debug.launch.HardwareDebugProcessFactory"/>
</launchConfiguration>
Loading…
Cancel
Save