Exemplo n.º 1
0
void
#else
uint8_t
#endif
rfm12_tx(uint8_t len, uint8_t type, uint8_t *data)
{
#if RFM12_UART_DEBUG
    uart_putstr ("rfm12_tx\r\n");
#endif

    if (len > RFM12_TX_BUFFER_SIZE) return TXRETURN(RFM12_TX_ERROR);

    //exit if the buffer isn't free
    if (ctrl.txstate != STATUS_FREE)
    {
        return TXRETURN(RFM12_TX_OCCUPIED);
    }

    memcpy ( rf_tx_buffer.buffer, data, len );

#if (!(RFM12_NORETURNS))
    return rfm12_start_tx (type, len);
#else
    rfm12_start_tx (type, len);
#endif
}
Exemplo n.º 2
0
void 
#else
uint8_t
#endif
rfm12_start_tx(uint8_t type, uint8_t length)
{
	//exit if the buffer isn't free
	if(ctrl.txstate != STATUS_FREE)
		return TXRETURN(RFM12_TX_OCCUPIED);
	
	//write airlab header to buffer
	rf_tx_buffer.len = length;
	rf_tx_buffer.type = type;
	rf_tx_buffer.checksum = length ^ type ^ 0xff;
	
	//schedule packet for transmission
	ctrl.txstate = STATUS_OCCUPIED;
	
	return TXRETURN(RFM12_TX_ENQUEUED);
}