int main( void ) { char str[] = "DEADBEEF"; unsigned char *tmp; int i=0, res; bufferInit( &myBuff, serial_link, 256 ); stxetxInit( put_char ); stxetxSend( 0, 0, strlen( str ), (unsigned char*) str ); // Now parse the package byte by until the receive function claims success. printf( "\nStarting parsing" ); res = stxetxProcess( &myBuff ); #if 0 do { res = stxetxProcess( &myBuff ); printf( "." ); } while ( res ); #endif printf( "\nFinnished parsing!\n" ); tmp = stxetxGetRxPacketData(); for ( i = 0; i < stxetxGetRxPacketDatalength(); i++ ) { printf( "%x ", *tmp ); // Show the received data tmp++; } printf( "\n" ); return 0; }
// functions void radioInit(void) { // Initialize radio interface // Since this radio creates a special serial interface, // we initialize it here. uartswInit(); // set baud rate of comm uartswSetBaudRate(4800); // initialize stxetx to use the software UART for sending data stxetxInit(uartswSendByte); }