-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
65 lines (56 loc) · 855 Bytes
/
types.go
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
package gopio
// main data types and variables are declared here //
/*
Types And Variables :
Types : Pin, DIR, VALUE
Variables : OUT, IN, HIGH, LOW, PIN_NUMS, basedir
*/
// the object that defines a pin
type Pin struct {
Num int
Dir DIR
}
type WiringPiPin struct {
Num int
Dir DIR
}
type DIR string
type VALUE string
const (
OUT DIR = "out" //
IN DIR = "in" // directions
HIGH VALUE = "1" //
LOW VALUE = "0" // output values
basedir = "/sys/class/gpio/" // base directory of gpio controller files
)
// physical pin numbering map(general purpose IO only)
var PIN_NUMS = map[int]int{
3: 2,
5: 3,
7: 4,
8: 14,
10: 15,
11: 17,
12: 18,
13: 27,
15: 22,
16: 23,
18: 24,
19: 10,
21: 9,
22: 25,
23: 11,
24: 8,
26: 7,
27: 0,
28: 1,
29: 5,
31: 6,
32: 12,
33: 13,
35: 19,
36: 16,
37: 26,
38: 20,
40: 21,
}