You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/drivers/MCP230XX/MCP230XX.md
+31-34Lines changed: 31 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The [MCP23008](http://www.microchip.com/wwwproducts/en/MCP23008) device provides
8
8
9
9
The [MCP23017](http://www.microchip.com/wwwproducts/en/MCP23017) device provides 16-bit, general purpose, parallel I/O expansion for I2C bus applications. (Description from MCP23017 product page)
10
10
11
-
## Module "MCP230XX"
11
+
###Module "MCP230XX"
12
12
13
13
The driver module "MCP230XX" exports the following:
14
14
@@ -19,7 +19,7 @@ export {
19
19
};
20
20
```
21
21
22
-
## MCP23008 Class
22
+
###MCP23008 Class
23
23
24
24
The `MCP23008` class produces instances that represent a single MCP23008 IC on the I2C bus. The `MCP23008` class extends an internal `Expander` class, which extends the `SMBus` class. `Expander` is not exported.
25
25
@@ -46,9 +46,9 @@ export default function() {
46
46
47
47

48
48
49
-
### Constructor Description
49
+
####Constructor Description
50
50
51
-
#### `MCP23008([dictionary])`
51
+
#####`MCP23008([dictionary])`
52
52
53
53
| Argument | Type | Description |
54
54
| --- | --- | :--- |
@@ -60,7 +60,7 @@ let leds = new MCP23008({ sda: 4, scl: 5 });
60
60
```
61
61
62
62
<aid="MCP23008-dictionary"></a>
63
-
### Dictionary
63
+
####Dictionary
64
64
65
65
| Parameter | Type | Default Value | Description
66
66
| --- | --- | --- | :--- |
@@ -71,7 +71,7 @@ let leds = new MCP23008({ sda: 4, scl: 5 });
71
71
|`inputs`|`number` (byte) |`0b11111111`| A byte representing the input/output initialization state of the 8 GPIO pins. `1` for input, `0` for output |
72
72
|`pullups`|`number` (byte) |`0b00000000`| A byte representing the pullup initialization state of the 8 GPIO pins. `1` for pullup, `0` for default |
73
73
74
-
### Properties
74
+
####Properties
75
75
76
76
All properties are read-only.
77
77
@@ -84,9 +84,9 @@ All properties are read-only.
84
84
|`GPPU`|`number`|`0x09`|`GPPU` register |
85
85
| 0-8 |`pin`||`Pin` instances (see the section [Pin Class](#pin-class)) |
86
86
87
-
### Methods
87
+
####Methods
88
88
89
-
#### `bankWrite(byte)`
89
+
#####`bankWrite(byte)`
90
90
91
91
Temporarily sets the mode of all pins to output and writes all pins at once.
92
92
@@ -95,7 +95,7 @@ let expander = new MCP23008(); // defaults to 0x20!
95
95
expander.bankWrite(0b11111111); // Set all pins to 1
96
96
```
97
97
98
-
#### `bankRead()`
98
+
#####`bankRead()`
99
99
100
100
Temporarily sets the mode of all pins to input, reads all pins at once, and returns their values.
The `MCP23017` class produces instances that represent a single MCP23017 IC on the I2C bus. The `MCP23017` class extends an internal `Expander` class, which extends the `SMBus` class.
111
111
@@ -132,9 +132,9 @@ export default function() {
132
132
133
133

134
134
135
-
### Constructor Description
135
+
####Constructor Description
136
136
137
-
#### `MCP23017([dictionary])`
137
+
#####`MCP23017([dictionary])`
138
138
139
139
| Argument | Type | Description |
140
140
| --- | --- | :--- |
@@ -146,7 +146,7 @@ let leds = new MCP23017({ sda: 4, scl: 5 });
146
146
```
147
147
148
148
<aid="MCP23017-dictionary"></a>
149
-
### Dictionary
149
+
####Dictionary
150
150
151
151
| Parameter | Type | Default Value | Description
152
152
| --- | --- | --- | :--- |
@@ -157,7 +157,7 @@ let leds = new MCP23017({ sda: 4, scl: 5 });
157
157
|`inputs`|`number` (word) |`0b1111111111111111`| A word representing the input/output initialization state of the 16 GPIO pins. `1` for input, `0` for output |
158
158
|`pullups`|`number` (word) |`0b0000000000000000`| A word representing the pullup initialization state of the 16 GPIO pins. `1` for pullup, `0` for default |
159
159
160
-
### Properties
160
+
####Properties
161
161
162
162
All properties are read-only.
163
163
@@ -171,9 +171,9 @@ All properties are read-only.
171
171
| 0-16 |`pin`||`Pin` instances (see the section [Pin Class](#pin-class)) |
172
172
173
173
174
-
### Methods
174
+
####Methods
175
175
176
-
#### `bankWrite(word)`
176
+
#####`bankWrite(word)`
177
177
178
178
Temporarily sets the mode of all pins to output and writes all pins at once.
179
179
@@ -182,7 +182,7 @@ let expander = new MCP23017(); // defaults to 0x20!
182
182
expander.bankWrite(0b1111111111111111); // Set all pins to 1
183
183
```
184
184
185
-
#### `bankRead()`
185
+
#####`bankRead()`
186
186
187
187
Temporarily sets the mode of all pins to input, reads all pins at once, and returns their values.
188
188
@@ -191,7 +191,7 @@ let expander = new MCP23017(); // defaults to 0x20!
191
191
trace(`${expander.bankRead()}\n`);
192
192
```
193
193
194
-
## Pin Class
194
+
###Pin Class
195
195
196
196
The `Pin` class represents a single pin within a `MCP23008` or `MCP23017` instance object. The class is not exported; `Pin` instances are automatically created by `MCP23008` and `MCP23017` instances.
197
197
@@ -218,54 +218,51 @@ export default function() {
218
218
219
219

220
220
221
-
### Constructor Description
221
+
####Constructor Description
222
222
223
-
#### `Pin(dictionary)`
223
+
#####`Pin(dictionary)`
224
224
225
225
| Argument | Type | Description |
226
226
| --- | --- | :--- |
227
227
| `dictionary` | `object` | An object with properties to initialize the result. The required parameters are specified in the [Dictionary](#Pin-dictionary) section below.
228
228
229
229
230
230
<aid="Pin-dictionary"></a>
231
-
### Dictionary
231
+
####Dictionary
232
232
233
233
| Parameter | Type | Description
234
234
| --- | --- | :--- |
235
235
|`pin`|`number`| The GPIO pin number |
236
236
|`expander`|`expander`| The instance of `Expander` that created this `Pin` instance |
237
237
238
-
### Properties
238
+
####Properties
239
239
240
240
All properties are read-only.
241
241
242
-
| Name | Description |
243
-
| --- | :--- |
244
-
|`pin`| The GPIO pin number |
245
-
|`expander`| The instance of `Expander` that this `Pin` belongs to |
246
-
242
+
| Name | Type | Description |
243
+
| --- | --- | :--- |
244
+
|`pin`|`number`| The GPIO pin number |
245
+
|`expander`|`expander`| The instance of `Expander` that this `Pin` belongs to |
247
246
248
-
### Methods
247
+
####Methods
249
248
250
-
#### `mode(mode)`
249
+
#####`mode(mode)`
251
250
252
251
| Argument | Type | Description |
253
252
| --- | --- | :--- |
254
253
| `mode` | `number` | A number representing the desired mode. May be input, input pullup, or output.
255
254
256
255
Sets the pin's mode to the specified mode.
257
256
258
-
#### `read()`
257
+
#####`read()`
259
258
260
259
Sets the pin's mode to input, reads the value of the pin object, and returns the value.
261
260
262
-
#### `write(value)`
261
+
#####`write(value)`
263
262
264
263
Sets the pin's mode to output and writes the value to the pin object.
0 commit comments