diff options
| author | Keith Packard <keithp@keithp.com> | 2011-08-12 21:41:25 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2011-08-13 18:46:12 -0700 | 
| commit | fa7dd04741bf3fd9cedc59ed3b45b69ef9312609 (patch) | |
| tree | 38fe668a33c9956eb240376a7bac24ed1d00886e /src/ao_companion.c | |
| parent | c7f540330c040c521f9d7626009a406e704a5e41 (diff) | |
altos: Send SPI message at flight state changes
Get the companion board starting its data logging as soon as possible
after boost starts.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_companion.c')
| -rw-r--r-- | src/ao_companion.c | 15 | 
1 files changed, 13 insertions, 2 deletions
| diff --git a/src/ao_companion.c b/src/ao_companion.c index f54f5251..f0ce3f12 100644 --- a/src/ao_companion.c +++ b/src/ao_companion.c @@ -68,13 +68,24 @@ ao_companion_get_data(void)  	COMPANION_DESELECT();  } +static void +ao_companion_notify(void) +{ +	COMPANION_SELECT(); +	ao_companion_send_command(AO_COMPANION_NOTIFY); +	COMPANION_DESELECT(); +} +  void  ao_companion(void)  {  	ao_companion_running = ao_companion_get_setup();  	while (ao_companion_running) { -		ao_delay(ao_companion_setup.update_period); -		ao_companion_get_data(); +		ao_alarm(ao_companion_setup.update_period); +		if (ao_sleep(DATA_TO_XDATA(&ao_flight_state))) +			ao_companion_get_data(); +		else +			ao_companion_notify();  	}  	ao_exit();  } | 
