@@ -46,10 +46,14 @@ class PPK2_Modes():
4646
4747
4848class PPK2_API ():
49- def __init__ (self , port , read_timeout = 1 , write_timeout = 1 ):
49+ def __init__ (self , port : str , ** kwargs ):
50+ '''
51+ port - port where PPK2 is connected
52+ **kwargs - keyword arguments to pass to the pySerial constructor
53+ '''
5054
5155 self .ser = None
52- self .ser = serial .Serial (port , exclusive = True , timeout = read_timeout , write_timeout = write_timeout )
56+ self .ser = serial .Serial (port , ** kwargs )
5357 self .ser .baudrate = 9600
5458
5559 self .modifiers = {
@@ -435,13 +439,14 @@ class PPK2_MP(PPK2_API):
435439 Multiprocessing variant of the object. The interface is the same as for the regular one except it spawns
436440 a background process on start_measuring()
437441 '''
438- def __init__ (self , port , buffer_max_size_seconds = 10 , buffer_chunk_seconds = 0.1 ):
442+ def __init__ (self , port , buffer_max_size_seconds = 10 , buffer_chunk_seconds = 0.1 , ** kwargs ):
439443 '''
440444 port - port where PPK2 is connected
441445 buffer_max_size_seconds - how many seconds of data to keep in the buffer
442446 buffer_chunk_seconds - how many seconds of data to put in the queue at once
447+ **kwargs - keyword arguments to pass to the pySerial constructor
443448 '''
444- super ().__init__ (port )
449+ super ().__init__ (port , ** kwargs )
445450
446451 self ._fetcher = None
447452 self ._quit_evt = threading .Event ()
0 commit comments