From 9051da0184cf839037f1370c729b27bf065b9c95 Mon Sep 17 00:00:00 2001 From: tao_z <tzj0429@163.com> Date: Sat, 10 Jul 2021 22:06:34 +0800 Subject: [PATCH] 马达可以转动 --- USR/SRC/RttTask.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/USR/SRC/RttTask.c b/USR/SRC/RttTask.c index a4ed584..a0cd66c 100644 --- a/USR/SRC/RttTask.c +++ b/USR/SRC/RttTask.c @@ -2,6 +2,8 @@ #include "SEGGER_RTT.h" #include "SysCfg.h" #include "gd32e23x.h" +#include "pwm.h" +#include "motor.h" static uint32_t RttDataOutPutFlag = 0; static void RTT_KeyValue(uint32_t key); extern void RTT_TaskInit(void) @@ -57,8 +59,14 @@ case 'T': SEGGER_RTT_printf(0, "Software Compile time is :%s %s\n\r", &COMPILE_DATE, &COMPILE_TIME); break; - - default: + case 'o': + timer_channel_output_mode_config(TIMER0, MOTOR_OUT_CH_W, TIMER_OC_MODE_PWM0); + timer_channel_output_state_config(TIMER0, MOTOR_OUT_CH_W, TIMER_CCX_ENABLE); break; + case 's': + timer_channel_output_state_config(TIMER0, MOTOR_OUT_CH_W, TIMER_CCX_DISABLE); + break; + default: + break;` } } \ No newline at end of file -- Gitblit v1.8.0