diff options
author | Mike Beattie <mike@ethernal.org> | 2012-08-08 06:46:56 +1200 |
---|---|---|
committer | Mike Beattie <mike@ethernal.org> | 2012-08-08 06:46:56 +1200 |
commit | bd02349111ae0f39b320e6a10a330051ddc39fdf (patch) | |
tree | ab7a29204eea195db77aa302fbe3e2012ef5049e /src/cc1111/ao_adc.c | |
parent | 8e4ebd1f6eb928b5cb7bcda4ed88851aa9e61bdf (diff) | |
parent | c7f228503870c44dfd278ede8b0980dbac73d3c7 (diff) |
Merge branch 'master' of git://git.gag.com/fw/altos
Diffstat (limited to 'src/cc1111/ao_adc.c')
-rw-r--r-- | src/cc1111/ao_adc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cc1111/ao_adc.c b/src/cc1111/ao_adc.c index ce827e25..f7b52281 100644 --- a/src/cc1111/ao_adc.c +++ b/src/cc1111/ao_adc.c @@ -140,6 +140,15 @@ ao_adc_isr(void) __interrupt 1 } #endif /* telemini || telenano */ +#ifdef TELEFIRE_V_0_1 + a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.sense[0] + sequence); + a[0] = ADCL; + a[1] = ADCH; + if (sequence < 5) + ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | (sequence + 1); +#define GOT_ADC +#endif /* TELEFIRE_V_0_1 */ + #ifndef GOT_ADC #error No known ADC configuration set #endif @@ -157,9 +166,13 @@ ao_adc_dump(void) __reentrant { static __xdata struct ao_data packet; ao_data_get(&packet); +#ifndef AO_ADC_DUMP printf("tick: %5u accel: %5d pres: %5d temp: %5d batt: %5d drogue: %5d main: %5d\n", packet.tick, packet.adc.accel, packet.adc.pres, packet.adc.temp, packet.adc.v_batt, packet.adc.sense_d, packet.adc.sense_m); +#else + AO_ADC_DUMP(&packet); +#endif } __code struct ao_cmds ao_adc_cmds[] = { @@ -170,6 +183,11 @@ __code struct ao_cmds ao_adc_cmds[] = { void ao_adc_init(void) { +#ifdef AO_ADC_PINS + ADCCFG = AO_ADC_PINS; + +#else + #if IGNITE_ON_P2 /* TeleMetrum configuration */ ADCCFG = ((1 << 0) | /* acceleration */ @@ -190,6 +208,8 @@ ao_adc_init(void) (1 << 3)); /* battery voltage */ #endif +#endif /* else AO_ADC_PINS */ + /* enable interrupts */ ADCIF = 0; IEN0 |= IEN0_ADCIE; |