tmc_uart: Minor change - make the baud rate setting more clear

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-02-27 10:58:01 -05:00
parent f035de264f
commit 86c943467f
1 changed files with 3 additions and 1 deletions

View File

@ -53,6 +53,8 @@ class MCU_analog_mux:
# TMC uart communication # TMC uart communication
###################################################################### ######################################################################
TMC_BAUD_RATE = 9000
# Code for sending messages on a TMC uart # Code for sending messages on a TMC uart
class MCU_TMC_uart_bitbang: class MCU_TMC_uart_bitbang:
def __init__(self, rx_pin_params, tx_pin_params, select_pins_desc): def __init__(self, rx_pin_params, tx_pin_params, select_pins_desc):
@ -71,7 +73,7 @@ class MCU_TMC_uart_bitbang:
self.tmcuart_send_cmd = None self.tmcuart_send_cmd = None
self.mcu.register_config_callback(self.build_config) self.mcu.register_config_callback(self.build_config)
def build_config(self): def build_config(self):
bit_ticks = self.mcu.seconds_to_clock(1. / 9000.) bit_ticks = self.mcu.seconds_to_clock(1. / TMC_BAUD_RATE)
self.mcu.add_config_cmd( self.mcu.add_config_cmd(
"config_tmcuart oid=%d rx_pin=%s pull_up=%d tx_pin=%s bit_time=%d" "config_tmcuart oid=%d rx_pin=%s pull_up=%d tx_pin=%s bit_time=%d"
% (self.oid, self.rx_pin, self.pullup, self.tx_pin, bit_ticks)) % (self.oid, self.rx_pin, self.pullup, self.tx_pin, bit_ticks))