-
Notifications
You must be signed in to change notification settings - Fork 0
/
pin_manager.h
140 lines (115 loc) · 4.9 KB
/
pin_manager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/**
@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.8
Device : PIC18F46K20
Driver Version : 2.11
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above
MPLAB : MPLAB X 6.00
*/
/*
(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 RC3 procedures
#define RC3_SetHigh() do { LATCbits.LATC3 = 1; } while(0)
#define RC3_SetLow() do { LATCbits.LATC3 = 0; } while(0)
#define RC3_Toggle() do { LATCbits.LATC3 = ~LATCbits.LATC3; } while(0)
#define RC3_GetValue() PORTCbits.RC3
#define RC3_SetDigitalInput() do { TRISCbits.TRISC3 = 1; } while(0)
#define RC3_SetDigitalOutput() do { TRISCbits.TRISC3 = 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)
// get/set RC6 procedures
#define RC6_SetHigh() do { LATCbits.LATC6 = 1; } while(0)
#define RC6_SetLow() do { LATCbits.LATC6 = 0; } while(0)
#define RC6_Toggle() do { LATCbits.LATC6 = ~LATCbits.LATC6; } while(0)
#define RC6_GetValue() PORTCbits.RC6
#define RC6_SetDigitalInput() do { TRISCbits.TRISC6 = 1; } while(0)
#define RC6_SetDigitalOutput() do { TRISCbits.TRISC6 = 0; } while(0)
// get/set RC7 procedures
#define RC7_SetHigh() do { LATCbits.LATC7 = 1; } while(0)
#define RC7_SetLow() do { LATCbits.LATC7 = 0; } while(0)
#define RC7_Toggle() do { LATCbits.LATC7 = ~LATCbits.LATC7; } while(0)
#define RC7_GetValue() PORTCbits.RC7
#define RC7_SetDigitalInput() do { TRISCbits.TRISC7 = 1; } while(0)
#define RC7_SetDigitalOutput() do { TRISCbits.TRISC7 = 0; } while(0)
// get/set IO_RD0 aliases
#define IO_RD0_TRIS TRISDbits.TRISD0
#define IO_RD0_LAT LATDbits.LATD0
#define IO_RD0_PORT PORTDbits.RD0
#define IO_RD0_SetHigh() do { LATDbits.LATD0 = 1; } while(0)
#define IO_RD0_SetLow() do { LATDbits.LATD0 = 0; } while(0)
#define IO_RD0_Toggle() do { LATDbits.LATD0 = ~LATDbits.LATD0; } while(0)
#define IO_RD0_GetValue() PORTDbits.RD0
#define IO_RD0_SetDigitalInput() do { TRISDbits.TRISD0 = 1; } while(0)
#define IO_RD0_SetDigitalOutput() do { TRISDbits.TRISD0 = 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);
#endif // PIN_MANAGER_H
/**
End of File
*/