Change txuart example to use Program
This commit is contained in:
parent
666f4ef2c9
commit
2a22758cf9
1 changed files with 3 additions and 4 deletions
|
|
@ -5,7 +5,7 @@
|
|||
import rp2pio
|
||||
import adafruit_pioasm
|
||||
|
||||
code = adafruit_pioasm.assemble(
|
||||
code = adafruit_pioasm.Program(
|
||||
"""
|
||||
.program uart_tx
|
||||
.side_set 1 opt
|
||||
|
|
@ -25,8 +25,7 @@ bitloop: ; This loop will run 8 times (8n1 UART)
|
|||
|
||||
class TXUART:
|
||||
def __init__(self, *, tx, baudrate=9600):
|
||||
self.pio = rp2pio.StateMachine(
|
||||
code,
|
||||
self.pio = rp2pio.StateMachine(code.assembled,
|
||||
first_out_pin=tx,
|
||||
first_sideset_pin=tx,
|
||||
frequency=8 * baudrate,
|
||||
|
|
@ -34,7 +33,7 @@ class TXUART:
|
|||
initial_sideset_pin_direction=1,
|
||||
initial_out_pin_state=1,
|
||||
initial_out_pin_direction=1,
|
||||
sideset_enable=True,
|
||||
**code.pio_kwargs
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Reference in a new issue