line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RPi::Const; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
521776
|
use strict; |
|
9
|
|
|
|
|
86
|
|
|
9
|
|
|
|
|
228
|
|
4
|
9
|
|
|
9
|
|
40
|
use warnings; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
376
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
9
|
|
|
9
|
|
46
|
use base qw( Exporter ); |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
1490
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = (); |
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => \@EXPORT_OK ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use constant { |
14
|
9
|
|
|
|
|
1428
|
PWM_MODE_MS => 0, |
15
|
|
|
|
|
|
|
PWM_MODE_BAL => 1, |
16
|
9
|
|
|
9
|
|
64
|
}; |
|
9
|
|
|
|
|
22
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
{ # PWM modes |
19
|
|
|
|
|
|
|
my @const = qw( |
20
|
|
|
|
|
|
|
PWM_MODE_MS |
21
|
|
|
|
|
|
|
PWM_MODE_BAL |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
25
|
|
|
|
|
|
|
$EXPORT_TAGS{pwm_mode} = \@const; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use constant { |
29
|
9
|
|
|
|
|
930
|
PWM_DEFAULT_MODE => 1, # balanced |
30
|
|
|
|
|
|
|
PWM_DEFAULT_CLOCK => 32, |
31
|
|
|
|
|
|
|
PWM_DEFAULT_RANGE => 1023, |
32
|
9
|
|
|
9
|
|
72
|
}; |
|
9
|
|
|
|
|
15
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
{ # PWM defaults |
35
|
|
|
|
|
|
|
my @const = qw( |
36
|
|
|
|
|
|
|
PWM_DEFAULT_MODE |
37
|
|
|
|
|
|
|
PWM_DEFAULT_CLOCK |
38
|
|
|
|
|
|
|
PWM_DEFAULT_RANGE |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
42
|
|
|
|
|
|
|
$EXPORT_TAGS{pwm_defaults} = \@const; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use constant { |
46
|
9
|
|
|
|
|
1375
|
INPUT => 0, |
47
|
|
|
|
|
|
|
OUTPUT => 1, |
48
|
|
|
|
|
|
|
PWM_OUT => 2, |
49
|
|
|
|
|
|
|
GPIO_CLOCK => 3, |
50
|
|
|
|
|
|
|
SOFT_PWM_OUTPUT => 4, |
51
|
|
|
|
|
|
|
SOFT_TONE_OUTPUT => 5, |
52
|
|
|
|
|
|
|
PWM_TONE_OUTPUT => 6, |
53
|
9
|
|
|
9
|
|
51
|
}; |
|
9
|
|
|
|
|
15
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
{ # pinmodes |
56
|
|
|
|
|
|
|
my @const = qw( |
57
|
|
|
|
|
|
|
INPUT |
58
|
|
|
|
|
|
|
OUTPUT |
59
|
|
|
|
|
|
|
PWM_OUT |
60
|
|
|
|
|
|
|
GPIO_CLOCK |
61
|
|
|
|
|
|
|
SOFT_PWM_OUTPUT |
62
|
|
|
|
|
|
|
SOFT_TONE_OUTPUT |
63
|
|
|
|
|
|
|
PWM_TONE_OUTPUT |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
67
|
|
|
|
|
|
|
$EXPORT_TAGS{pinmode} = \@const; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use constant { |
71
|
9
|
|
|
|
|
978
|
ALT0 => 4, |
72
|
|
|
|
|
|
|
ALT1 => 5, |
73
|
|
|
|
|
|
|
ALT2 => 6, |
74
|
|
|
|
|
|
|
ALT3 => 7, |
75
|
|
|
|
|
|
|
ALT4 => 3, |
76
|
|
|
|
|
|
|
ALT5 => 2, |
77
|
9
|
|
|
9
|
|
61
|
}; |
|
9
|
|
|
|
|
14
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
{ # alt modes |
80
|
|
|
|
|
|
|
my @const = qw( |
81
|
|
|
|
|
|
|
ALT0 |
82
|
|
|
|
|
|
|
ALT1 |
83
|
|
|
|
|
|
|
ALT2 |
84
|
|
|
|
|
|
|
ALT3 |
85
|
|
|
|
|
|
|
ALT4 |
86
|
|
|
|
|
|
|
ALT5 |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
90
|
|
|
|
|
|
|
$EXPORT_TAGS{altmode} = \@const; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
use constant { |
94
|
9
|
|
|
|
|
914
|
PUD_OFF => 0, |
95
|
|
|
|
|
|
|
PUD_DOWN => 1, |
96
|
|
|
|
|
|
|
PUD_UP => 2, |
97
|
9
|
|
|
9
|
|
50
|
}; |
|
9
|
|
|
|
|
21
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
{ # pull |
100
|
|
|
|
|
|
|
my @const = qw( |
101
|
|
|
|
|
|
|
PUD_UP |
102
|
|
|
|
|
|
|
PUD_DOWN |
103
|
|
|
|
|
|
|
PUD_OFF |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
107
|
|
|
|
|
|
|
$EXPORT_TAGS{pull} = \@const; |
108
|
|
|
|
|
|
|
}; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
use constant { |
111
|
9
|
|
|
|
|
1098
|
HIGH => 1, |
112
|
|
|
|
|
|
|
LOW => 0, |
113
|
|
|
|
|
|
|
ON => 1, |
114
|
|
|
|
|
|
|
OFF => 0, |
115
|
9
|
|
|
9
|
|
50
|
}; |
|
9
|
|
|
|
|
19
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
{ # state |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my @const = qw( |
120
|
|
|
|
|
|
|
HIGH |
121
|
|
|
|
|
|
|
LOW |
122
|
|
|
|
|
|
|
ON |
123
|
|
|
|
|
|
|
OFF |
124
|
|
|
|
|
|
|
); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
127
|
|
|
|
|
|
|
$EXPORT_TAGS{state} = \@const; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
use constant { |
131
|
9
|
|
|
|
|
1021
|
EDGE_SETUP => 0, |
132
|
|
|
|
|
|
|
EDGE_FALLING => 1, |
133
|
|
|
|
|
|
|
EDGE_RISING => 2, |
134
|
|
|
|
|
|
|
EDGE_BOTH => 3, |
135
|
9
|
|
|
9
|
|
54
|
}; |
|
9
|
|
|
|
|
15
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
{ # interrupt |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my @const = qw( |
140
|
|
|
|
|
|
|
EDGE_SETUP |
141
|
|
|
|
|
|
|
EDGE_FALLING |
142
|
|
|
|
|
|
|
EDGE_RISING |
143
|
|
|
|
|
|
|
EDGE_BOTH |
144
|
|
|
|
|
|
|
); |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
147
|
|
|
|
|
|
|
$EXPORT_TAGS{edge} = \@const; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
use constant { |
151
|
9
|
|
|
|
|
1286
|
RPI_MODE_WPI => 0, |
152
|
|
|
|
|
|
|
RPI_MODE_GPIO => 1, |
153
|
|
|
|
|
|
|
RPI_MODE_GPIO_SYS => 2, |
154
|
|
|
|
|
|
|
RPI_MODE_PHYS => 3, |
155
|
|
|
|
|
|
|
RPI_MODE_UNINIT => -1, |
156
|
9
|
|
|
9
|
|
51
|
}; |
|
9
|
|
|
|
|
22
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
{ # mode |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
my @const = qw( |
161
|
|
|
|
|
|
|
RPI_MODE_WPI |
162
|
|
|
|
|
|
|
RPI_MODE_GPIO |
163
|
|
|
|
|
|
|
RPI_MODE_GPIO_SYS |
164
|
|
|
|
|
|
|
RPI_MODE_PHYS |
165
|
|
|
|
|
|
|
RPI_MODE_UNINIT |
166
|
|
|
|
|
|
|
); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
push @EXPORT_OK, @const; |
169
|
|
|
|
|
|
|
$EXPORT_TAGS{mode} = \@const; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
0
|
|
|
0
|
|
|
sub _vim{1;}; |
173
|
|
|
|
|
|
|
1; |
174
|
|
|
|
|
|
|
__END__ |