-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_GPIO.c
More file actions
62 lines (39 loc) · 814 Bytes
/
test_GPIO.c
File metadata and controls
62 lines (39 loc) · 814 Bytes
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
#include "LPC1114.h"
#include "GPIO.h"
#define GPIO1_5 5
void main() {
// Initialize GPIO Block
GPIO_init();
// GPIO1_ISENSE defaults to Edge Sensitive trigger
// GPIO1_IEDGES defaults to GPIO1_IEVENT control
// Enable Rising Edge trigger
GPIO1_IEVENT = (1 << GPIO1_5);
// Enable GPIO Interrupt
GPIO1_IENABLE = (1 << GPIO1_5);
// Enable GPIO1 Interrupt in NVIC
NVIC_SETENA = (1 << NVIC_GPIO1_BIT);
// Loop
while(1);
}
void GPIO1_Handler(void) {
//GPIO1_IMASKSTAT
// Clear GPIO Edge Intrrupt signal
GPIO1_ICLR = (1 << GPIO1_5);
// Toggle LED
GPIO1DATA ^= (1 << PIO1_9);
}
/*
GPIO1_ISENSE
GPIO1_IEDGES
GPIO1_IEVENT
GPIO1_IENABLE
GPIO1_IRAWSTAT
GPIO1_IMASKSTAT
GPIO1_ICLR
void GPIO0_Handler(void) {
}
void GPIO2_Handler(void) {
}
void GPIO3_Handler(void) {
}
*/