示例#1
0
/**
 * \brief Sends the frame at the next backoff boundary
 */
static void send_frame_at_next_backoff_boundary(void)
{
	uint8_t ack_is_requested;
	uint32_t now_time_us;

	/*
	 * Locate the next backoff boundary for the frame transmissiom;
	 * this backoff boundary is the starttime for the frame fransmission.
	 * Use a blocking approach, since next backoff boundary should be close.
	 */
	do {
		pal_get_current_time(&now_time_us);
	} while (pal_add_time_us(now_time_us, PRE_TX_DURATION_US) <
			cca_starttime_us);

	/* re-programm the interrupt handler */
	pal_trx_irq_init((FUNC_PTR)ack_reception_handler_cb);
	pal_trx_irq_en();

	/* debug pin to switch on: define ENABLE_DEBUG_PINS, pal_config.h */
	PIN_TX_START();

	/* Check if an acknowledgement is requested for this frame. */
	ack_is_requested = *(tal_frame_to_tx + 1) & FCF_ACK_REQUEST;

	if (ack_is_requested > 0) {
		tal_csma_state = FRAME_SENDING_WITH_ACK;
	} else {
		tal_csma_state = FRAME_SENDING_NO_ACK;
	}

	/* download and send frame, no CSMA and no frame_retry */
	send_frame(NO_CSMA_NO_IFS, false);
}
示例#2
0
/**
 * \brief Sends the frame at the next backoff boundary
 */
static void send_frame_at_next_backoff_boundary(void)
{
	uint32_t now_time_us;

	/*
	 * Locate the next backoff boundary for the frame transmissiom;
	 * this backoff boundary is the starttime for the frame fransmission.
	 * Use a blocking approach, since next backoff boundary should be close.
	 */
	do {
		pal_get_current_time(&now_time_us);
	} while (pal_add_time_us(now_time_us, PRE_TX_DURATION_US) <
			cca_starttime_us);

	/* debug pin to switch on: define ENABLE_DEBUG_PINS, pal_config.h */
	PIN_TX_START();

	tal_csma_state = FRAME_SENDING;

	/* download and send frame, no CSMA and no frame_retry */
	send_frame(NO_CSMA_NO_IFS, false);
}