-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgpio.c
More file actions
72 lines (57 loc) · 951 Bytes
/
gpio.c
File metadata and controls
72 lines (57 loc) · 951 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
63
64
65
66
67
68
69
70
71
72
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include "gpio.h"
int fd_gpio;
int fd_adc;
void init_gpio(void)
{
fd_gpio = open("/dev/edas_gpio", O_RDWR);
if (fd_gpio < 0) {
perror("open /dev/imx283_gpio");
}
//edas_led_usbon();
}
void init_adc(void)
{
fd_adc = open("/dev/magic-adc", 0);
if (fd_adc < 0) {
close(fd_adc);
}
}
int is_T15_on(void) //t15 on:iRes =2413
{
int iRes;
static int t15cnt = 0;
ioctl(fd_adc, 20, &iRes);
if(t15cnt < 10) t15cnt++;
if(iRes > 1200)
iRes = 1;
else
{
if(t15cnt < 8)
{
iRes = 1;
}
else
iRes = 0;
}
return iRes;
}
void start3G(void)
{
//edas_3g_off();
sleep(1);
edas_3g_work();
sleep(1);
edas_3g_start();
sleep(1);
edas_3g_restarthi();
sleep(1);
edas_3g_restartlo();
sleep(1);
}