forked from wtlyu/GPArrayController
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport.cpp
More file actions
54 lines (40 loc) · 1.23 KB
/
Copy pathexport.cpp
File metadata and controls
54 lines (40 loc) · 1.23 KB
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
// exampleApp.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <time.h>
#include <sys/time.h>
#include <iostream>
#include <string>
#include <unistd.h>
#include "jetsonGPIO.h"
using namespace std;
int getkey() {
int character;
struct termios orig_term_attr;
struct termios new_term_attr;
/* set the terminal to raw mode */
tcgetattr(fileno(stdin), &orig_term_attr);
memcpy(&new_term_attr, &orig_term_attr, sizeof(struct termios));
new_term_attr.c_lflag &= ~(ECHO|ICANON);
new_term_attr.c_cc[VTIME] = 0;
new_term_attr.c_cc[VMIN] = 0;
tcsetattr(fileno(stdin), TCSANOW, &new_term_attr);
/* read a character from the stdin stream without blocking */
/* returns EOF (-1) if no character is available */
character = fgetc(stdin);
/* restore the original terminal attributes */
tcsetattr(fileno(stdin), TCSANOW, &orig_term_attr);
return character;
}
int main(int argc, char *argv[]){
cout << "Export the GPIO Pins" << endl;
jetsonTX1GPIONumber IO1 = gpio37 ;
jetsonTX1GPIONumber IO2 = gpio36 ;
gpioExport(IO2) ;
gpioExport(IO1) ;
gpioSetDirection(IO1,outputPin) ;
gpioSetDirection(IO2,outputPin) ;
return 0;
}