From 3748f2b72d65a32f6d4dbb9188c202d568db01d8 Mon Sep 17 00:00:00 2001 From: timecop Date: Sat, 17 Mar 2012 07:13:45 +0000 Subject: [PATCH] patch for core_cm3 and new gcc fail commented values in vbat calculation git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@116 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61 --- lib/CMSIS/CM3/CoreSupport/core_cm3.c | 4 ++-- src/mw.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CMSIS/CM3/CoreSupport/core_cm3.c b/lib/CMSIS/CM3/CoreSupport/core_cm3.c index 56fddc52b..0e8c3c43c 100755 --- a/lib/CMSIS/CM3/CoreSupport/core_cm3.c +++ b/lib/CMSIS/CM3/CoreSupport/core_cm3.c @@ -733,7 +733,7 @@ uint32_t __STREXB(uint8_t value, uint8_t *addr) { uint32_t result=0; - __ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); + __ASM volatile ("strexb %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) ); return(result); } @@ -750,7 +750,7 @@ uint32_t __STREXH(uint16_t value, uint16_t *addr) { uint32_t result=0; - __ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); + __ASM volatile ("strexh %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) ); return(result); } diff --git a/src/mw.c b/src/mw.c index f8e24abc9..b82452f58 100755 --- a/src/mw.c +++ b/src/mw.c @@ -180,7 +180,7 @@ void annexCode(void) vbatRawArray[(ind++) % 8] = adcGetBattery(); for (i = 0; i < 8; i++) vbatRaw += vbatRawArray[i]; - vbat = (((vbatRaw / 8) * 3.3f) / 4095) * 110; // result is Vbatt in 0.1V steps + vbat = (((vbatRaw / 8) * 3.3f) / 4095) * 110; // result is Vbatt in 0.1V steps. 3.3V = ADC Vref, 4095 = 12bit adc, 110 = 11:1 voltage divider (10k:1k) * 10 for 0.1V } if (rcOptions[BOXBEEPERON]) { // unconditional beeper on via AUXn switch buzzerFreq = 7;