-static uint8_t ao_spi_slave_recv(void)
-{
- if (!ao_spi_read((uint8_t *) &ao_companion_command,
- sizeof (ao_companion_command)))
- return 0;
-
- /* Figure out the outbound data */
- switch (ao_companion_command.command) {
- case AO_COMPANION_SETUP:
- ao_spi_write((uint8_t *) &ao_telescience_setup,
- sizeof (ao_telescience_setup));
- break;
- case AO_COMPANION_FETCH:
- ao_spi_write((uint8_t *) &ao_adc_ring[ao_adc_ring_prev(ao_adc_head)].adc,
- AO_LOG_TELESCIENCE_NUM_ADC * sizeof (uint16_t));
- break;
- case AO_COMPANION_NOTIFY:
- break;
- default:
- return 0;
- }
-
- ao_log_store.tm_tick = ao_companion_command.tick;
- if (ao_log_store.tm_state != ao_companion_command.flight_state) {
- ao_log_store.tm_state = ao_companion_command.flight_state;
- return 1;
- }
- return 0;
-}
-