This repository has been archived by the owner on Apr 19, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphpspi.stub.php
167 lines (141 loc) · 2.64 KB
/
phpspi.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
<?php
/** @generate-function-entries */
namespace SPI;
final class Bus {
/**
* @param int $busId SPI bus id
* @param int $chipSelect
* @param int $mode SPI mode (SPI_MODE_0..3)
* @param int $bits Number of bits per word
* @param int $speed Bus speed in Hz
* @param int $delay Delay between sending each bit
*
* @return void
*/
public function __construct(
int $busId,
int $chipSelect,
int $mode = SPI\MODE_0,
int $bits = 8,
int $speed = 1000000,
int $delay = 0
) {}
/**
* @param int[] $bytes
*
* @return void
*/
public function write(int ...$bytes): void {}
/**
* @param int $numBytes Number of bytes to read from bus
*
* @return int[]
*/
public function read(int $numBytes): array {}
/**
* Write $bytes to device and read back the same amount of bytes from it.
*
* @param int[] $bytes
*
* @return int[]
*/
public function transfer(int ...$bytes): array {}
/**
* @return int
*/
public function getBusId(): int {}
/**
* @return int
*/
public function getChipSelect(): int {}
/**
* @return int
*/
public function getMode(): int {}
/**
* @return int
*/
public function getBitsPerWord(): int {}
/**
* @return int
*/
public function getSpeed(): int {}
/**
* @return int
*/
public function getDelay(): int {}
/**
* @return bool
*/
public function isChipSelectHigh(): bool {}
/**
* @param bool $enabled
*
* @return void
*/
public function setChipSelectHigh(bool $enabled): void {}
/**
* @return bool
*/
public function isLsbFirst(): bool {}
/**
* @param bool $enabled
*
* @return void
*/
public function setLsbFirst(bool $enabled): void {}
/**
* Return if SI/SO signals are shared.
*
* @return bool
*/
public function is3Wire(): bool {}
/**
* @param bool $enabled
*
* @return void
*/
public function set3Wire(bool $enabled): void {}
/**
* Return if is a loopback configuration.
*
* @return bool
*/
public function isLoop(): bool {}
/**
* @param bool $enabled
*
* @return void
*/
public function setLoop(bool $enabled): void {}
/**
* @return bool
*/
public function isChipSelectDisabled(): bool {}
/**
* @param bool $enabled
*
* @return void
*/
public function setChipSelectDisabled(bool $enabled): void {}
}
/**
* Clock phase.
*
* @var int
*/
const CPHA = 0x01;
/**
* Clock polarity.
*
* @var int
*/
const CPOL = 0x02;
const MODE_0 = 0x00;
const MODE_1 = 0x01;
const MODE_2 = 0x02;
const MODE_3 = 0x03;
/**
* Base exception
*/
class Exception extends \Exception {}