@@ -133,8 +133,9 @@ double-click or long press events.
133
133
134
134
This can support normally open or normally closed switches, connected to ` gnd `
135
135
(with a pullup) or to ` 3V3 ` (with a pull-down). The ` Pin ` object should be
136
- initialised appropriately. The assumption is that on instantiation the button
137
- is not pressed.
136
+ initialised appropriately. The default state of the switch can be passed in the
137
+ optional "sense" parameter on the constructor, otherwise the assumption is that
138
+ on instantiation the button is not pressed.
138
139
139
140
The Pushbutton class uses logical rather than physical state: a button's state
140
141
is considered ` True ` if pressed, otherwise ` False ` regardless of its physical
@@ -151,6 +152,8 @@ Constructor arguments:
151
152
1 . ` pin ` Mandatory. The initialised Pin instance.
152
153
2 . ` suppress ` Default ` False ` . See
153
154
[ section 4.1.1] ( ./DRIVERS.md#411-the-suppress-constructor-argument ) .
155
+ 3 . ` sense ` Default ` None ` . See
156
+ [ section 4.1.1] ( ./DRIVERS.md#412-the-sense-constructor-argument ) .
154
157
155
158
Methods:
156
159
@@ -221,6 +224,14 @@ set, `release_func` will be launched as follows:
221
224
4 . If ` double_func ` exists and a double click occurs, ` release_func ` will not
222
225
be launched.
223
226
227
+ ### 4.1.2 The sense constructor argument
228
+
229
+ When the pin value changes, the new value is compared with ` sense ` to determine
230
+ if the button is closed or open. This is to allow the designer to specify if
231
+ the ` closed ` state of the button is active ` high ` or active ` low ` .
232
+
233
+ This parameter will default to the current value of ` pin ` for convienence.
234
+
224
235
###### [ Contents] ( ./DRIVERS.md#1-contents )
225
236
226
237
# 5. ADC monitoring
0 commit comments