-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Chip.php
122 lines (110 loc) · 2.1 KB
/
Chip.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
<?php
namespace GPIO;
/**
* Represents a GPIO chip.
*/
final class Chip {
/**
* Path to the GPIO chip device.
*
* @var string
*/
private string $path;
/**
* The GPIO chip label.
*
* @var string
*/
private string $label;
/**
* The GPIO chip name.
*
* @var string
*/
private string $name;
/**
* The number of available GPIO pins.
*
* @var int
*/
private int $pinCount;
/**
* Use any uAPI GPIO ABI version available.
*
* @var int
*/
public const ABI_ANY = 0x00;
/**
* Use uAPI GPIO ABI v1 (deprecated).
*
* @var int
*/
public const ABI_V1 = 0x01;
/**
* Use uAPI GPIO ABI v2.
*
* @var int
*/
public const ABI_V2 = 0x02;
/**
* Opens the chip.
*
* @param string $path Path to the GPIO chip device.
* @param int $abiVersion Which version of the Userspace ABI for GPIO to use.
*
* @return void
*/
public function __construct(string $path, int $abiVersion = self::ABI_ANY) {}
/**
* Return if ABI v2 is being used.
*
* @return bool
*/
public function isAbiV2(): bool {}
/**
* Get all pins exposed by this chip.
*
* @return \GPIO\Pins
*/
public function getAllPins(): Pins {}
/**
* Get the pin exposed by this chip at given offset.
*
* @param int $offset Offset of the pin.
*
* @return \GPIO\Pin
*/
public function getPin(int $offset): Pin {}
/**
* Get a set of pins exposed by this chip at given offsets.
*
* @param int[] $offsets List of pin offsets.
*
* @return \GPIO\Pins
*/
public function getPins(array $offsets): Pins {}
/**
* Return the number of available pins.
*
* @return int
*/
public function getPinCount(): int {}
/**
* Return the path to the GPIO chip device.
*
* @return string
*/
public function getPath(): string {}
/**
* Return the label of the chip held by this object.
*
* @return string
*/
public function getLabel(): string {}
/**
* Return the name of the chip held by this object.
*
* @return string
*/
public function getName(): string {}
}