This example shows, how a frame is transmitted.
#include "board.h"
#include "transceiver.h"
#include "ioutil.h"
#include "xmpl.h"
static volatile bool tx_in_progress;
static volatile uint8_t tx_cnt;
int main(void)
{
uint8_t txfrm[] = {1,0,
42,
'h','e','l','l','o',' ','u','r','a','c','o','l','i','!',
'X','X'
};
ERR_CHECK_DIAG(TRX_OFF!=rval,1);
#if defined(TRX_IRQ_TRX_END)
#elif defined(TRX_IRQ_TX_END)
#else
# error "Unknown IRQ bits"
#endif
tx_cnt = 0;
tx_in_progress = false;
while(1)
{
WAIT500MS();
if (tx_in_progress == false)
{
txfrm[2] = tx_cnt;
tx_in_progress = true;
}
}
}
#if defined(TRX_IF_RFA1)
ISR(TRX24_TX_END_vect)
{
tx_in_progress = false;
tx_cnt ++;
}
#else
ISR(TRX_IRQ_vect)
{
if (irq_cause & TRX_IRQ_TRX_END)
{
tx_in_progress = false;
tx_cnt ++;
}
}
#endif