Skip to content

Commit c6890ae

Browse files
committed
v3/docs/DRIVERS.md Improve description of Pushbutton sense arg.
1 parent 66f03ed commit c6890ae

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

v3/docs/DRIVERS.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Constructor arguments:
153153
1. `pin` Mandatory. The initialised Pin instance.
154154
2. `suppress` Default `False`. See
155155
[section 4.1.1](./DRIVERS.md#411-the-suppress-constructor-argument).
156-
3. `sense` Default `None`. See
156+
3. `sense` Default `None`. Option to define electrical connection. See
157157
[section 4.1.2](./DRIVERS.md#412-the-sense-constructor-argument).
158158

159159
Methods:
@@ -227,12 +227,21 @@ set, `release_func` will be launched as follows:
227227

228228
### 4.1.2 The sense constructor argument
229229

230+
In most applications it can be assumed that, at power-up, pushbuttons are not
231+
pressed. The default `None` value uses this assumption to assign the `False`
232+
(not pressed) state at power up. It therefore works with normally open or
233+
normally closed buttons wired to either supply rail. This without programmer
234+
intervention.
235+
236+
In certain use cases this assumption does not hold, and `sense` must explicitly
237+
be specified. This defines the logical state at power-up regardless of whether,
238+
at that time, the button is pressed. Hence `sense=0` defines a button connected
239+
in such a way that when it is not pressed, the voltage on the pin is 0.
240+
230241
When the pin value changes, the new value is compared with `sense` to determine
231242
if the button is closed or open. This is to allow the designer to specify if
232243
the `closed` state of the button is active `high` or active `low`.
233244

234-
This parameter will default to the current value of `pin` for convienence.
235-
236245
###### [Contents](./DRIVERS.md#1-contents)
237246

238247
# 5. ADC monitoring

0 commit comments

Comments
 (0)