From: Keith Packard Date: Tue, 27 Aug 2013 00:15:55 +0000 (-0700) Subject: altos: Get telemini to copy current MS5607 state to ring. X-Git-Tag: 1.2.9.4~118^2~7 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=8ca98dc8c868c47c372d6b666c36e691fa402824 altos: Get telemini to copy current MS5607 state to ring. The ADC code is responsible for actually inserting the non-ADC data into the ring, so do the copy there. Signed-off-by: Keith Packard --- diff --git a/src/cc1111/ao_adc.c b/src/cc1111/ao_adc.c index 1523f94a..97a39c4d 100644 --- a/src/cc1111/ao_adc.c +++ b/src/cc1111/ao_adc.c @@ -164,7 +164,7 @@ ao_adc_isr(void) __interrupt 1 #endif #ifdef FETCH_ADC - FETCH_ADC() + FETCH_ADC(); #define GOT_ADC #endif diff --git a/src/telemini-v2.0/ao_pins.h b/src/telemini-v2.0/ao_pins.h index fac6c535..c1a36f8c 100644 --- a/src/telemini-v2.0/ao_pins.h +++ b/src/telemini-v2.0/ao_pins.h @@ -128,26 +128,32 @@ struct ao_adc { #define AO_ADC_PINS ((1 << 0) | (1 << 1) | (1 << 4)) -#define FETCH_ADC() \ - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc); \ - switch (sequence) { \ - case 4: \ - a += 4; \ - sequence = 0; \ - break; \ - case 1: \ - a += 2; \ - sequence = 4; \ - break; \ - case 0: \ - sequence = 1; \ - break; \ - } \ - a[0] = ADCL; \ - a[1] = ADCH; \ - if (sequence) { \ - ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | sequence; \ - return; \ - } +#define FETCH_ADC() do { \ + a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc); \ + switch (sequence) { \ + case 4: \ + a += 4; \ + sequence = 0; \ + break; \ + case 1: \ + a += 2; \ + sequence = 4; \ + break; \ + case 0: \ + sequence = 1; \ + break; \ + } \ + a[0] = ADCL; \ + a[1] = ADCH; \ + if (sequence) { \ + ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | sequence; \ + return; \ + } \ + AO_DATA_PRESENT(AO_DATA_ADC); \ + if (ao_data_present != AO_DATA_ALL) \ + return; \ + ao_data_ring[ao_data_head].ms5607_raw.pres = ao_ms5607_current.pres; \ + ao_data_ring[ao_data_head].ms5607_raw.temp = ao_ms5607_current.temp; \ + } while (0) #endif /* _AO_PINS_H_ */