diff --git a/pio/pio_servo/README.adoc b/pio/pio_servo/README.adoc index 640713c..90c2417 100644 --- a/pio/pio_servo/README.adoc +++ b/pio/pio_servo/README.adoc @@ -3,6 +3,17 @@ Drive a servo motor by using two PIO statemachines for pulse output. +Each output needs a statemachine running servo_trigger and one running servo_prog. +Due to the IRQ assignments, the statemachines need to be in ordered to have the servo_trigger program first, e.g.: + +``` +trig = Servo_Trigger(0) # Statemachine 0 +s = Servo(1, 16) # phys IO on pin 16 # Statemachine 1, since the trigger is on SM0 + +trig2 = Servo_Trigger(2) # Statemachine 2 +s2 = Servo(3, 25) # Builtin LED # Statemachine 3, since the trigger is on SM2 +``` + == Wiring information See <> for wiring instructions. diff --git a/pio/pio_servo/pio_servo.py b/pio/pio_servo/pio_servo.py index 452dfe7..866a613 100644 --- a/pio/pio_servo/pio_servo.py +++ b/pio/pio_servo/pio_servo.py @@ -76,11 +76,11 @@ class Servo: self.sm.put(int(self.free_pulse*n)) # Trigger needs to be the sm before the servo, so the IRQs set by rel(n) match -trig = Servo_Trigger(2) -s = Servo(3, 16) # phys IO on pin 16 +trig = Servo_Trigger(0) +s = Servo(1, 16) # phys IO on pin 16 -trig2 = Servo_Trigger(0) -s2 = Servo(1, 25) # Builtin LED +trig2 = Servo_Trigger(2) +s2 = Servo(3, 25) # Builtin LED for _ in range(2): for p in range(10+1):