X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fdrivers%2Fao_ms5607_convert_8051.c;h=e9052b413dd8a14a855754ee49e8398f8d309617;hp=f3a48c464b784830462bd29b840abaa57a826f11;hb=c6e57291d91f1f6c4de5c54a5cfd3eef66d9f830;hpb=56911f27376b0fe91a464e369bb8aa1531b3c7dc diff --git a/src/drivers/ao_ms5607_convert_8051.c b/src/drivers/ao_ms5607_convert_8051.c index f3a48c46..e9052b41 100644 --- a/src/drivers/ao_ms5607_convert_8051.c +++ b/src/drivers/ao_ms5607_convert_8051.c @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -31,8 +32,8 @@ #endif void -ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample, - __xdata struct ao_ms5607_value *value) +ao_ms5607_convert(struct ao_ms5607_sample *sample, + struct ao_ms5607_value *value) { __LOCAL int32_t dT; __LOCAL int32_t TEMP; @@ -40,30 +41,30 @@ ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample, __LOCAL ao_int64_t SENS; __LOCAL ao_int64_t a; - dT = sample->temp - ((int32_t) ms5607_prom.tref << 8); + dT = sample->temp - ((int32_t) ao_ms5607_prom.tref << 8); - /* TEMP = 2000 + (((int64_t) dT * ms5607_prom.tempsens) >> 23); */ - ao_mul64_32_32(&a, dT, ms5607_prom.tempsens); + /* TEMP = 2000 + (((int64_t) dT * ao_ms5607_prom.tempsens) >> 23); */ + ao_mul64_32_32(&a, dT, ao_ms5607_prom.tempsens); ao_rshift64(&a, &a, 23); TEMP = 2000 + a.low; /* */ - /* OFF = ((int64_t) ms5607_prom.off << SHIFT_OFF) + (((int64_t) ms5607_prom.tco * dT) >> SHIFT_TCO);*/ + /* OFF = ((int64_t) ao_ms5607_prom.off << SHIFT_OFF) + (((int64_t) ao_ms5607_prom.tco * dT) >> SHIFT_TCO);*/ #if SHIFT_OFF > 16 - OFF.high = ms5607_prom.off >> (32 - SHIFT_OFF); + OFF.high = ao_ms5607_prom.off >> (32 - SHIFT_OFF); #else OFF.high = 0; #endif - OFF.low = (uint32_t) ms5607_prom.off << SHIFT_OFF; - ao_mul64_32_32(&a, ms5607_prom.tco, dT); + OFF.low = (uint32_t) ao_ms5607_prom.off << SHIFT_OFF; + ao_mul64_32_32(&a, ao_ms5607_prom.tco, dT); ao_rshift64(&a, &a, SHIFT_TCO); ao_plus64(&OFF, &OFF, &a); /**/ - /* SENS = ((int64_t) ms5607_prom.sens << SHIFT_SENS) + (((int64_t) ms5607_prom.tcs * dT) >> SHIFT_TCS); */ + /* SENS = ((int64_t) ao_ms5607_prom.sens << SHIFT_SENS) + (((int64_t) ao_ms5607_prom.tcs * dT) >> SHIFT_TCS); */ SENS.high = 0; - SENS.low = (uint32_t) ms5607_prom.sens << SHIFT_SENS; - ao_mul64_32_32(&a, ms5607_prom.tcs, dT); + SENS.low = (uint32_t) ao_ms5607_prom.sens << SHIFT_SENS; + ao_mul64_32_32(&a, ao_ms5607_prom.tcs, dT); ao_rshift64(&a, &a, SHIFT_TCS); ao_plus64(&SENS, &SENS, &a); /**/