Skip to content

Commit 8fd6717

Browse files
rwaldronmkellner
authored andcommitted
modules/drivers/mcp230xx: rename bankWrite -> write, bankRead -> read #29
1 parent 8fbf8b0 commit 8fd6717

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

documentation/drivers/MCP230XX/MCP230XX.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,22 @@ All properties are read-only.
8686

8787
#### Methods
8888

89-
##### `bankWrite(byte)`
89+
##### `write(byte)`
9090

9191
Temporarily sets the mode of all pins to output and writes all pins at once.
9292

9393
```js
9494
let expander = new MCP23008(); // defaults to 0x20!
95-
expander.bankWrite(0b11111111); // Set all pins to 1
95+
expander.write(0b11111111); // Set all pins to 1
9696
```
9797

98-
##### `bankRead()`
98+
##### `read()`
9999

100100
Temporarily sets the mode of all pins to input, reads all pins at once, and returns their values.
101101

102102
```js
103103
let expander = new MCP23008(); // defaults to 0x20!
104-
trace(`${expander.bankRead()}\n`);
104+
trace(`${expander.read()}\n`);
105105
```
106106

107107

@@ -173,22 +173,22 @@ All properties are read-only.
173173

174174
#### Methods
175175

176-
##### `bankWrite(word)`
176+
##### `write(word)`
177177

178178
Temporarily sets the mode of all pins to output and writes all pins at once.
179179

180180
```js
181181
let expander = new MCP23017(); // defaults to 0x20!
182-
expander.bankWrite(0b1111111111111111); // Set all pins to 1
182+
expander.write(0b1111111111111111); // Set all pins to 1
183183
```
184184

185-
##### `bankRead()`
185+
##### `read()`
186186

187187
Temporarily sets the mode of all pins to input, reads all pins at once, and returns their values.
188188

189189
```js
190190
let expander = new MCP23017(); // defaults to 0x20!
191-
trace(`${expander.bankRead()}\n`);
191+
trace(`${expander.read()}\n`);
192192
```
193193

194194
### Pin Class

examples/drivers/mcp23017/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function() {
3030
let last = Date.now();
3131

3232
// Set pins 0-15
33-
expander.bankWrite(0x0000);
33+
expander.write(0x0000);
3434

3535
button.mode(Digital.Input);
3636

@@ -46,13 +46,13 @@ export default function() {
4646
last = now;
4747

4848
// Check if the button is pressed...
49-
if (expander.bankRead() >> 15) {
49+
if (expander.read() >> 15) {
5050
indicator ^= 1;
5151
}
5252
}
5353
// Set pins 8-15 (Or: port B)
5454
ports.b = (indicator << 8);
5555

56-
expander.bankWrite(ports.b | ports.a);
56+
expander.write(ports.b | ports.a);
5757
}, 50);
5858
}

modules/drivers/mcp230xx/mcp230xx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Expander extends SMBus {
7676
Object.freeze(this);
7777
}
7878

79-
bankWrite(state) {
79+
write(state) {
8080
if (this.offset) {
8181
// Read IODIR state
8282
let iodir = this.readWord(this.IODIR);
@@ -103,7 +103,7 @@ class Expander extends SMBus {
103103
this.writeByte(this.IODIR, iodir);
104104
}
105105
}
106-
bankRead() {
106+
read() {
107107
if (this.offset) {
108108
// Read IODIR state
109109
let iodir = this.readWord(this.IODIR);

0 commit comments

Comments
 (0)