From c90a758ac515fa689fb9153fcd5100cbc3c7bf96 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Mon, 12 Nov 2007 21:17:47 +0000 Subject: [PATCH] Detect if the medium is busy right before sending. --- platform/msb430/dev/cc1020.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/msb430/dev/cc1020.c b/platform/msb430/dev/cc1020.c index d7049cd7d..affeee914 100644 --- a/platform/msb430/dev/cc1020.c +++ b/platform/msb430/dev/cc1020.c @@ -420,7 +420,10 @@ PROCESS_THREAD(cc1020_sender_process, ev, data) // Wait until the receiver is idle. PROCESS_WAIT_UNTIL(cc1020_rxstate == CC1020_RX_SEARCHING); - // Wait for a short pseudo-random time before sending. + // Wait for the medium to become idle. + while (cc1020_carrier_sense()); + + // Then wait for a short pseudo-random time before sending. clock_delay(1 + 10 * (random_rand() & 0xff)); }