diff options
author | Christian Pointner <equinox@spreadspace.org> | 2013-02-06 00:54:15 +0000 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2013-02-06 00:54:15 +0000 |
commit | 64d7ae4747041352edeb9cbf5418b0ab274da5e1 (patch) | |
tree | 3b14302cf6473d8c848bf370076257310792835a /usb-i2c-sl018/stepper.c | |
parent | stepper works now (diff) |
added open and close command
git-svn-id: https://svn.spreadspace.org/avr/trunk@123 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'usb-i2c-sl018/stepper.c')
-rw-r--r-- | usb-i2c-sl018/stepper.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usb-i2c-sl018/stepper.c b/usb-i2c-sl018/stepper.c index f8f2991..4258da7 100644 --- a/usb-i2c-sl018/stepper.c +++ b/usb-i2c-sl018/stepper.c @@ -95,8 +95,11 @@ void init_stepper(void) STEPPER_DDR |= (0xF << STEPPER_FIRST_BIT) | (1<<STEPPER_ENABLE_BIT); } -void start_stepper(stepper_direction_t direction) +uint8_t start_stepper(stepper_direction_t direction) { + if(TCCR1B) + return 0; + step_cnt = 0; step_direction = direction; STEPPER_PORT |= 1<<STEPPER_ENABLE_BIT; @@ -108,6 +111,8 @@ void start_stepper(stepper_direction_t direction) //OCR1A = 155; // (1+155)*256 = 40000 -> 2 ms @ 20 MHz TCNT1 = 0; // reseting timer TIMSK1 = 1<<OCIE1A; // enable Interrupt + + return 1; } |