summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-08-26 17:15:55 -0700
committerKeith Packard <keithp@keithp.com>2013-08-26 17:15:55 -0700
commit8ca98dc8c868c47c372d6b666c36e691fa402824 (patch)
treee1d49dffb0de28d1131872e2818fe5babc42bfca /src
parentaf9f9cf0c21630562c74fae41773319229bf44d3 (diff)
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 <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/cc1111/ao_adc.c2
-rw-r--r--src/telemini-v2.0/ao_pins.h48
2 files changed, 28 insertions, 22 deletions
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_ */