449 lines
16 KiB
C
449 lines
16 KiB
C
/**
|
|
@Generated Pin Manager Header File
|
|
|
|
@Company:
|
|
Microchip Technology Inc.
|
|
|
|
@File Name:
|
|
pin_manager.h
|
|
|
|
@Summary:
|
|
This is the Pin Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
|
|
|
|
@Description
|
|
This header file provides APIs for driver for .
|
|
Generation Information :
|
|
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.6
|
|
Device : PIC16F1829
|
|
Driver Version : 2.11
|
|
The generated drivers are tested against the following:
|
|
Compiler : XC8 2.30 and above
|
|
MPLAB : MPLAB X 5.40
|
|
*/
|
|
|
|
/*
|
|
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
|
|
|
Subject to your compliance with these terms, you may use Microchip software and any
|
|
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
|
|
license terms applicable to your use of third party software (including open source software) that
|
|
may accompany Microchip software.
|
|
|
|
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
|
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
|
|
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
|
|
FOR A PARTICULAR PURPOSE.
|
|
|
|
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
|
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
|
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
|
|
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
|
|
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
|
|
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
|
|
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
|
|
SOFTWARE.
|
|
*/
|
|
|
|
#ifndef PIN_MANAGER_H
|
|
#define PIN_MANAGER_H
|
|
|
|
/**
|
|
Section: Included Files
|
|
*/
|
|
|
|
#include <xc.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 BT_Stat1 aliases
|
|
#define BT_Stat1_TRIS TRISAbits.TRISA4
|
|
#define BT_Stat1_LAT LATAbits.LATA4
|
|
#define BT_Stat1_PORT PORTAbits.RA4
|
|
#define BT_Stat1_WPU WPUAbits.WPUA4
|
|
#define BT_Stat1_ANS ANSELAbits.ANSA4
|
|
#define BT_Stat1_SetHigh() do { LATAbits.LATA4 = 1; } while(0)
|
|
#define BT_Stat1_SetLow() do { LATAbits.LATA4 = 0; } while(0)
|
|
#define BT_Stat1_Toggle() do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0)
|
|
#define BT_Stat1_GetValue() PORTAbits.RA4
|
|
#define BT_Stat1_SetDigitalInput() do { TRISAbits.TRISA4 = 1; } while(0)
|
|
#define BT_Stat1_SetDigitalOutput() do { TRISAbits.TRISA4 = 0; } while(0)
|
|
#define BT_Stat1_SetPullup() do { WPUAbits.WPUA4 = 1; } while(0)
|
|
#define BT_Stat1_ResetPullup() do { WPUAbits.WPUA4 = 0; } while(0)
|
|
#define BT_Stat1_SetAnalogMode() do { ANSELAbits.ANSA4 = 1; } while(0)
|
|
#define BT_Stat1_SetDigitalMode() do { ANSELAbits.ANSA4 = 0; } while(0)
|
|
|
|
// get/set BT_Stat2 aliases
|
|
#define BT_Stat2_TRIS TRISAbits.TRISA5
|
|
#define BT_Stat2_LAT LATAbits.LATA5
|
|
#define BT_Stat2_PORT PORTAbits.RA5
|
|
#define BT_Stat2_WPU WPUAbits.WPUA5
|
|
#define BT_Stat2_SetHigh() do { LATAbits.LATA5 = 1; } while(0)
|
|
#define BT_Stat2_SetLow() do { LATAbits.LATA5 = 0; } while(0)
|
|
#define BT_Stat2_Toggle() do { LATAbits.LATA5 = ~LATAbits.LATA5; } while(0)
|
|
#define BT_Stat2_GetValue() PORTAbits.RA5
|
|
#define BT_Stat2_SetDigitalInput() do { TRISAbits.TRISA5 = 1; } while(0)
|
|
#define BT_Stat2_SetDigitalOutput() do { TRISAbits.TRISA5 = 0; } while(0)
|
|
#define BT_Stat2_SetPullup() do { WPUAbits.WPUA5 = 1; } while(0)
|
|
#define BT_Stat2_ResetPullup() do { WPUAbits.WPUA5 = 0; } while(0)
|
|
|
|
// get/set Led2 aliases
|
|
#define Led2_TRIS TRISBbits.TRISB5
|
|
#define Led2_LAT LATBbits.LATB5
|
|
#define Led2_PORT PORTBbits.RB5
|
|
#define Led2_WPU WPUBbits.WPUB5
|
|
#define Led2_ANS ANSELBbits.ANSB5
|
|
#define Led2_SetHigh() do { LATBbits.LATB5 = 1; } while(0)
|
|
#define Led2_SetLow() do { LATBbits.LATB5 = 0; } while(0)
|
|
#define Led2_Toggle() do { LATBbits.LATB5 = ~LATBbits.LATB5; } while(0)
|
|
#define Led2_GetValue() PORTBbits.RB5
|
|
#define Led2_SetDigitalInput() do { TRISBbits.TRISB5 = 1; } while(0)
|
|
#define Led2_SetDigitalOutput() do { TRISBbits.TRISB5 = 0; } while(0)
|
|
#define Led2_SetPullup() do { WPUBbits.WPUB5 = 1; } while(0)
|
|
#define Led2_ResetPullup() do { WPUBbits.WPUB5 = 0; } while(0)
|
|
#define Led2_SetAnalogMode() do { ANSELBbits.ANSB5 = 1; } while(0)
|
|
#define Led2_SetDigitalMode() do { ANSELBbits.ANSB5 = 0; } while(0)
|
|
|
|
// get/set Led aliases
|
|
#define Led_TRIS TRISBbits.TRISB6
|
|
#define Led_LAT LATBbits.LATB6
|
|
#define Led_PORT PORTBbits.RB6
|
|
#define Led_WPU WPUBbits.WPUB6
|
|
#define Led_SetHigh() do { LATBbits.LATB6 = 1; } while(0)
|
|
#define Led_SetLow() do { LATBbits.LATB6 = 0; } while(0)
|
|
#define Led_Toggle() do { LATBbits.LATB6 = ~LATBbits.LATB6; } while(0)
|
|
#define Led_GetValue() PORTBbits.RB6
|
|
#define Led_SetDigitalInput() do { TRISBbits.TRISB6 = 1; } while(0)
|
|
#define Led_SetDigitalOutput() do { TRISBbits.TRISB6 = 0; } while(0)
|
|
#define Led_SetPullup() do { WPUBbits.WPUB6 = 1; } while(0)
|
|
#define Led_ResetPullup() do { WPUBbits.WPUB6 = 0; } while(0)
|
|
|
|
// get/set A_S1 aliases
|
|
#define A_S1_TRIS TRISCbits.TRISC0
|
|
#define A_S1_LAT LATCbits.LATC0
|
|
#define A_S1_PORT PORTCbits.RC0
|
|
#define A_S1_WPU WPUCbits.WPUC0
|
|
#define A_S1_ANS ANSELCbits.ANSC0
|
|
#define A_S1_SetHigh() do { LATCbits.LATC0 = 1; } while(0)
|
|
#define A_S1_SetLow() do { LATCbits.LATC0 = 0; } while(0)
|
|
#define A_S1_Toggle() do { LATCbits.LATC0 = ~LATCbits.LATC0; } while(0)
|
|
#define A_S1_GetValue() PORTCbits.RC0
|
|
#define A_S1_SetDigitalInput() do { TRISCbits.TRISC0 = 1; } while(0)
|
|
#define A_S1_SetDigitalOutput() do { TRISCbits.TRISC0 = 0; } while(0)
|
|
#define A_S1_SetPullup() do { WPUCbits.WPUC0 = 1; } while(0)
|
|
#define A_S1_ResetPullup() do { WPUCbits.WPUC0 = 0; } while(0)
|
|
#define A_S1_SetAnalogMode() do { ANSELCbits.ANSC0 = 1; } while(0)
|
|
#define A_S1_SetDigitalMode() do { ANSELCbits.ANSC0 = 0; } while(0)
|
|
|
|
// get/set A_S2 aliases
|
|
#define A_S2_TRIS TRISCbits.TRISC1
|
|
#define A_S2_LAT LATCbits.LATC1
|
|
#define A_S2_PORT PORTCbits.RC1
|
|
#define A_S2_WPU WPUCbits.WPUC1
|
|
#define A_S2_ANS ANSELCbits.ANSC1
|
|
#define A_S2_SetHigh() do { LATCbits.LATC1 = 1; } while(0)
|
|
#define A_S2_SetLow() do { LATCbits.LATC1 = 0; } while(0)
|
|
#define A_S2_Toggle() do { LATCbits.LATC1 = ~LATCbits.LATC1; } while(0)
|
|
#define A_S2_GetValue() PORTCbits.RC1
|
|
#define A_S2_SetDigitalInput() do { TRISCbits.TRISC1 = 1; } while(0)
|
|
#define A_S2_SetDigitalOutput() do { TRISCbits.TRISC1 = 0; } while(0)
|
|
#define A_S2_SetPullup() do { WPUCbits.WPUC1 = 1; } while(0)
|
|
#define A_S2_ResetPullup() do { WPUCbits.WPUC1 = 0; } while(0)
|
|
#define A_S2_SetAnalogMode() do { ANSELCbits.ANSC1 = 1; } while(0)
|
|
#define A_S2_SetDigitalMode() do { ANSELCbits.ANSC1 = 0; } while(0)
|
|
|
|
// get/set O_Vbrd aliases
|
|
#define O_Vbrd_TRIS TRISCbits.TRISC2
|
|
#define O_Vbrd_LAT LATCbits.LATC2
|
|
#define O_Vbrd_PORT PORTCbits.RC2
|
|
#define O_Vbrd_WPU WPUCbits.WPUC2
|
|
#define O_Vbrd_ANS ANSELCbits.ANSC2
|
|
#define O_Vbrd_SetHigh() do { LATCbits.LATC2 = 1; } while(0)
|
|
#define O_Vbrd_SetLow() do { LATCbits.LATC2 = 0; } while(0)
|
|
#define O_Vbrd_Toggle() do { LATCbits.LATC2 = ~LATCbits.LATC2; } while(0)
|
|
#define O_Vbrd_GetValue() PORTCbits.RC2
|
|
#define O_Vbrd_SetDigitalInput() do { TRISCbits.TRISC2 = 1; } while(0)
|
|
#define O_Vbrd_SetDigitalOutput() do { TRISCbits.TRISC2 = 0; } while(0)
|
|
#define O_Vbrd_SetPullup() do { WPUCbits.WPUC2 = 1; } while(0)
|
|
#define O_Vbrd_ResetPullup() do { WPUCbits.WPUC2 = 0; } while(0)
|
|
#define O_Vbrd_SetAnalogMode() do { ANSELCbits.ANSC2 = 1; } while(0)
|
|
#define O_Vbrd_SetDigitalMode() do { ANSELCbits.ANSC2 = 0; } while(0)
|
|
|
|
// get/set BT_RxInd aliases
|
|
#define BT_RxInd_TRIS TRISCbits.TRISC3
|
|
#define BT_RxInd_LAT LATCbits.LATC3
|
|
#define BT_RxInd_PORT PORTCbits.RC3
|
|
#define BT_RxInd_WPU WPUCbits.WPUC3
|
|
#define BT_RxInd_ANS ANSELCbits.ANSC3
|
|
#define BT_RxInd_SetHigh() do { LATCbits.LATC3 = 1; } while(0)
|
|
#define BT_RxInd_SetLow() do { LATCbits.LATC3 = 0; } while(0)
|
|
#define BT_RxInd_Toggle() do { LATCbits.LATC3 = ~LATCbits.LATC3; } while(0)
|
|
#define BT_RxInd_GetValue() PORTCbits.RC3
|
|
#define BT_RxInd_SetDigitalInput() do { TRISCbits.TRISC3 = 1; } while(0)
|
|
#define BT_RxInd_SetDigitalOutput() do { TRISCbits.TRISC3 = 0; } while(0)
|
|
#define BT_RxInd_SetPullup() do { WPUCbits.WPUC3 = 1; } while(0)
|
|
#define BT_RxInd_ResetPullup() do { WPUCbits.WPUC3 = 0; } while(0)
|
|
#define BT_RxInd_SetAnalogMode() do { ANSELCbits.ANSC3 = 1; } while(0)
|
|
#define BT_RxInd_SetDigitalMode() do { ANSELCbits.ANSC3 = 0; } while(0)
|
|
|
|
// get/set RC4 procedures
|
|
#define RC4_SetHigh() do { LATCbits.LATC4 = 1; } while(0)
|
|
#define RC4_SetLow() do { LATCbits.LATC4 = 0; } while(0)
|
|
#define RC4_Toggle() do { LATCbits.LATC4 = ~LATCbits.LATC4; } while(0)
|
|
#define RC4_GetValue() PORTCbits.RC4
|
|
#define RC4_SetDigitalInput() do { TRISCbits.TRISC4 = 1; } while(0)
|
|
#define RC4_SetDigitalOutput() do { TRISCbits.TRISC4 = 0; } while(0)
|
|
#define RC4_SetPullup() do { WPUCbits.WPUC4 = 1; } while(0)
|
|
#define RC4_ResetPullup() do { WPUCbits.WPUC4 = 0; } while(0)
|
|
|
|
// get/set RC5 procedures
|
|
#define RC5_SetHigh() do { LATCbits.LATC5 = 1; } while(0)
|
|
#define RC5_SetLow() do { LATCbits.LATC5 = 0; } while(0)
|
|
#define RC5_Toggle() do { LATCbits.LATC5 = ~LATCbits.LATC5; } while(0)
|
|
#define RC5_GetValue() PORTCbits.RC5
|
|
#define RC5_SetDigitalInput() do { TRISCbits.TRISC5 = 1; } while(0)
|
|
#define RC5_SetDigitalOutput() do { TRISCbits.TRISC5 = 0; } while(0)
|
|
#define RC5_SetPullup() do { WPUCbits.WPUC5 = 1; } while(0)
|
|
#define RC5_ResetPullup() do { WPUCbits.WPUC5 = 0; } while(0)
|
|
|
|
// get/set BT_Rst aliases
|
|
#define BT_Rst_TRIS TRISCbits.TRISC6
|
|
#define BT_Rst_LAT LATCbits.LATC6
|
|
#define BT_Rst_PORT PORTCbits.RC6
|
|
#define BT_Rst_WPU WPUCbits.WPUC6
|
|
#define BT_Rst_ANS ANSELCbits.ANSC6
|
|
#define BT_Rst_SetHigh() do { LATCbits.LATC6 = 1; } while(0)
|
|
#define BT_Rst_SetLow() do { LATCbits.LATC6 = 0; } while(0)
|
|
#define BT_Rst_Toggle() do { LATCbits.LATC6 = ~LATCbits.LATC6; } while(0)
|
|
#define BT_Rst_GetValue() PORTCbits.RC6
|
|
#define BT_Rst_SetDigitalInput() do { TRISCbits.TRISC6 = 1; } while(0)
|
|
#define BT_Rst_SetDigitalOutput() do { TRISCbits.TRISC6 = 0; } while(0)
|
|
#define BT_Rst_SetPullup() do { WPUCbits.WPUC6 = 1; } while(0)
|
|
#define BT_Rst_ResetPullup() do { WPUCbits.WPUC6 = 0; } while(0)
|
|
#define BT_Rst_SetAnalogMode() do { ANSELCbits.ANSC6 = 1; } while(0)
|
|
#define BT_Rst_SetDigitalMode() do { ANSELCbits.ANSC6 = 0; } while(0)
|
|
|
|
// get/set BT_Mode aliases
|
|
#define BT_Mode_TRIS TRISCbits.TRISC7
|
|
#define BT_Mode_LAT LATCbits.LATC7
|
|
#define BT_Mode_PORT PORTCbits.RC7
|
|
#define BT_Mode_WPU WPUCbits.WPUC7
|
|
#define BT_Mode_ANS ANSELCbits.ANSC7
|
|
#define BT_Mode_SetHigh() do { LATCbits.LATC7 = 1; } while(0)
|
|
#define BT_Mode_SetLow() do { LATCbits.LATC7 = 0; } while(0)
|
|
#define BT_Mode_Toggle() do { LATCbits.LATC7 = ~LATCbits.LATC7; } while(0)
|
|
#define BT_Mode_GetValue() PORTCbits.RC7
|
|
#define BT_Mode_SetDigitalInput() do { TRISCbits.TRISC7 = 1; } while(0)
|
|
#define BT_Mode_SetDigitalOutput() do { TRISCbits.TRISC7 = 0; } while(0)
|
|
#define BT_Mode_SetPullup() do { WPUCbits.WPUC7 = 1; } while(0)
|
|
#define BT_Mode_ResetPullup() do { WPUCbits.WPUC7 = 0; } while(0)
|
|
#define BT_Mode_SetAnalogMode() do { ANSELCbits.ANSC7 = 1; } while(0)
|
|
#define BT_Mode_SetDigitalMode() do { ANSELCbits.ANSC7 = 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 IOCAF4 pin functionality
|
|
* @Example
|
|
IOCAF4_ISR();
|
|
*/
|
|
void IOCAF4_ISR(void);
|
|
|
|
/**
|
|
@Summary
|
|
Interrupt Handler Setter for IOCAF4 pin interrupt-on-change functionality
|
|
|
|
@Description
|
|
Allows selecting an interrupt handler for IOCAF4 at application runtime
|
|
|
|
@Preconditions
|
|
Pin Manager intializer called
|
|
|
|
@Returns
|
|
None.
|
|
|
|
@Param
|
|
InterruptHandler function pointer.
|
|
|
|
@Example
|
|
PIN_MANAGER_Initialize();
|
|
IOCAF4_SetInterruptHandler(MyInterruptHandler);
|
|
|
|
*/
|
|
void IOCAF4_SetInterruptHandler(void (* InterruptHandler)(void));
|
|
|
|
/**
|
|
@Summary
|
|
Dynamic Interrupt Handler for IOCAF4 pin
|
|
|
|
@Description
|
|
This is a dynamic interrupt handler to be used together with the IOCAF4_SetInterruptHandler() method.
|
|
This handler is called every time the IOCAF4 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();
|
|
IOCAF4_SetInterruptHandler(IOCAF4_InterruptHandler);
|
|
|
|
*/
|
|
extern void (*IOCAF4_InterruptHandler)(void);
|
|
|
|
/**
|
|
@Summary
|
|
Default Interrupt Handler for IOCAF4 pin
|
|
|
|
@Description
|
|
This is a predefined interrupt handler to be used together with the IOCAF4_SetInterruptHandler() method.
|
|
This handler is called every time the IOCAF4 ISR is executed.
|
|
|
|
@Preconditions
|
|
Pin Manager intializer called
|
|
|
|
@Returns
|
|
None.
|
|
|
|
@Param
|
|
None.
|
|
|
|
@Example
|
|
PIN_MANAGER_Initialize();
|
|
IOCAF4_SetInterruptHandler(IOCAF4_DefaultInterruptHandler);
|
|
|
|
*/
|
|
void IOCAF4_DefaultInterruptHandler(void);
|
|
|
|
|
|
/**
|
|
* @Param
|
|
none
|
|
* @Returns
|
|
none
|
|
* @Description
|
|
Interrupt on Change Handler for the IOCAF5 pin functionality
|
|
* @Example
|
|
IOCAF5_ISR();
|
|
*/
|
|
void IOCAF5_ISR(void);
|
|
|
|
/**
|
|
@Summary
|
|
Interrupt Handler Setter for IOCAF5 pin interrupt-on-change functionality
|
|
|
|
@Description
|
|
Allows selecting an interrupt handler for IOCAF5 at application runtime
|
|
|
|
@Preconditions
|
|
Pin Manager intializer called
|
|
|
|
@Returns
|
|
None.
|
|
|
|
@Param
|
|
InterruptHandler function pointer.
|
|
|
|
@Example
|
|
PIN_MANAGER_Initialize();
|
|
IOCAF5_SetInterruptHandler(MyInterruptHandler);
|
|
|
|
*/
|
|
void IOCAF5_SetInterruptHandler(void (* InterruptHandler)(void));
|
|
|
|
/**
|
|
@Summary
|
|
Dynamic Interrupt Handler for IOCAF5 pin
|
|
|
|
@Description
|
|
This is a dynamic interrupt handler to be used together with the IOCAF5_SetInterruptHandler() method.
|
|
This handler is called every time the IOCAF5 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();
|
|
IOCAF5_SetInterruptHandler(IOCAF5_InterruptHandler);
|
|
|
|
*/
|
|
extern void (*IOCAF5_InterruptHandler)(void);
|
|
|
|
/**
|
|
@Summary
|
|
Default Interrupt Handler for IOCAF5 pin
|
|
|
|
@Description
|
|
This is a predefined interrupt handler to be used together with the IOCAF5_SetInterruptHandler() method.
|
|
This handler is called every time the IOCAF5 ISR is executed.
|
|
|
|
@Preconditions
|
|
Pin Manager intializer called
|
|
|
|
@Returns
|
|
None.
|
|
|
|
@Param
|
|
None.
|
|
|
|
@Example
|
|
PIN_MANAGER_Initialize();
|
|
IOCAF5_SetInterruptHandler(IOCAF5_DefaultInterruptHandler);
|
|
|
|
*/
|
|
void IOCAF5_DefaultInterruptHandler(void);
|
|
|
|
|
|
|
|
#endif // PIN_MANAGER_H
|
|
/**
|
|
End of File
|
|
*/ |