Skip to content

Commit f8d5948

Browse files
committed
Add serial port baudrate setter
Allow serial port code to set the baud rate as well as query. Avoid re-setting the baud rate to the current value as QtSerial seems to do two baud rate settings, first to 4Mbaud and then to the target rate in this case. Signed-off-by: Keith Packard <[email protected]>
1 parent 866e68a commit f8d5948

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mu/modes/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ def baudrate(self):
107107
else:
108108
return None
109109

110+
@baudrate.setter
111+
def baudrate(self, value):
112+
if value != self._baudrate:
113+
self._baudrate = value
114+
if self.serial:
115+
self.serial.setBaudRate(value)
116+
110117
def open(self):
111118
"""
112119
Open the serial link

0 commit comments

Comments
 (0)