From dd910a7805153c6421bc58dfa7c7a626474151b4 Mon Sep 17 00:00:00 2001 From: FuChao Date: Wed, 8 Sep 2021 13:03:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0delay=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=EF=BC=9B=E8=A7=A3=E5=86=B3=E7=BC=96=E8=AF=91warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加作者信息 --- bsp/Vango_V85xx/drivers/board.c | 31 ++++++++++++++++++++++++++++++ bsp/Vango_V85xx/drivers/drv_gpio.c | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/bsp/Vango_V85xx/drivers/board.c b/bsp/Vango_V85xx/drivers/board.c index 5175269820..ca016a00df 100644 --- a/bsp/Vango_V85xx/drivers/board.c +++ b/bsp/Vango_V85xx/drivers/board.c @@ -6,6 +6,8 @@ * Change Logs: * Date Author Notes * 2021-01-04 iysheng first version + * 2021-09-07 idk500 suit for Vango V85xx + * 2021-09-08 ZhuXW add delay function */ #include @@ -75,4 +77,33 @@ void rt_hw_board_init() #endif } +void rt_hw_us_delay(rt_uint32_t us) +{ + rt_uint32_t ticks; + rt_uint32_t told, tnow, tcnt = 0; + rt_uint32_t reload = SysTick->LOAD; + + ticks = us * reload / (1000000 / RT_TICK_PER_SECOND); + told = SysTick->VAL; + while (1) + { + tnow = SysTick->VAL; + if (tnow != told) + { + if (tnow < told) + { + tcnt += told - tnow; + } + else + { + tcnt += reload - tnow + told; + } + told = tnow; + if (tcnt >= ticks) + { + break; + } + } + } +} /*@}*/ diff --git a/bsp/Vango_V85xx/drivers/drv_gpio.c b/bsp/Vango_V85xx/drivers/drv_gpio.c index 8250a11bab..abfc06c63e 100644 --- a/bsp/Vango_V85xx/drivers/drv_gpio.c +++ b/bsp/Vango_V85xx/drivers/drv_gpio.c @@ -206,7 +206,7 @@ const static struct rt_pin_ops _v85xx_pin_ops = v85xx_pin_mode, v85xx_pin_write, v85xx_pin_read, - v85xx_pin_get, + // v85xx_pin_get, }; rt_inline void pin_irq_hdr(int irqno) -- GitLab