Skip to content

Commit f239d47

Browse files
phoddiemkellner
authored andcommitted
initial capital letter on static constant names
1 parent dcfabc2 commit f239d47

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

documentation/pins/pins.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ The `Digital` class provides access to the GPIO pins.
1212

1313
import Digital from "pins/digital";
1414

15-
Pin numbers are device dependent.
16-
17-
The Digital class provides only static functions. It is not instantiated.
15+
Pin numbers and port names are device dependent.
1816

1917
### Reading a button
2018

@@ -27,7 +25,7 @@ The following example configures pin 0 as an input and then tests to see if a bu
2725

2826
The static `Digital.read` and `Digital.write` do not allow configuring all pin modes. Use the Digital constructor for full configuration, for example setting the input to use an internal pull-up resistor.
2927

30-
let button = new Digital(0, Digital.inputPullUp);
28+
let button = new Digital(0, Digital.InputPullUp);
3129
trace(`button state is ${button.read()}`;
3230

3331
### Blinking an LED
@@ -46,7 +44,7 @@ The following example configures pin 5 as an output and then blinks it one per s
4644
To open a GPIO pin on a specific port, use the Digital constructor with the optional first argument.
4745

4846
let blink = 1;
49-
let led = new Digital("gpioPortName", 5);
47+
let led = new Digital("gpioPortName", 5, Digital.Output);
5048

5149
Timer.repeat(id => {
5250
blink = blink ^ 1;
@@ -55,11 +53,11 @@ To open a GPIO pin on a specific port, use the Digital constructor with the opti
5553

5654
### static read(pin)
5755

58-
The `read` function sets the pin to `Digital.input` mode and samples the value of the specified pin, returning 0 or 1.
56+
The `read` function sets the pin to `Digital.Input` mode and samples the value of the specified pin, returning 0 or 1. The default port is used.
5957

6058
### static write(pin)
6159

62-
The `write` function sets the pin to `Digital.output` mode and its value to either 0 or 1.
60+
The `write` function sets the pin to `Digital.Output` mode and its value to either 0 or 1. The default port is used.
6361

6462
### constructor([port], pin, mode)
6563

@@ -69,12 +67,12 @@ The Digital constructor establishes a connection to the GPIO pin specified by th
6967

7068
The mode function sets the mode of the pin. Not all pins support all modes, so refer to the hardware documentation for details. The following mode values are available.
7169

72-
Digital.input
73-
Digital.inputPullUp
74-
Digital.inputPullDown
75-
Digital.inputPullUpDown
76-
Diigtal.output
77-
Digital.outputOpenDrain
70+
Digital.Input
71+
Digital.InputPullUp
72+
Digital.InputPullDown
73+
Digital.InputPullUpDown
74+
Digital.Output
75+
Digital.OutputOpenDrain
7876

7977
### read()
8078

modules/pins/digital/digital.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,21 @@
1919
*/
2020

2121
class Digital @ "xs_digital_destructor" {
22-
// static configure(pin, mode) @ "xs_digital_configure";
2322
static read(pin) @ "xs_digital_static_read";
2423
static write(pin, value) @ "xs_digital_static_write";
2524

26-
constructor() @ "xs_digital"; // or (pin, mode) where port is implicitly NULL
25+
constructor(port, pin, mode) @ "xs_digital";// or (pin, mode) where port is implicitly NULL
2726
mode(mode) @ "xs_digital_mode"; // change pin mode
2827
read() @ "xs_digital_read"; // read pin
2928
write(value) @ "xs_digital_write"; // write pin
3029
//@@ notify
3130
}
32-
Digital.input = 0;
33-
Digital.inputPullUp = 1;
34-
Digital.inputPullDown = 2;
35-
Digital.inputPullUpDown = 2;
36-
Digital.output = 8;
37-
Digital.outputOpenDrain = 9;
31+
Digital.Input = 0;
32+
Digital.InputPullUp = 1;
33+
Digital.InputPullDown = 2;
34+
Digital.InputPullUpDown = 2;
35+
Digital.Output = 8;
36+
Digital.OutputOpenDrain = 9;
3837

3938
Object.freeze(Digital.prototype);
4039

0 commit comments

Comments
 (0)