diff options
| author | Keith Packard <keithp@keithp.com> | 2012-08-26 09:53:16 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-08-26 09:53:16 -0700 | 
| commit | f89e7de20374141b367205aa517a08ee203bfaf3 (patch) | |
| tree | ccda232f72dd067d88fd1b7e03196c24f943b494 /src/stm/ao_timer.c | |
| parent | dec1481786ad54e22634e32109b5ed6e5483938e (diff) | |
altos: Trigger sample complete when all data are ready
This has each sensor mark a bit in the current data record which is
then sent for processing when all of the data are present.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_timer.c')
| -rw-r--r-- | src/stm/ao_timer.c | 19 | 
1 files changed, 11 insertions, 8 deletions
| diff --git a/src/stm/ao_timer.c b/src/stm/ao_timer.c index adec7aad..78228e65 100644 --- a/src/stm/ao_timer.c +++ b/src/stm/ao_timer.c @@ -37,9 +37,9 @@ ao_delay(uint16_t ticks)  	ao_sleep(&ao_forever);  } -#if HAS_ADC -volatile __data uint8_t	ao_adc_interval = 1; -volatile __data uint8_t	ao_adc_count; +#if AO_DATA_ALL +volatile __data uint8_t	ao_data_interval = 1; +volatile __data uint8_t	ao_data_count;  #endif  void @@ -51,10 +51,13 @@ void stm_tim6_isr(void)  	if (stm_tim6.sr & (1 << STM_TIM67_SR_UIF)) {  		stm_tim6.sr = 0;  		++ao_tick_count; -#if HAS_ADC -		if (++ao_adc_count == ao_adc_interval) { -			ao_adc_count = 0; +#if AO_DATA_ALL +		if (++ao_data_count == ao_data_interval) { +			ao_data_count = 0;  			ao_adc_poll(); +#if (AO_DATA_ALL & ~(AO_DATA_ADC)) +			ao_wakeup((void *) &ao_data_count); +#endif  		}  #endif  	} @@ -64,8 +67,8 @@ void stm_tim6_isr(void)  void  ao_timer_set_adc_interval(uint8_t interval) __critical  { -	ao_adc_interval = interval; -	ao_adc_count = 0; +	ao_data_interval = interval; +	ao_data_count = 0;  }  #endif | 
