本文整理匯總了Python中pyb.UART.sendbreak方法的典型用法代碼示例。如果您正苦於以下問題:Python UART.sendbreak方法的具體用法?Python UART.sendbreak怎麽用?Python UART.sendbreak使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyb.UART
的用法示例。
在下文中一共展示了UART.sendbreak方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: range
# 需要導入模塊: from pyb import UART [as 別名]
# 或者: from pyb.UART import sendbreak [as 別名]
uart_id_range = range(0, 2)
uart_pins = [[('GP12', 'GP13'), ('GP12', 'GP13', 'GP7', 'GP6')], [('GP16', 'GP17'), ('GP16', 'GP17', 'GP7', 'GP6')]]
else:
raise Exception('Board not supported!')
# just in case we have stdio duplicated on any of the uarts
pyb.repl_uart(None)
for uart_id in uart_id_range:
uart = UART(uart_id, 38400)
print(uart)
uart.init(57600, 8, None, 1, pins=uart_pins[uart_id][0])
uart.init(baudrate=9600, stop=2, parity=UART.EVEN, pins=uart_pins[uart_id][1])
uart.init(baudrate=115200, parity=UART.ODD, stop=0, pins=uart_pins[uart_id][0])
uart = UART(baudrate=1000000)
uart.sendbreak()
uart = UART(baudrate=1000000)
uart = UART()
print(uart)
uart = UART(baudrate=38400, pins=('GP12', 'GP13'))
print(uart)
uart = UART(pins=('GP12', 'GP13'))
print(uart)
uart = UART(pins=(None, 'GP17'))
print(uart)
uart = UART(baudrate=57600, pins=('GP16', 'GP17'))
print(uart)
# now it's time for some loopback tests between the uarts
uart0 = UART(0, 1000000, pins=uart_pins[0][0])
示例2: UART
# 需要導入模塊: from pyb import UART [as 別名]
# 或者: from pyb.UART import sendbreak [as 別名]
from pyb import UART
uart = UART(1)
uart = UART(1, 9600)
uart = UART(1, 9600, bits=8, parity=None, stop=1)
print(uart)
uart.init(2400)
print(uart)
print(uart.any())
print(uart.write('123'))
print(uart.write(b'abcd'))
print(uart.writechar(1))
# make sure this method exists
uart.sendbreak()