/**
  @Generated Pin Manager Header File

  @Company:
    Microchip Technology Inc.

  @File Name:
    pin_manager.h

  @Summary:
    This is the Pin Manager file generated using MPLAB(c) Code Configurator

  @Description:
    This header file provides implementations for pin APIs for all pins selected in the GUI.
    Generation Information :
        Product Revision  :  MPLAB(c) Code Configurator - 4.0
        Device            :  PIC12F1822
        Version           :  1.01
    The generated drivers are tested against the following:
        Compiler          :  XC8 1.35
        MPLAB             :  MPLAB X 3.40

    Copyright (c) 2013 - 2015 released 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 that 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.

*/


#ifndef PIN_MANAGER_H
#define PIN_MANAGER_H

#define INPUT   1
#define OUTPUT  0

#define HIGH    1
#define LOW     0

#define ANALOG      1
#define DIGITAL     0

#define PULL_UP_ENABLED      1
#define PULL_UP_DISABLED     0

// get/set SENS aliases
#define SENS_TRIS               TRISAbits.TRISA0
#define SENS_LAT                LATAbits.LATA0
#define SENS_PORT               PORTAbits.RA0
#define SENS_WPU                WPUAbits.WPUA0
#define SENS_ANS                ANSELAbits.ANSA0
#define SENS_SetHigh()            do { LATAbits.LATA0 = 1; } while(0)
#define SENS_SetLow()             do { LATAbits.LATA0 = 0; } while(0)
#define SENS_Toggle()             do { LATAbits.LATA0 = ~LATAbits.LATA0; } while(0)
#define SENS_GetValue()           PORTAbits.RA0
#define SENS_SetDigitalInput()    do { TRISAbits.TRISA0 = 1; } while(0)
#define SENS_SetDigitalOutput()   do { TRISAbits.TRISA0 = 0; } while(0)
#define SENS_SetPullup()      do { WPUAbits.WPUA0 = 1; } while(0)
#define SENS_ResetPullup()    do { WPUAbits.WPUA0 = 0; } while(0)
#define SENS_SetAnalogMode()  do { ANSELAbits.ANSA0 = 1; } while(0)
#define SENS_SetDigitalMode() do { ANSELAbits.ANSA0 = 0; } while(0)

// get/set KEY aliases
#define KEY_TRIS               TRISAbits.TRISA2
#define KEY_LAT                LATAbits.LATA2
#define KEY_PORT               PORTAbits.RA2
#define KEY_WPU                WPUAbits.WPUA2
#define KEY_ANS                ANSELAbits.ANSA2
#define KEY_SetHigh()            do { LATAbits.LATA2 = 1; } while(0)
#define KEY_SetLow()             do { LATAbits.LATA2 = 0; } while(0)
#define KEY_Toggle()             do { LATAbits.LATA2 = ~LATAbits.LATA2; } while(0)
#define KEY_GetValue()           PORTAbits.RA2
#define KEY_SetDigitalInput()    do { TRISAbits.TRISA2 = 1; } while(0)
#define KEY_SetDigitalOutput()   do { TRISAbits.TRISA2 = 0; } while(0)
#define KEY_SetPullup()      do { WPUAbits.WPUA2 = 1; } while(0)
#define KEY_ResetPullup()    do { WPUAbits.WPUA2 = 0; } while(0)
#define KEY_SetAnalogMode()  do { ANSELAbits.ANSA2 = 1; } while(0)
#define KEY_SetDigitalMode() do { ANSELAbits.ANSA2 = 0; } while(0)

// get/set LED aliases
#define LED_TRIS               TRISAbits.TRISA4
#define LED_LAT                LATAbits.LATA4
#define LED_PORT               PORTAbits.RA4
#define LED_WPU                WPUAbits.WPUA4
#define LED_ANS                ANSELAbits.ANSA4
#define LED_SetHigh()            do { LATAbits.LATA4 = 1; } while(0)
#define LED_SetLow()             do { LATAbits.LATA4 = 0; } while(0)
#define LED_Toggle()             do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0)
#define LED_GetValue()           PORTAbits.RA4
#define LED_SetDigitalInput()    do { TRISAbits.TRISA4 = 1; } while(0)
#define LED_SetDigitalOutput()   do { TRISAbits.TRISA4 = 0; } while(0)
#define LED_SetPullup()      do { WPUAbits.WPUA4 = 1; } while(0)
#define LED_ResetPullup()    do { WPUAbits.WPUA4 = 0; } while(0)
#define LED_SetAnalogMode()  do { ANSELAbits.ANSA4 = 1; } while(0)
#define LED_SetDigitalMode() do { ANSELAbits.ANSA4 = 0; } while(0)

// get/set BEEP aliases
#define BEEP_TRIS               TRISAbits.TRISA5
#define BEEP_LAT                LATAbits.LATA5
#define BEEP_PORT               PORTAbits.RA5
#define BEEP_WPU                WPUAbits.WPUA5
#define BEEP_SetHigh()            do { LATAbits.LATA5 = 1; } while(0)
#define BEEP_SetLow()             do { LATAbits.LATA5 = 0; } while(0)
#define BEEP_Toggle()             do { LATAbits.LATA5 = ~LATAbits.LATA5; } while(0)
#define BEEP_GetValue()           PORTAbits.RA5
#define BEEP_SetDigitalInput()    do { TRISAbits.TRISA5 = 1; } while(0)
#define BEEP_SetDigitalOutput()   do { TRISAbits.TRISA5 = 0; } while(0)
#define BEEP_SetPullup()      do { WPUAbits.WPUA5 = 1; } while(0)
#define BEEP_ResetPullup()    do { WPUAbits.WPUA5 = 0; } while(0)

/**
   @Param
    none
   @Returns
    none
   @Description
    GPIO and peripheral I/O initialization
   @Example
    PIN_MANAGER_Initialize();
 */
void PIN_MANAGER_Initialize (void);

/**
 * @Param
    none
 * @Returns
    none
 * @Description
    Interrupt on Change Handling routine
 * @Example
    PIN_MANAGER_IOC();
 */
void PIN_MANAGER_IOC(void);


/**
 * @Param
    none
 * @Returns
    none
 * @Description
    Interrupt on Change Handler for the IOCAF0 pin functionality
 * @Example
    IOCAF0_ISR();
 */
void IOCAF0_ISR(void);

/**
  @Summary
    Interrupt Handler Setter for IOCAF0 pin interrupt-on-change functionality

  @Description
    Allows selecting an interrupt handler for IOCAF0 at application runtime
    
  @Preconditions
    Pin Manager intializer called

  @Returns
    None.

  @Param
    InterruptHandler function pointer.

  @Example
    PIN_MANAGER_Initialize();
    IOCAF0_SetInterruptHandler(MyInterruptHandler);

*/
void IOCAF0_SetInterruptHandler(void* InterruptHandler);

/**
  @Summary
    Dynamic Interrupt Handler for IOCAF0 pin

  @Description
    This is a dynamic interrupt handler to be used together with the IOCAF0_SetInterruptHandler() method.
    This handler is called every time the IOCAF0 ISR is executed and allows any function to be registered at runtime.
    
  @Preconditions
    Pin Manager intializer called

  @Returns
    None.

  @Param
    None.

  @Example
    PIN_MANAGER_Initialize();
    IOCAF0_SetInterruptHandler(IOCAF0_InterruptHandler);

*/
extern void (*IOCAF0_InterruptHandler)(void);

/**
  @Summary
    Default Interrupt Handler for IOCAF0 pin

  @Description
    This is a predefined interrupt handler to be used together with the IOCAF0_SetInterruptHandler() method.
    This handler is called every time the IOCAF0 ISR is executed. 
    
  @Preconditions
    Pin Manager intializer called

  @Returns
    None.

  @Param
    None.

  @Example
    PIN_MANAGER_Initialize();
    IOCAF0_SetInterruptHandler(IOCAF0_DefaultInterruptHandler);

*/
void IOCAF0_DefaultInterruptHandler(void);



#endif // PIN_MANAGER_H
/**
 End of File
*/