Merge pull request #26 from lurch/fix_pio_freq

Change a couple of PIO examples to run at 2000Hz
pull/32/head
Alasdair Allan 2021-04-08 11:57:39 +01:00 zatwierdzone przez GitHub
commit e87f478c6c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -19,10 +19,10 @@ def blink():
nop() [31]
wrap()
# Instantiate a state machine with the blink program, at 1000Hz, with set bound to Pin(25) (LED on the rp2 board)
sm = rp2.StateMachine(0, blink, freq=1000, set_base=Pin(25))
# Instantiate a state machine with the blink program, at 2000Hz, with set bound to Pin(25) (LED on the rp2 board)
sm = rp2.StateMachine(0, blink, freq=2000, set_base=Pin(25))
# Run the state machine for 3 seconds. The LED should blink.
sm.active(1)
time.sleep(3)
sm.active(0)
sm.active(0)

Wyświetl plik

@ -19,7 +19,7 @@ def irq_test():
rp2.PIO(0).irq(lambda pio: print(pio.irq().flags()))
sm = rp2.StateMachine(0, irq_test, freq=1000)
sm = rp2.StateMachine(0, irq_test, freq=2000)
sm.active(1)
time.sleep(1)
sm.active(0)
sm.active(0)