static void reset(void) { cc110x_wakeup_from_rx(); #ifdef MODULE_CC110x_SPI cc110x_spi_select(); #endif cc110x_strobe(CC1100_SRES); hwtimer_wait(RTIMER_TICKS(100)); }
static bool send_burst(cc1100_packet_layer0_t *packet, uint8_t retries, uint8_t rtc) { int i; radio_state = RADIO_SEND_BURST; rflags.LL_ACK = false; for (i = 1; i <= cc1100_burst_count; i++) { /* * Number of bytes to send is: * length of phy payload (packet->length) * + size of length field (1 byte) */ extern unsigned long hwtimer_now(void); timer_tick_t t = hwtimer_now() + RTIMER_TICKS(T_PACKET_INTERVAL); cc1100_send_raw((uint8_t *)packet, packet->length + 1); /* RX -> TX (9.6 us) */ cc1100_statistic.raw_packets_out++; /* Delay until predefined "send" interval has passed */ timer_tick_t now = hwtimer_now(); if (t > now) { hwtimer_wait(t - now); } /** * After sending the packet the CC1100 goes automatically * into RX mode (21.5 us) (listening for an ACK). * Do not interrupt burst if send to broadcast address (a node may * have the broadcast address at startup and would stop the burst * by sending an ACK). */ if (rflags.LL_ACK && packet->address != CC1100_BROADCAST_ADDRESS) { cc1100_statistic.raw_packets_out_acked += i; break; } } /* No link level ACK -> do retry if retry counter greater zero * Note: Event broadcast packets can be sent repeatedly if in * constant RX mode. In WOR mode it is not necessary, so * set retry count to zero.*/ if (!rflags.LL_ACK && retries > 0) { return send_burst(packet, retries - 1, rtc + 1); } /* Store number of transmission retries */ rflags.RETC = rtc; rflags.RPS = rtc * cc1100_burst_count + i; if (i > cc1100_burst_count) { rflags.RPS--; } rflags.TX = false; /* Go to mode after TX (CONST_RX -> RX, WOR -> WOR) */ cc1100_go_after_tx(); /* Burst from any other node is definitely over */ last_seq_num = 0; if (packet->address != CC1100_BROADCAST_ADDRESS && !rflags.LL_ACK) { return false; } return true; }