224 lines
12 KiB
C
224 lines
12 KiB
C
/**
|
|
* Generated Pins header File
|
|
*
|
|
* @file pins.h
|
|
*
|
|
* @defgroup pinsdriver Pins Driver
|
|
*
|
|
* @brief This is generated driver header for pins.
|
|
* This header file provides APIs for all pins selected in the GUI.
|
|
*
|
|
* @version Driver Version 3.0.0
|
|
*/
|
|
|
|
/*
|
|
© [2025] 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.
|
|
You are responsible for complying with 3rd party license terms
|
|
applicable to your use of 3rd party software (including open source
|
|
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
|
|
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
|
|
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
|
|
MERCHANTABILITY, OR 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 RELATED TO THE SOFTWARE WILL NOT
|
|
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
|
|
THIS SOFTWARE.
|
|
*/
|
|
|
|
#ifndef PINS_H
|
|
#define PINS_H
|
|
|
|
#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 IO_RA0 aliases
|
|
#define IO_RA0_TRIS TRISAbits.TRISA0
|
|
#define IO_RA0_LAT LATAbits.LATA0
|
|
#define IO_RA0_PORT PORTAbits.RA0
|
|
#define IO_RA0_WPU WPUAbits.WPUA0
|
|
#define IO_RA0_OD ODCONAbits.ODCA0
|
|
#define IO_RA0_ANS ANSELAbits.ANSA0
|
|
#define IO_RA0_SetHigh() do { LATAbits.LATA0 = 1; } while(0)
|
|
#define IO_RA0_SetLow() do { LATAbits.LATA0 = 0; } while(0)
|
|
#define IO_RA0_Toggle() do { LATAbits.LATA0 = ~LATAbits.LATA0; } while(0)
|
|
#define IO_RA0_GetValue() PORTAbits.RA0
|
|
#define IO_RA0_SetDigitalInput() do { TRISAbits.TRISA0 = 1; } while(0)
|
|
#define IO_RA0_SetDigitalOutput() do { TRISAbits.TRISA0 = 0; } while(0)
|
|
#define IO_RA0_SetPullup() do { WPUAbits.WPUA0 = 1; } while(0)
|
|
#define IO_RA0_ResetPullup() do { WPUAbits.WPUA0 = 0; } while(0)
|
|
#define IO_RA0_SetPushPull() do { ODCONAbits.ODCA0 = 0; } while(0)
|
|
#define IO_RA0_SetOpenDrain() do { ODCONAbits.ODCA0 = 1; } while(0)
|
|
#define IO_RA0_SetAnalogMode() do { ANSELAbits.ANSA0 = 1; } while(0)
|
|
#define IO_RA0_SetDigitalMode() do { ANSELAbits.ANSA0 = 0; } while(0)
|
|
// get/set IO_RA2 aliases
|
|
#define DEBUG_TRIS TRISAbits.TRISA2
|
|
#define DEBUG_LAT LATAbits.LATA2
|
|
#define DEBUG_PORT PORTAbits.RA2
|
|
#define DEBUG_WPU WPUAbits.WPUA2
|
|
#define DEBUG_OD ODCONAbits.ODCA2
|
|
#define DEBUG_ANS ANSELAbits.ANSA2
|
|
#define DEBUG_SetHigh() do { LATAbits.LATA2 = 1; } while(0)
|
|
#define DEBUG_SetLow() do { LATAbits.LATA2 = 0; } while(0)
|
|
#define DEBUG_Toggle() do { LATAbits.LATA2 = ~LATAbits.LATA2; } while(0)
|
|
#define DEBUG_GetValue() PORTAbits.RA2
|
|
#define DEBUG_SetDigitalInput() do { TRISAbits.TRISA2 = 1; } while(0)
|
|
#define DEBUG_SetDigitalOutput() do { TRISAbits.TRISA2 = 0; } while(0)
|
|
#define DEBUG_SetPullup() do { WPUAbits.WPUA2 = 1; } while(0)
|
|
#define DEBUG_ResetPullup() do { WPUAbits.WPUA2 = 0; } while(0)
|
|
#define DEBUG_SetPushPull() do { ODCONAbits.ODCA2 = 0; } while(0)
|
|
#define DEBUG_SetOpenDrain() do { ODCONAbits.ODCA2 = 1; } while(0)
|
|
#define DEBUG_SetAnalogMode() do { ANSELAbits.ANSA2 = 1; } while(0)
|
|
#define DEBUG_SetDigitalMode() do { ANSELAbits.ANSA2 = 0; } while(0)
|
|
// get/set IO_RA4 aliases
|
|
#define LED1_TRIS TRISAbits.TRISA4
|
|
#define LED1_LAT LATAbits.LATA4
|
|
#define LED1_PORT PORTAbits.RA4
|
|
#define LED1_WPU WPUAbits.WPUA4
|
|
#define LED1_OD ODCONAbits.ODCA4
|
|
#define LED1_ANS ANSELAbits.ANSA4
|
|
#define LED1_SetHigh() do { LATAbits.LATA4 = 1; } while(0)
|
|
#define LED1_SetLow() do { LATAbits.LATA4 = 0; } while(0)
|
|
#define LED1_Toggle() do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0)
|
|
#define LED1_GetValue() PORTAbits.RA4
|
|
#define LED1_SetDigitalInput() do { TRISAbits.TRISA4 = 1; } while(0)
|
|
#define LED1_SetDigitalOutput() do { TRISAbits.TRISA4 = 0; } while(0)
|
|
#define LED1_SetPullup() do { WPUAbits.WPUA4 = 1; } while(0)
|
|
#define LED1_ResetPullup() do { WPUAbits.WPUA4 = 0; } while(0)
|
|
#define LED1_SetPushPull() do { ODCONAbits.ODCA4 = 0; } while(0)
|
|
#define LED1_SetOpenDrain() do { ODCONAbits.ODCA4 = 1; } while(0)
|
|
#define LED1_SetAnalogMode() do { ANSELAbits.ANSA4 = 1; } while(0)
|
|
#define LED1_SetDigitalMode() do { ANSELAbits.ANSA4 = 0; } while(0)
|
|
// get/set IO_RA5 aliases
|
|
#define LED2_TRIS TRISAbits.TRISA5
|
|
#define LED2_LAT LATAbits.LATA5
|
|
#define LED2_PORT PORTAbits.RA5
|
|
#define LED2_WPU WPUAbits.WPUA5
|
|
#define LED2_OD ODCONAbits.ODCA5
|
|
#define LED2_ANS ANSELAbits.ANSA5
|
|
#define LED2_SetHigh() do { LATAbits.LATA5 = 1; } while(0)
|
|
#define LED2_SetLow() do { LATAbits.LATA5 = 0; } while(0)
|
|
#define LED2_Toggle() do { LATAbits.LATA5 = ~LATAbits.LATA5; } while(0)
|
|
#define LED2_GetValue() PORTAbits.RA5
|
|
#define LED2_SetDigitalInput() do { TRISAbits.TRISA5 = 1; } while(0)
|
|
#define LED2_SetDigitalOutput() do { TRISAbits.TRISA5 = 0; } while(0)
|
|
#define LED2_SetPullup() do { WPUAbits.WPUA5 = 1; } while(0)
|
|
#define LED2_ResetPullup() do { WPUAbits.WPUA5 = 0; } while(0)
|
|
#define LED2_SetPushPull() do { ODCONAbits.ODCA5 = 0; } while(0)
|
|
#define LED2_SetOpenDrain() do { ODCONAbits.ODCA5 = 1; } while(0)
|
|
#define LED2_SetAnalogMode() do { ANSELAbits.ANSA5 = 1; } while(0)
|
|
#define LED2_SetDigitalMode() do { ANSELAbits.ANSA5 = 0; } while(0)
|
|
// get/set IO_RC0 aliases
|
|
#define IO_RC0_TRIS TRISCbits.TRISC0
|
|
#define IO_RC0_LAT LATCbits.LATC0
|
|
#define IO_RC0_PORT PORTCbits.RC0
|
|
#define IO_RC0_WPU WPUCbits.WPUC0
|
|
#define IO_RC0_OD ODCONCbits.ODCC0
|
|
#define IO_RC0_ANS ANSELCbits.ANSC0
|
|
#define IO_RC0_SetHigh() do { LATCbits.LATC0 = 1; } while(0)
|
|
#define IO_RC0_SetLow() do { LATCbits.LATC0 = 0; } while(0)
|
|
#define IO_RC0_Toggle() do { LATCbits.LATC0 = ~LATCbits.LATC0; } while(0)
|
|
#define IO_RC0_GetValue() PORTCbits.RC0
|
|
#define IO_RC0_SetDigitalInput() do { TRISCbits.TRISC0 = 1; } while(0)
|
|
#define IO_RC0_SetDigitalOutput() do { TRISCbits.TRISC0 = 0; } while(0)
|
|
#define IO_RC0_SetPullup() do { WPUCbits.WPUC0 = 1; } while(0)
|
|
#define IO_RC0_ResetPullup() do { WPUCbits.WPUC0 = 0; } while(0)
|
|
#define IO_RC0_SetPushPull() do { ODCONCbits.ODCC0 = 0; } while(0)
|
|
#define IO_RC0_SetOpenDrain() do { ODCONCbits.ODCC0 = 1; } while(0)
|
|
#define IO_RC0_SetAnalogMode() do { ANSELCbits.ANSC0 = 1; } while(0)
|
|
#define IO_RC0_SetDigitalMode() do { ANSELCbits.ANSC0 = 0; } while(0)
|
|
// get/set IO_RC3 aliases
|
|
#define RS_MODE_TRIS TRISCbits.TRISC3
|
|
#define RS_MODE_LAT LATCbits.LATC3
|
|
#define RS_MODE_PORT PORTCbits.RC3
|
|
#define RS_MODE_WPU WPUCbits.WPUC3
|
|
#define RS_MODE_OD ODCONCbits.ODCC3
|
|
#define RS_MODE_ANS ANSELCbits.ANSC3
|
|
#define RS_MODE_SetHigh() do { LATCbits.LATC3 = 1; } while(0)
|
|
#define RS_MODE_SetLow() do { LATCbits.LATC3 = 0; } while(0)
|
|
#define RS_MODE_Toggle() do { LATCbits.LATC3 = ~LATCbits.LATC3; } while(0)
|
|
#define RS_MODE_GetValue() PORTCbits.RC3
|
|
#define RS_MODE_SetDigitalInput() do { TRISCbits.TRISC3 = 1; } while(0)
|
|
#define RS_MODE_SetDigitalOutput() do { TRISCbits.TRISC3 = 0; } while(0)
|
|
#define RS_MODE_SetPullup() do { WPUCbits.WPUC3 = 1; } while(0)
|
|
#define RS_MODE_ResetPullup() do { WPUCbits.WPUC3 = 0; } while(0)
|
|
#define RS_MODE_SetPushPull() do { ODCONCbits.ODCC3 = 0; } while(0)
|
|
#define RS_MODE_SetOpenDrain() do { ODCONCbits.ODCC3 = 1; } while(0)
|
|
#define RS_MODE_SetAnalogMode() do { ANSELCbits.ANSC3 = 1; } while(0)
|
|
#define RS_MODE_SetDigitalMode() do { ANSELCbits.ANSC3 = 0; } while(0)
|
|
// get/set IO_RC4 aliases
|
|
#define IO_RC4_TRIS TRISCbits.TRISC4
|
|
#define IO_RC4_LAT LATCbits.LATC4
|
|
#define IO_RC4_PORT PORTCbits.RC4
|
|
#define IO_RC4_WPU WPUCbits.WPUC4
|
|
#define IO_RC4_OD ODCONCbits.ODCC4
|
|
#define IO_RC4_ANS ANSELCbits.ANSC4
|
|
#define IO_RC4_SetHigh() do { LATCbits.LATC4 = 1; } while(0)
|
|
#define IO_RC4_SetLow() do { LATCbits.LATC4 = 0; } while(0)
|
|
#define IO_RC4_Toggle() do { LATCbits.LATC4 = ~LATCbits.LATC4; } while(0)
|
|
#define IO_RC4_GetValue() PORTCbits.RC4
|
|
#define IO_RC4_SetDigitalInput() do { TRISCbits.TRISC4 = 1; } while(0)
|
|
#define IO_RC4_SetDigitalOutput() do { TRISCbits.TRISC4 = 0; } while(0)
|
|
#define IO_RC4_SetPullup() do { WPUCbits.WPUC4 = 1; } while(0)
|
|
#define IO_RC4_ResetPullup() do { WPUCbits.WPUC4 = 0; } while(0)
|
|
#define IO_RC4_SetPushPull() do { ODCONCbits.ODCC4 = 0; } while(0)
|
|
#define IO_RC4_SetOpenDrain() do { ODCONCbits.ODCC4 = 1; } while(0)
|
|
#define IO_RC4_SetAnalogMode() do { ANSELCbits.ANSC4 = 1; } while(0)
|
|
#define IO_RC4_SetDigitalMode() do { ANSELCbits.ANSC4 = 0; } while(0)
|
|
// get/set IO_RC5 aliases
|
|
#define IO_RC5_TRIS TRISCbits.TRISC5
|
|
#define IO_RC5_LAT LATCbits.LATC5
|
|
#define IO_RC5_PORT PORTCbits.RC5
|
|
#define IO_RC5_WPU WPUCbits.WPUC5
|
|
#define IO_RC5_OD ODCONCbits.ODCC5
|
|
#define IO_RC5_ANS ANSELCbits.ANSC5
|
|
#define IO_RC5_SetHigh() do { LATCbits.LATC5 = 1; } while(0)
|
|
#define IO_RC5_SetLow() do { LATCbits.LATC5 = 0; } while(0)
|
|
#define IO_RC5_Toggle() do { LATCbits.LATC5 = ~LATCbits.LATC5; } while(0)
|
|
#define IO_RC5_GetValue() PORTCbits.RC5
|
|
#define IO_RC5_SetDigitalInput() do { TRISCbits.TRISC5 = 1; } while(0)
|
|
#define IO_RC5_SetDigitalOutput() do { TRISCbits.TRISC5 = 0; } while(0)
|
|
#define IO_RC5_SetPullup() do { WPUCbits.WPUC5 = 1; } while(0)
|
|
#define IO_RC5_ResetPullup() do { WPUCbits.WPUC5 = 0; } while(0)
|
|
#define IO_RC5_SetPushPull() do { ODCONCbits.ODCC5 = 0; } while(0)
|
|
#define IO_RC5_SetOpenDrain() do { ODCONCbits.ODCC5 = 1; } while(0)
|
|
#define IO_RC5_SetAnalogMode() do { ANSELCbits.ANSC5 = 1; } while(0)
|
|
#define IO_RC5_SetDigitalMode() do { ANSELCbits.ANSC5 = 0; } while(0)
|
|
/**
|
|
* @ingroup pinsdriver
|
|
* @brief GPIO and peripheral I/O initialization
|
|
* @param none
|
|
* @return none
|
|
*/
|
|
void PIN_MANAGER_Initialize (void);
|
|
|
|
/**
|
|
* @ingroup pinsdriver
|
|
* @brief Interrupt on Change Handling routine
|
|
* @param none
|
|
* @return none
|
|
*/
|
|
void PIN_MANAGER_IOC(void);
|
|
|
|
|
|
#endif // PINS_H
|
|
/**
|
|
End of File
|
|
*/ |