-
Notifications
You must be signed in to change notification settings - Fork 5
/
phpstorm-stub.php
242 lines (212 loc) · 4.75 KB
/
phpstorm-stub.php
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<?php
/**
* Phpiwire: A PHP wrapper for wiringPi
*
* Stub file for PHPStorm to provide introspection
*
* @author Andrew Collington, [email protected]
* @version 0.2.0
* @link https://github.com/amnuts/phpiwire
* @license MIT, http://acollington.mit-license.org/
*/
namespace Phpiwire;
class Board
{
// pin numbering scheme
const WIRINGPI = 0;
const GPIO = 1;
const SYSTEM = 2;
const PHYSICAL = 3;
// pwm mode
const MARKSPACE = 0;
const BALANCED = 1;
protected $scheme;
protected $schemeName = [];
protected $board = [];
/**
* @param int $scheme
*/
public function __construct($scheme = self::WIRINGPI) {}
/**
* String representation of the board
*
* @return string
*/
public function __toString() {}
/**
* Set up the board pin configuration
*
* @param int
*/
public function mode($scheme) {}
/**
* Get version information about the board
*
* @return array
*/
public function version() {}
/**
* Get the pin numbering scheme
*
* @return array
*/
public function getPinScheme() {}
/**
* Instantiate a Pin class
*
* @param int $pin The pin number to use
* @return Pin
*/
public function getPin($pin) {}
/**
* Set the mode for the PWM generator.
*
* @param int
*/
public function pwmMode($mode) {}
/**
* Set the range for the PWM generator.
*
* @param int
*/
public function pwmRange($range = 1024) {}
/**
* Set the divisor for the PWM clock.
*
* @param int
*/
public function pwmClock($divisor) {}
}
class Pin
{
// read/write types
const DIGITAL = 0;
const ANALOG = 1;
const PWM = 2;
const SOFT_PWM = 3;
// pin modes
const INPUT = 0;
const OUTPUT = 1;
const PWM_OUT = 2;
const CLOCK = 3;
const SOFT_PWM_OUT = 4;
// pud modes
const OFF = 0;
const DOWN = 1;
const UP = 2;
// values
const LOW = 0;
const HIGH = 1;
protected $mode = null;
protected $modeName = [];
/**
* Initialize the Pin class
* @param $pin
* @param \Phpiwire\Board $board
*/
public function __construct($pin, Board $board) {}
/**
* String representation of the pin
*
* @return string
*/
public function __toString() {}
/**
* Get the id of the pin
*
* @return int
*/
public function getId() {}
/**
* Get the board object
*
* @return Board
*/
public function getBoard() {}
/**
* Set pin mode
*
* @param int
* @return $this
*/
public function mode($mode) {}
/**
* Get the pin mode
*
* @param bool $asString Return the value as a string
*/
public function is($asString = false) {}
/**
* Sets the pull-up or pull-down resistor mode on the pin.
*
* The mode can either be OFF, (no pull up/down), DOWN (pull to ground)
* or UP (pull to 3.3v). The internal pull up/down resistors have a value
* of approximately 50KΩ on the Raspberry Pi.
*
* @param int
* @return $this
*/
public function pudMode($mode) {}
/**
* Read the value from the pin
*
* @param int $type Read as digital or analog
* @return int
*/
public function read($type = self::DIGITAL) {}
/**
* Get digital pin value
*
* @return int
*/
public function digitalRead() {}
/**
* Get analog pin value
*
* @return int
*/
public function analogRead() {}
/**
* Write a value to the pin.
*
* With DIGITAL, value is either high (1) or low (0). Any non-zero value
* is considered high, but only 0 is considered low.
*
* With PWM, the Raspberry Pi has one on-board PWM pin - pin 1, 18 or 12
* depending on whether you're using the wiringpi numbering scheme, or
* GPIO, or physical (respectively). Not available in system mode.
*
* @param int $value
* @param int $type Write digital or analog pin
* @return $this
*/
public function write($value, $type = self::DIGITAL) {}
/**
* Set digital pin value
*
* @param $value
* @return $this
*/
public function digitalWrite($value) {}
/**
* Set analog pin value
*
* @param $value
* @return $this
*/
public function analogWrite($value) {}
/**
* Set PWM pin value
*
* @param $value
* @return $this
*/
public function pwmWrite($value) {}
/**
* Set PWM pin value
*
* @param $value
* @return $this
*/
public function softPwmWrite($value) {}
}