示例#1
0
/**
 *	boolean send(char*) : function to enqueue a packet for transmission
 *	returns: true, false
 **/
void RFM70::send(uint8_t* s, uint8_t len) {

    //switch to tx mode
    cliTxDs();
    setMode(MODE_PTX);

    if (txTimeout()) {
        flushTxFIFO();
        cliTimeout();
    }

    sendPayload(s, len);

    //wait for packet to be sent
    _delay_us(SEND_DELAY);

    //switch to rx mode
    cliRxDr();
    setMode(MODE_PRX);
}
示例#2
0
/**
 *	boolean send(char*) : function to enqueue a packet for transmission
 *	returns: true, false
 **/
void RFM70::send(uint8_t* s, uint8_t len)
{
        // Switch to tx mode
        pthread_mutex_lock(&g_mutex);
        cliTxDs();
        setMode(MODE_PTX);

        if (txTimeout()) {
                flushTxFIFO();
                cliTimeout();
        }

        sendPayload(s, len);

        //wait for packet to be sent
        usleep(SEND_DELAY);

        //switch to rx mode
        cliRxDr();
        setMode(MODE_PRX);
        pthread_mutex_unlock(&g_mutex);

}