From 2656eff0472262bd13bab16b41a3176a52895d69 Mon Sep 17 00:00:00 2001 From: zhangbo <zhangbo@qq.com> Date: 星期五, 25 七月 2025 16:46:18 +0800 Subject: [PATCH] 添加了运动静止位,V2.15 --- keil/include/drivers/mk_misc.c | 92 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 89 insertions(+), 3 deletions(-) diff --git a/keil/include/drivers/mk_misc.c b/keil/include/drivers/mk_misc.c index 5eb2565..8b4a272 100644 --- a/keil/include/drivers/mk_misc.c +++ b/keil/include/drivers/mk_misc.c @@ -382,14 +382,88 @@ void sys_reset(uint32_t error) { - LOG_INFO(TRACE_MODULE_DRIVER, "system reboot%x", error); + //LOG_INFO(TRACE_MODULE_DRIVER, "system reboot%x", error); delay_us(10000); // reboot reset_module(RESET_MODULE_REBOOT); } - +void delay_US(uint32_t nTimer) +{ + uint32_t i=0; + for(i=0; i<nTimer; i++) { + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + __NOP(); + } +} +void delay_ms(uint32_t nTimer) +{ + uint32_t i=1000*nTimer; + delay_US(i); +} void delay_us(uint32_t cnt) { #define SYSTEM_CLOCK_MHZ 62.4 @@ -433,7 +507,19 @@ __asm volatile(".syntax divided\n"); #endif } - +//void delay_us(uint32_t nTimer) +//{ +// uint32_t i=0; +// for(i=0;i<nTimer;i++){ +// __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +// __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +// __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +// __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +// __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +// __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +// __NOP();__NOP();__NOP();__NOP(); +// } +//} uint8_t count_bits(uint32_t value) { uint8_t count = 0; -- Gitblit v1.9.3