Solar panel
Loading...
Searching...
No Matches
pin_manager.h
Go to the documentation of this file.
1
26/*
27 (c) 2018 Microchip Technology Inc. and its subsidiaries.
28
29 Subject to your compliance with these terms, you may use Microchip software and any
30 derivatives exclusively with Microchip products. It is your responsibility to comply with third party
31 license terms applicable to your use of third party software (including open source software) that
32 may accompany Microchip software.
33
34 THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
35 EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
36 IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
37 FOR A PARTICULAR PURPOSE.
38
39 IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
40 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
41 WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
42 HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
43 THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
44 CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
45 OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
46 SOFTWARE.
47*/
48
49#ifndef PIN_MANAGER_H
50#define PIN_MANAGER_H
51
56#include <xc.h>
57
58#define INPUT 1
59#define OUTPUT 0
60
61#define HIGH 1
62#define LOW 0
63
64#define ANALOG 1
65#define DIGITAL 0
66
67#define PULL_UP_ENABLED 1
68#define PULL_UP_DISABLED 0
69
70// get/set RC2 procedures
71#define RC2_SetHigh() do { LATCbits.LATC2 = 1; } while(0)
72#define RC2_SetLow() do { LATCbits.LATC2 = 0; } while(0)
73#define RC2_Toggle() do { LATCbits.LATC2 = ~LATCbits.LATC2; } while(0)
74#define RC2_GetValue() PORTCbits.RC2
75#define RC2_SetDigitalInput() do { TRISCbits.TRISC2 = 1; } while(0)
76#define RC2_SetDigitalOutput() do { TRISCbits.TRISC2 = 0; } while(0)
77
78// get/set RC6 procedures
79#define RC6_SetHigh() do { LATCbits.LATC6 = 1; } while(0)
80#define RC6_SetLow() do { LATCbits.LATC6 = 0; } while(0)
81#define RC6_Toggle() do { LATCbits.LATC6 = ~LATCbits.LATC6; } while(0)
82#define RC6_GetValue() PORTCbits.RC6
83#define RC6_SetDigitalInput() do { TRISCbits.TRISC6 = 1; } while(0)
84#define RC6_SetDigitalOutput() do { TRISCbits.TRISC6 = 0; } while(0)
85
86// get/set voltage aliases
87#define voltage_TRIS TRISFbits.TRISF0
88#define voltage_LAT LATFbits.LATF0
89#define voltage_PORT PORTFbits.RF0
90#define voltage_ANS anselRF0bits.anselRF0
91#define voltage_SetHigh() do { LATFbits.LATF0 = 1; } while(0)
92#define voltage_SetLow() do { LATFbits.LATF0 = 0; } while(0)
93#define voltage_Toggle() do { LATFbits.LATF0 = ~LATFbits.LATF0; } while(0)
94#define voltage_GetValue() PORTFbits.RF0
95#define voltage_SetDigitalInput() do { TRISFbits.TRISF0 = 1; } while(0)
96#define voltage_SetDigitalOutput() do { TRISFbits.TRISF0 = 0; } while(0)
97#define voltage_SetAnalogMode() do { anselRF0bits.anselRF0 = 1; } while(0)
98#define voltage_SetDigitalMode() do { anselRF0bits.anselRF0 = 0; } while(0)
99
100// get/set current aliases
101#define current_TRIS TRISFbits.TRISF1
102#define current_LAT LATFbits.LATF1
103#define current_PORT PORTFbits.RF1
104#define current_ANS anselRF1bits.anselRF1
105#define current_SetHigh() do { LATFbits.LATF1 = 1; } while(0)
106#define current_SetLow() do { LATFbits.LATF1 = 0; } while(0)
107#define current_Toggle() do { LATFbits.LATF1 = ~LATFbits.LATF1; } while(0)
108#define current_GetValue() PORTFbits.RF1
109#define current_SetDigitalInput() do { TRISFbits.TRISF1 = 1; } while(0)
110#define current_SetDigitalOutput() do { TRISFbits.TRISF1 = 0; } while(0)
111#define current_SetAnalogMode() do { anselRF1bits.anselRF1 = 1; } while(0)
112#define current_SetDigitalMode() do { anselRF1bits.anselRF1 = 0; } while(0)
113
114
125void PIN_MANAGER_Initialize (void);
126
137void PIN_MANAGER_IOC(void);
138
139
140
141#endif // PIN_MANAGER_H
void PIN_MANAGER_Initialize(void)
Definition: pin_manager.c:50
void PIN_MANAGER_IOC(void)
Definition: pin_manager.c:90