forked from WiringPi/WiringPi-PHP
/
wiringpi.php
117 lines (90 loc) · 2.48 KB
/
wiringpi.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
<?php
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.7
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
// Try to load our extension if it's not already loaded.
if (!extension_loaded('wiringpi')) {
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
if (!dl('php_wiringpi.dll')) return;
} else {
// PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
if (PHP_SHLIB_SUFFIX === 'dylib') {
if (!dl('wiringpi.so')) return;
} else {
if (!dl('wiringpi.'.PHP_SHLIB_SUFFIX)) return;
}
}
}
abstract class wiringpi {
static function wiringPiSetup() {
return wiringPiSetup();
}
static function wiringPiSetupSys() {
return wiringPiSetupSys();
}
static function wiringPiSetupGpio() {
return wiringPiSetupGpio();
}
static function pullUpDnControl($pin,$pud) {
pullUpDnControl($pin,$pud);
}
static function pinMode($pin,$mode) {
pinMode($pin,$mode);
}
static function digitalWrite($pin,$value) {
digitalWrite($pin,$value);
}
static function digitalWriteByte($value) {
digitalWriteByte($value);
}
static function pwmWrite($pin,$value) {
pwmWrite($pin,$value);
}
static function digitalRead($pin) {
return digitalRead($pin);
}
static function shiftOut($dPin,$cPin,$order,$val) {
shiftOut($dPin,$cPin,$order,$val);
}
static function shiftIn($dPin,$cPin,$order) {
return shiftIn($dPin,$cPin,$order);
}
static function delay($howLong) {
delay($howLong);
}
static function delayMicroseconds($howLong) {
delayMicroseconds($howLong);
}
static function millis() {
return millis();
}
static function serialOpen($device,$baud) {
return serialOpen($device,$baud);
}
static function serialClose($fd) {
serialClose($fd);
}
static function serialPutchar($fd,$c_) {
serialPutchar($fd,$c_);
}
static function serialPuts($fd,$s) {
serialPuts($fd,$s);
}
static function serialDataAvail($fd) {
return serialDataAvail($fd);
}
static function serialGetchar($fd) {
return serialGetchar($fd);
}
static function serialPrintf($fd,$message) {
serialPrintf($fd,$message);
}
}
/* PHP Proxy Classes */
?>