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

 FileName:      helpers.h 
 Dependencies:  See INCLUDES section
 Processor:		PIC18 USB Microcontrollers
 Hardware:		
 Complier:  	Microchip C18 (for PIC18), C30 (for PIC24), C32 (for PIC32)
 Company:		


********************************************************************
 File Description:

 Change History:
  Rev   Description
  ----  -----------------------------------------
  1.0   In developement

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


#ifndef HELPERS_H
#define HELPERS_H

/** I N C L U D E S **********************************************************/
/*
#include "GenericTypeDefs.h"
#include "usb.h"
#include "usb_config.h"
*/

/** D E F I N I T I O N S ****************************************************/

/* Class-Specific Requests */
/*
#define SEND_ENCAPSULATED_COMMAND   0x00
#define GET_ENCAPSULATED_RESPONSE   0x01
#define SET_COMM_FEATURE            0x02
#define GET_COMM_FEATURE            0x03
#define CLEAR_COMM_FEATURE          0x04
*/

/** S T R U C T U R E S ******************************************************/

/* Line Coding Structure */
/*
#define LINE_CODING_LENGTH          0x07
typedef union _LINE_CODING
{
    struct
    {
        BYTE _byte[LINE_CODING_LENGTH];
    };
    struct
    {
        DWORD_VAL   dwDTERate;          // Complex data structure
        BYTE    bCharFormat;
        BYTE    bParityType;
        BYTE    bDataBits;
    };
} LINE_CODING;
*/

/** E X T E R N S ************************************************************/
/* K&R says externs are variables outside all functions including main();
/*
extern BYTE cdc_rx_len;
extern USB_HANDLE lastTransmission;

*/
/* 
it is possible to include extern in files that define the variables.
The externs listed here are defined in helpers.c 
*/

extern int hlp_count;
#define MAXBUFF 17
extern	char 	buff[MAXBUFF];
extern	int 	buffIndex;
extern	int 	firstTime;
extern char USB_In_Buffer[64];
extern char USB_Out_Buffer[64];
extern volatile BOOL buttonPressed;
extern volatile BYTE buttonCount;
extern volatile BYTE buttonCount2;





/** Public Prototypes *************************************************/
/*
void USBCheckCDCRequest(void);
void CDCInitEP(void);
BYTE getsUSBUSART(char *buffer, BYTE len);
void putrsUSBUSART(const ROM char *data);
void putUSBUSART(char *data, BYTE Length);
void putsUSBUSART(char *data);
void CDCTxService(void);
*/

void toHex(  unsigned n, char * buff2 );
int  toNum(  char * buff );
int  tolook( int offset  );
void put(    int offset, unsigned num );


/* */

BYTE buildLine( char ipChar );
void processBuffer( BYTE cmdFound );

/* */



#endif //HELPERS_H