-void
-ao_packet_slave(void)
-{
- ao_radio_set_packet();
- tx_packet.addr = ao_serial_number;
- tx_packet.len = AO_PACKET_SYN;
- while (ao_packet_enable) {
- ao_led_on(AO_LED_GREEN);
- ao_packet_recv();
- ao_led_off(AO_LED_GREEN);
- ao_led_on(AO_LED_RED);
- ao_delay(AO_MS_TO_TICKS(100));
- ao_packet_send();
- ao_led_off(AO_LED_RED);
- }
- ao_exit();
-}
-
-/* Thread for the master side of the packet link */
-
-void
-ao_packet_master(void)
-{
- uint8_t status;
-
- ao_radio_set_packet();
- tx_packet.addr = ao_serial_number;
- tx_packet.len = AO_PACKET_SYN;
- while (ao_packet_enable) {
- ao_led_on(AO_LED_RED);
- ao_delay(AO_MS_TO_TICKS(100));
- ao_packet_send();
- ao_led_off(AO_LED_RED);
- ao_led_on(AO_LED_GREEN);
- ao_alarm(AO_MS_TO_TICKS(1000));
- status = ao_packet_recv();
- ao_led_off(AO_LED_GREEN);
- if (status & AO_DMA_DONE) {
- ao_packet_master_sleeping = 1;
- ao_delay(AO_MS_TO_TICKS(1000));
- ao_packet_master_sleeping = 0;
- }
- }
- ao_exit();
-}