/*****************************************************************************
 *
 * Beeper.
 *
 *****************************************************************************
 * FileName:        Beep.h
 * Dependencies:    Graphics.h
 * Processor:       PIC24F, PIC24H, dsPIC, PIC32
 * Compiler:       	MPLAB C30 V3.00, MPLAB C32
 * Linker:          MPLAB LINK30, MPLAB LINK32
 * Company:         Microchip Technology Incorporated
 *
 * Software License Agreement
 *
 * Copyright ?2008 Microchip Technology Inc.  All rights reserved.
 * Microchip licenses to you the right to use, modify, copy and distribute
 * Software only when embedded on a Microchip microcontroller or digital
 * signal controller, which is integrated into your product or third party
 * product (pursuant to the sublicense terms in the accompanying license
 * agreement).  
 *
 * You should refer to the license agreement accompanying this Software
 * for additional information regarding your rights and obligations.
 *
 * SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS?WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
 * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR
 * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
 * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION,
 * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT
 * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL,
 * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
 * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY
 * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF),
 * OR OTHER SIMILAR COSTS.
 *
 * Author               Date        Comment
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Anton Alkhimenok		07/10/07	...
 * Anton Alkhimenok     02/07/08    PIC32 support
 *****************************************************************************/

/*
******************************************************************************
* Revision:
* This file modified for Solomon SSD1963 driver development
* Programmer: John Leung
* Company: TechToys Co.
* Web: www.TechToys.com.hk
* Date: 16th Jan 2010
* keyword: TechToys
* (1) Add 	support for the hardware platform PIC24/32 Eval Rev2C with
*			(GRAPHICS_HARDWARE_PLATFORM == PIC_EVK_V2C)
******************************************************************************
*/

#ifndef _BEEP_H
    #define _BEEP_H

    #include "Graphics\Graphics.h"

    #if defined(__dsPIC33F__) || defined(__PIC24H__)
        #define BEEP_TIME   10
    #else
		#if (GRAPHICS_HARDWARE_PLATFORM ==PIC_EVK_V2C) //TechToys
        	#define BEEP_TIME   50
		#else
			#define BEEP_TIME   500
		#endif
    #endif

    #ifdef __PIC32MX
		#if (GRAPHICS_HARDWARE_PLATFORM ==PIC_EVK_V2C) //TechToys
        	#define TIMER_BASE  44000	//TechToys
		#else
			#define TIMER_BASE  4400
		#endif
    #else
		#if (GRAPHICS_HARDWARE_PLATFORM ==PIC_EVK_V2C) //TechToys
        	#define TIMER_BASE  5000	//TechToys
		#else
			#define TIMER_BASE  500
		#endif
    #endif

/*********************************************************************
* Function:  void BeepInit(void)
*
* PreCondition: none
*
* Input: none
*
* Output: none
*
* Side Effects: none
*
* Overview: initializes beeper
*
* Note: none
*
********************************************************************/
void    BeepInit(void);

/*********************************************************************
* Macro:  Beep()
*
* PreCondition: none
*
* Input: none
*
* Output: none
*
* Side Effects: none
*
* Overview: starts beeper
*
* Note: none
*
********************************************************************/
	//TechToys
    #if ((GRAPHICS_HARDWARE_PLATFORM < GFX_PICTAIL_V3)||(GRAPHICS_HARDWARE_PLATFORM ==PIC_EVK_V2C))
        #define Beep()  T2CONbits.TON = 1
    #else
        #define Beep()
    #endif
#endif // _BEEP_H
