File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export enum GPIOPinState {
7
7
Input ,
8
8
InputPullUp ,
9
9
InputPullDown ,
10
+ InputBusKeeper ,
10
11
}
11
12
12
13
export const FUNCTION_PWM = 4 ;
@@ -186,10 +187,15 @@ export class GPIOPin {
186
187
return this . outputValue ? GPIOPinState . High : GPIOPinState . Low ;
187
188
} else {
188
189
// TODO: check what happens when we enable both pullup/pulldown
189
- if ( this . pulldownEnabled ) {
190
+ // ANSWER: It is valid, see: 2.19.4.1. Bus Keeper Mode, datasheet p240
191
+ if ( this . pulldownEnabled && this . pullupEnabled ) {
192
+ // Pull high when high, pull low when low:
193
+ return GPIOPinState . InputBusKeeper ;
194
+ }
195
+ else if ( this . pulldownEnabled ) {
190
196
return GPIOPinState . InputPullDown ;
191
197
}
192
- if ( this . pullupEnabled ) {
198
+ else if ( this . pullupEnabled ) {
193
199
return GPIOPinState . InputPullUp ;
194
200
}
195
201
return GPIOPinState . Input ;
You can’t perform that action at this time.
0 commit comments