/**
  Generated Pin Manager File

  Company:
    Microchip Technology Inc.

  File Name:
    pin_manager.c

  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 - 3.15.0
        Device            :  PIC16F1769
        Driver Version    :  1.02
    The generated drivers are tested against the following:
        Compiler          :  XC8 1.35
        MPLAB             :  MPLAB X 3.20

    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.

*/

#include <xc.h>
#include "pin_manager.h"
#include <stdbool.h>

void PIN_MANAGER_Initialize(void)
{
    LATB = 0x0;
    LATA = 0x4;
    LATC = 0x0;
    WPUA = 0x3B;
    WPUB = 0xF0;
    WPUC = 0xFF;
    ANSELA = 0x17;
    ANSELB = 0xD0;
    ANSELC = 0xC7;
    TRISB = 0xD0;
    TRISC = 0x6A;
    TRISA = 0x33;

    OPTION_REGbits.nWPUEN = 0x0;


    bool state = GIE;
    GIE = 0;
    PPSLOCK = 0x55;
    PPSLOCK = 0xAA;
    PPSLOCKbits.PPSLOCKED = 0x00; // unlock PPS

    CLCIN1PPSbits.CLCIN1PPS = 0x05;   //RA5->CLC1:CLCIN1;
    PRG1FPPSbits.PRG1FPPS = 0x0D;   //RB5->PRG1:PRG1F;
    RC0PPSbits.RC0PPS = 0x04;   //RC0->COG1:COG1A;
    CLCIN0PPSbits.CLCIN0PPS = 0x05;   //RA5->CLC1:CLCIN0;
    CLCIN2PPSbits.CLCIN2PPS = 0x05;   //RA5->CLC1:CLCIN2;
    CLCIN3PPSbits.CLCIN3PPS = 0x05;   //RA5->CLC1:CLCIN3;

    #if (__XC8_VERSION < 1370)
    T2CKIPPSbits.T2CKIPPS = 0x05;   //RA5->TMR2:T2CKI;
    #else
    T2INPPSbits.T2INPPS = 0x05;   //RA5->TMR2:T2CKI;
    #endif

    PRG1RPPSbits.PRG1RPPS = 0x14;   //RC4->PRG1:PRG1R;
    RB5PPSbits.RB5PPS = 0x01;   //RB5->CLC1:CLC1OUT;

    PPSLOCK = 0x55;
    PPSLOCK = 0xAA;
    PPSLOCKbits.PPSLOCKED = 0x01; // lock PPS

    GIE = state;

}


void PIN_MANAGER_IOC(void)
{    
}

/**
 End of File
*/
