-
Notifications
You must be signed in to change notification settings - Fork 1
/
GPIO.h
102 lines (85 loc) · 1.87 KB
/
GPIO.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
/*
* GPIO.h
*
* This library is destined to manipule the GPIO ports on Tiva C-Series TM4C123G
*
* Created on: 29 de abr de 2018
* Author: igorgcustodio
*/
#ifndef GPIO_H_
#define GPIO_H_
#define PORT_A 0b00000001
#define PORT_B 0b00000010
#define PORT_C 0b00000100
#define PORT_D 0b00001000
#define PORT_E 0b00010000
#define PORT_F 0b00100000
#define P0 0b00000001
#define P1 0b00000010
#define P2 0b00000100
#define P3 0b00001000
#define P4 0b00010000
#define P5 0b00100000
#define P6 0b01000000
#define P7 0b10000000
#define USR_SW_1 P4 // PORTF
#define USR_SW_2 P0 // PORTF
#define LED_RED P1 // PORTF
#define LED_BLUE P2 // PORTF
#define LED_GREEN P3 // PORTF
#define INPUT 0
#define OUTPUT 1
#define HIGH 1
#define LOW 0
#define TRUE 1
#define FALSE 0
void interruptPortA(void);
void interruptPortB(void);
void interruptPortC(void);
void interruptPortD(void);
void interruptPortE(void);
void interruptPortF(void);
/**
* Enables or disables the port
*/
void enablePort(uint32_t port);
/**
* Setup the pin
*
* @param port the port to be set
* @param pin the pin in the port to be set
* @param direction the pin direction
*
*/
void setPin(uint32_t port, uint32_t pin, int direction);
/**
* Read the pin value
*
* @param port the port
* @param pin the pin in the port
*
*/
int readPin(uint32_t port, uint32_t pin);
/**
* Write a digital value to pin
*
* @param port the port
* @param pin the pin of the port
* @param value the digital value
*
*/
void writePin(uint32_t port, uint32_t pin, int value);
/**
* Setup the pin
*
* @param port the port
* @param pin the pin in the port
*
*/
int readPinDirection(uint32_t port, uint32_t pin);
/**
* Enables the interruption on your uC
*
*/
void enableInterruption(uint32_t port, uint32_t pin, int state, int sensibility, int event, int bothBorder);
#endif /* GPIO_H_ */