@@ -494,18 +494,18 @@ from primitives import Keyboard
494
494
```
495
495
A ` Keyboard ` provides an interface to a set of pushbuttons arranged as a
496
496
crosspoint array. If a key is pressed its array index (scan code) is placed on a
497
- queue. Keypresses are retrieved with ` async for ` . The driver operates by
498
- polling each row, reading the response of each column. N -key rollover is
499
- supported - this is the case where a key is pressed before the prior key has
500
- been released.
497
+ queue. Keypresses are retrieved with ` async for ` . The driver operates by
498
+ polling each row, reading the response of each column. 1 -key rollover is
499
+ supported - this is the case where a key is pressed before the prior key has
500
+ been released.
501
501
502
- Example usage:
502
+ Example usage:
503
503
``` python
504
504
import asyncio
505
505
from primitives import Keyboard
506
506
from machine import Pin
507
- rowpins = [Pin(p, Pin.OUT ) for p in range (10 , 14 )]
508
- colpins = [Pin(p, Pin.IN , Pin.PULL_DOWN ) for p in range (16 , 20 )]
507
+ rowpins = [Pin(p, Pin.OPEN_DRAIN ) for p in range (10 , 14 )]
508
+ colpins = [Pin(p, Pin.IN , Pin.PULL_UP ) for p in range (16 , 20 )]
509
509
510
510
async def main ():
511
511
kp = Keyboard(rowpins, colpins)
@@ -553,7 +553,7 @@ async def repeat(tim, uart, ch): # Send at least one char
553
553
await tim.wait()
554
554
555
555
async def main (): # Run forever
556
- rowpins = [Pin(p, Pin.OUT ) for p in range (10 , 14 )]
556
+ rowpins = [Pin(p, Pin.OPEN_DRAIN ) for p in range (10 , 14 )]
557
557
colpins = [Pin(p, Pin.IN , Pin.PULL_DOWN ) for p in range (16 , 20 )]
558
558
uart = UART(0 , 9600 , tx = 0 , rx = 1 )
559
559
pad = Keyboard(rowpins, colpins)
@@ -570,10 +570,10 @@ asyncio.run(main())
570
570
```
571
571
##### Application note
572
572
573
- Scanning of the keyboard occurs rapidly, and built-in pull-down resistors have a
573
+ Scanning of the keyboard occurs rapidly, and built-in pull-up resistors have a
574
574
high value. If the capacitance between wires is high, spurious keypresses may be
575
- registed . To prevent this it is wise to add physical resistors between the input
576
- pins and gnd . A value in the region of 1KΩ to 5KΩ is recommended.
575
+ registered . To prevent this it is wise to add physical resistors between the
576
+ input pins and 3.3V . A value in the region of 1KΩ to 5KΩ is recommended.
577
577
578
578
###### [ Contents] ( ./EVENTS.md#0-contents )
579
579
0 commit comments