#ifndef SNIFFER_H_
#define SNIFFER_H_

#include "inc/hw_types.h"

//*****************************************************************************

#define DEBUG

//#define CPU_XTAL 8000000

// AT86RF231 Pinout
#define TRX231_PORT_BASE         GPIO_PORTD_BASE
#define TRX231_PORT_IRQ	     	 INT_GPIOD
#define TRX231_PERIPHERAL 	 SYSCTL_PERIPH_GPIOD
#define TRX231_SEL0              GPIO_PIN_5
#define TRX231_IRQ               GPIO_PIN_4
#define TRX231_RST               GPIO_PIN_6
#define TRX231_SLP               GPIO_PIN_7

#define LED_PORT_BASE	         GPIO_PORTF_BASE
#define LED_PERIPHERAL		 SYSCTL_PERIPH_GPIOF
#define LED_GREEN		 GPIO_PIN_0

//*****************************************************************************
//
// Čítáno pro 100us
//
//*****************************************************************************
#define NUMBER_OF_SECS      10000
#define NUMBER_OF_NSECS     100000



//*****************************************************************************
//! \name SoftEEPROM Constants
// Defines for the SoftEEPROM area.
//@{
//*****************************************************************************
#define SOFTEEPROM_START	0x0003F000	//!< Start of SoftEEPROM location in flash
//#define SOFTEEPROM_END		0x00040000	//!< End of SoftEEPROM location in flash
#define SOFTEEPROM_END		0x0003FFFF	//!< End of SoftEEPROM location in flash

//*****************************************************************************

typedef enum {RUNNING, STOPPED, ERROR } tSnifferState;
typedef enum {HIGH, MEDIUM, LOW, LOWEST } tSnifferSensitivity;

//*****************************************************************************

typedef struct snifferSettings 
{
	tSnifferState state; 
	unsigned char ipaddr[4];
	unsigned char nmask[4];
	unsigned char gw[4];
	unsigned char macaddr[8];
        unsigned char reipaddr[4];
        unsigned short report;
	unsigned char channel;
	tBoolean      filterCrc;
        unsigned char filterPanId[2];
	tBoolean      dhcpOn;
	tSnifferSensitivity sensitivity;
        //tBoolean      setConfig;
} tSnifferSettings;

//*****************************************************************************

extern void DebugMsg(const char *str, ...);

extern void trx231_pinset_select(tBoolean val);
extern void trx231_pinset_reset(tBoolean val);
extern void trx231_pinset_slptr(tBoolean val);
extern void ledgreen_pinset(tBoolean val);
extern void delay(unsigned long ul);

//*****************************************************************************
#endif /*SNIFFER_H_*/
