#if HAS_MS5607 || HAS_MS5611
-static __xdata struct ao_ms5607_prom ms5607_prom;
-static __xdata uint8_t ms5607_configured;
+__xdata struct ao_ms5607_prom ao_ms5607_prom;
+static __xdata uint8_t ms5607_configured;
static void
ao_ms5607_start(void) {
return;
ms5607_configured = 1;
ao_ms5607_reset();
- ao_ms5607_prom_read(&ms5607_prom);
+ ao_ms5607_prom_read(&ao_ms5607_prom);
}
static __xdata volatile uint8_t ao_ms5607_done;
void
ao_ms5607_info(void)
{
- printf ("ms5607 reserved: %u\n", ms5607_prom.reserved);
- printf ("ms5607 sens: %u\n", ms5607_prom.sens);
- printf ("ms5607 off: %u\n", ms5607_prom.off);
- printf ("ms5607 tcs: %u\n", ms5607_prom.tcs);
- printf ("ms5607 tco: %u\n", ms5607_prom.tco);
- printf ("ms5607 tref: %u\n", ms5607_prom.tref);
- printf ("ms5607 tempsens: %u\n", ms5607_prom.tempsens);
- printf ("ms5607 crc: %u\n", ms5607_prom.crc);
+ printf ("ms5607 reserved: %u\n", ao_ms5607_prom.reserved);
+ printf ("ms5607 sens: %u\n", ao_ms5607_prom.sens);
+ printf ("ms5607 off: %u\n", ao_ms5607_prom.off);
+ printf ("ms5607 tcs: %u\n", ao_ms5607_prom.tcs);
+ printf ("ms5607 tco: %u\n", ao_ms5607_prom.tco);
+ printf ("ms5607 tref: %u\n", ao_ms5607_prom.tref);
+ printf ("ms5607 tempsens: %u\n", ao_ms5607_prom.tempsens);
+ printf ("ms5607 crc: %u\n", ao_ms5607_prom.crc);
}
static void
};
extern __xdata struct ao_ms5607_sample ao_ms5607_current;
+extern __xdata struct ao_ms5607_prom ao_ms5607_prom;
void
ao_ms5607_setup(void);
ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample,
__xdata struct ao_ms5607_value *value);
-void
-ao_ms5607_get_prom(__data struct ao_ms5607_prom *prom);
-
#endif /* _AO_MS5607_H_ */
int64_t OFF;
int64_t SENS;
- 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);
+ TEMP = 2000 + (((int64_t) dT * ao_ms5607_prom.tempsens) >> 23);
#if HAS_MS5611
- OFF = ((int64_t) ms5607_prom.off << 16) + (((int64_t) ms5607_prom.tco * dT) >> 7);
- SENS = ((int64_t) ms5607_prom.sens << 15) + (((int64_t) ms5607_prom.tcs * dT) >> 8);
+ OFF = ((int64_t) ao_ms5607_prom.off << 16) + (((int64_t) ao_ms5607_prom.tco * dT) >> 7);
+ SENS = ((int64_t) ao_ms5607_prom.sens << 15) + (((int64_t) ao_ms5607_prom.tcs * dT) >> 8);
#else
- OFF = ((int64_t) ms5607_prom.off << 17) + (((int64_t) ms5607_prom.tco * dT) >> 6);
- SENS = ((int64_t) ms5607_prom.sens << 16) + (((int64_t) ms5607_prom.tcs * dT) >> 7);
+ OFF = ((int64_t) ao_ms5607_prom.off << 17) + (((int64_t) ao_ms5607_prom.tco * dT) >> 6);
+ SENS = ((int64_t) ao_ms5607_prom.sens << 16) + (((int64_t) ao_ms5607_prom.tcs * dT) >> 7);
#endif
if (TEMP < 2000) {
__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);
/**/
#if TELEMEGA
#include "ao_convert_pa.c"
#include <ao_ms5607.h>
-struct ao_ms5607_prom ms5607_prom;
+struct ao_ms5607_prom ao_ms5607_prom;
#include "ao_ms5607_convert.c"
#define AO_PYRO_NUM 4
#include <ao_pyro.h>
continue;
} else if (nword == 3 && strcmp(words[0], "ms5607") == 0) {
if (strcmp(words[1], "reserved:") == 0)
- ms5607_prom.reserved = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.reserved = strtoul(words[2], NULL, 10);
else if (strcmp(words[1], "sens:") == 0)
- ms5607_prom.sens = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.sens = strtoul(words[2], NULL, 10);
else if (strcmp(words[1], "off:") == 0)
- ms5607_prom.off = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.off = strtoul(words[2], NULL, 10);
else if (strcmp(words[1], "tcs:") == 0)
- ms5607_prom.tcs = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.tcs = strtoul(words[2], NULL, 10);
else if (strcmp(words[1], "tco:") == 0)
- ms5607_prom.tco = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.tco = strtoul(words[2], NULL, 10);
else if (strcmp(words[1], "tref:") == 0)
- ms5607_prom.tref = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.tref = strtoul(words[2], NULL, 10);
else if (strcmp(words[1], "tempsens:") == 0)
- ms5607_prom.tempsens = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.tempsens = strtoul(words[2], NULL, 10);
else if (strcmp(words[1], "crc:") == 0)
- ms5607_prom.crc = strtoul(words[2], NULL, 10);
+ ao_ms5607_prom.crc = strtoul(words[2], NULL, 10);
continue;
} else if (nword >= 3 && strcmp(words[0], "Pyro") == 0) {
int p = strtoul(words[1], NULL, 10);
#include <stdint.h>
#include <ao_ms5607.h>
-struct ao_ms5607_prom ms5607_prom = {
+struct ao_ms5607_prom ao_ms5607_prom = {
0x002c,
0xa6e0,
0x988e,