This commit is contained in:
Jeff Epler 2022-01-12 08:43:33 -06:00
parent 2a22758cf9
commit 68a5881044
No known key found for this signature in database
GPG key ID: D5BF15AB975AB4DE
2 changed files with 6 additions and 3 deletions

View file

@ -206,7 +206,9 @@ class Program: # pylint: disable=too-few-public-methods
try:
assembled[-1] |= SET_DESTINATIONS.index(instruction[1]) << 5
except ValueError as exc:
raise ValueError(f"Invalid set destination '{instruction[1]}'") from exc
raise ValueError(
f"Invalid set destination '{instruction[1]}'"
) from exc
value = int(instruction[-1])
if not 0 <= value <= 31:
raise RuntimeError("Set value out of range")

View file

@ -25,7 +25,8 @@ bitloop: ; This loop will run 8 times (8n1 UART)
class TXUART:
def __init__(self, *, tx, baudrate=9600):
self.pio = rp2pio.StateMachine(code.assembled,
self.pio = rp2pio.StateMachine(
code.assembled,
first_out_pin=tx,
first_sideset_pin=tx,
frequency=8 * baudrate,
@ -33,7 +34,7 @@ class TXUART:
initial_sideset_pin_direction=1,
initial_out_pin_state=1,
initial_out_pin_direction=1,
**code.pio_kwargs
**code.pio_kwargs,
)
@property