From 01572cbb9620adcc8a203f7b89c95b9e8a23a20f Mon Sep 17 00:00:00 2001 From: "timecop@gmail.com" Date: Wed, 29 May 2013 00:05:33 +0000 Subject: [PATCH] fix for micros() when not running at default 72MHz. Was affecting intrc-only operation at 64MHz. Updated uvproj to latest keil mdk git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@329 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61 --- baseflight.uvproj | 3 +++ src/drv_system.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/baseflight.uvproj b/baseflight.uvproj index d182104825..51e4d102c5 100755 --- a/baseflight.uvproj +++ b/baseflight.uvproj @@ -165,6 +165,7 @@ 1 4096 + 0 BIN\UL2CM3.DLL "" () @@ -970,6 +971,7 @@ 1 4096 + 0 BIN\UL2CM3.DLL "" () @@ -1719,6 +1721,7 @@ 1 4096 + 0 BIN\UL2CM3.DLL "" () diff --git a/src/drv_system.c b/src/drv_system.c index d19b0ada63..f43283c8f4 100755 --- a/src/drv_system.c +++ b/src/drv_system.c @@ -33,7 +33,7 @@ uint32_t micros(void) ms = sysTickUptime; cycle_cnt = SysTick->VAL; } while (ms != sysTickUptime); - return (ms * 1000) + (72000 - cycle_cnt) / 72; + return (ms * 1000) + (usTicks * 1000 - cycle_cnt) / usTicks; } // Return system uptime in milliseconds (rollover in 49 days)