/**
 * ----------------------------------------HSLU T&A------------------------------------------
 *
 * $HeadURL: svn://ceesar.dyndns.info/home/_svn/hasler/software/us-transmitter/trunk/Software_CC2430_IAR_v7.20/rf.h $
 * $LastChangedBy: tasteige $
 * $LastChangedRevision: 363 $
 * $LastChangedDate: 2008-09-02 15:15:04 +0200 (Di, 02 Sep 2008) $
 * $Id: rf.h 363 2008-09-02 13:15:04Z tasteige $
 *
 *
-------------------------------------------------------------------------------------------
 *
 * Description:
 *
 *  Listen with the radio Part on the advice to send a signal with US
 *
 **/

#ifndef RF_h
#define RF_h

#include <stdio.h>

#include "global.h"
#include "hal.h"


/**
* Initializes the timer 3 for measuring TIMER3PERIODUS (normally 600us) cycles!
*
*/
void rf_Timer3Init(UINT16 usec);



/******************************************************************************
* @fn  rfInit
*
* @brief
*      This function configures the radio for simple send and receive operation.
*      Advanced IEEE 802.15.4 functionality such as Address Decoding, AutoAck
*      etc is not employed. CRC value is automatically calculated to enable
*      detection of packet corruption. The desired frequency is set. The
*      function returns TRUE if the configuration is successful.
*
* Parameters:
*
* @param  UINT32 frequency
*         The desired Radio Frequency in kHz.
*
* @return BOOL
*         Returns TRUE if the configuration is successful and FALSE otherwise.
*/

BOOL rf_Init(UINT32 frequency);



/**
*   Call this function in Main() to wait on the RF Packet and to check it.
*
*/
void rf_waitAndCheckRFPacket();



/**
*   Analysis of the received packet. It sets also the time the badge has to wait
*   until it's his turn with sending the US signal
*
*   BYTE*packet: a pointer on the Array where the packet is stored. The array has to have space
*                for at least 128 bytes!
*
*   return: true if correct packet, 0 if the packet is not usable.
*/

BOOL rf_checkPacket(BYTE* packet);


#endif
