bringing the discussion from this thread
This looks cool, though it'd help to add in a comment the sequence it generates.
For my lib I'll provide several strategiers for sequencing, definitely adding this one. But I have a couple of doubts:
- Wouldn't it be best to set all out pins at the exact same time? in RPi this method lets you do so (testes with a scope and rise time is the same for 2 pins)
GPIO.output([pin1, pin2, pin3, pin4], [val1, val2, val3, val4]) .
- In my stepping API I handle it as stepping jobs with n steps, currently all jobs start at step zero which bring up:
# Todo: Not sure if starting from zero on every stepping job is the right call.
# What happens when a job ends at a different phase and then the next starts at phase 0?
Given that I use simultaneous pin setting this are my sequences:
STEP_SEQUENCE = {
FULL_2PIN: [(GPIO.LOW, GPIO.HIGH), # 01
(GPIO.HIGH, GPIO.HIGH), # 11
(GPIO.HIGH, GPIO.LOW)], # 10
FULL: [(GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.LOW), # 1010
(GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.LOW), # 0110
(GPIO.LOW, GPIO.HIGH, GPIO.LOW, GPIO.HIGH), # 0101
(GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.HIGH)], # 1001
HALF: [(GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.LOW), # 1000
(GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.LOW), # 1010
(GPIO.LOW, GPIO.LOW, GPIO.HIGH, GPIO.LOW), # 0010
(GPIO.LOW, GPIO.HIGH, GPIO.HIGH, GPIO.LOW), # 0110
(GPIO.LOW, GPIO.HIGH, GPIO.LOW, GPIO.LOW), # 0100
(GPIO.LOW, GPIO.HIGH, GPIO.LOW, GPIO.HIGH), # 0101
(GPIO.LOW, GPIO.LOW, GPIO.LOW, GPIO.HIGH), # 0001
(GPIO.HIGH, GPIO.LOW, GPIO.LOW, GPIO.HIGH)], # 1001
FULL_3PIN: [(GPIO.HIGH, GPIO.LOW, GPIO.LOW), # 100
(GPIO.LOW, GPIO.LOW, GPIO.HIGH), # 001
(GPIO.LOW, GPIO.HIGH, GPIO.LOW)], # 010
HALF_3PIN: [(GPIO.HIGH, GPIO.LOW, GPIO.LOW), # 100
(GPIO.HIGH, GPIO.LOW, GPIO.HIGH), # 101
(GPIO.LOW, GPIO.LOW, GPIO.HIGH), # 001
(GPIO.LOW, GPIO.HIGH, GPIO.HIGH), # 011
(GPIO.LOW, GPIO.HIGH, GPIO.LOW), # 010
(GPIO.HIGH, GPIO.HIGH, GPIO.LOW)]} # 110