Skip to content

Commit 7bb1d5b

Browse files
committed
Add configurable read/write timeouts to PPK2_API class
1 parent 95b893e commit 7bb1d5b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ppk2_api/ppk2_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ class PPK2_Modes():
4646

4747

4848
class PPK2_API():
49-
def __init__(self, port):
49+
def __init__(self, port, read_timeout=1, write_timeout=1):
5050

5151
self.ser = None
52-
self.ser = serial.Serial(port)
52+
self.ser = serial.Serial(port, exclusive=True, timeout=read_timeout, write_timeout=write_timeout)
5353
self.ser.baudrate = 9600
5454

5555
self.modifiers = {

0 commit comments

Comments
 (0)