summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-02-07 05:21:24 +0000
committerChristian Pointner <equinox@spreadspace.org>2013-02-07 05:21:24 +0000
commit2ecef8fb8e925eb2942db3f7e0865fca553b7465 (patch)
tree018a3c2fdea026dca11da01f3688d03169b9e3e9
parentnaming convention for heartbeat (diff)
naming convention for stepper
git-svn-id: https://svn.spreadspace.org/avr/trunk@179 aa12f405-d877-488e-9caf-2d797e2a1cc7
-rw-r--r--usb-i2c-sl018/statemachine.c4
-rw-r--r--usb-i2c-sl018/stepper.c12
-rw-r--r--usb-i2c-sl018/stepper.h4
-rw-r--r--usb-i2c-sl018/tuer-rfid.c2
4 files changed, 11 insertions, 11 deletions
diff --git a/usb-i2c-sl018/statemachine.c b/usb-i2c-sl018/statemachine.c
index 7bbe44f..62d3277 100644
--- a/usb-i2c-sl018/statemachine.c
+++ b/usb-i2c-sl018/statemachine.c
@@ -59,12 +59,12 @@ void change_state(state_t new_state)
case closed: ledmatrix(red); break;
case closing:
ledmatrix(red_moving);
- start_stepper(dir_close);
+ stepper_start(dir_close);
break;
case opened: ledmatrix(green); break;
case opening:
ledmatrix(green_moving);
- start_stepper(dir_open);
+ stepper_start(dir_open);
break;
case timeout_after_open: ledmatrix(green_blink); break;
case timeout_after_close: ledmatrix(red_blink); break;
diff --git a/usb-i2c-sl018/stepper.c b/usb-i2c-sl018/stepper.c
index d2fd50f..d26815a 100644
--- a/usb-i2c-sl018/stepper.c
+++ b/usb-i2c-sl018/stepper.c
@@ -48,14 +48,14 @@ volatile uint16_t step_cnt = 0;
#define STEP_CNT_OFF (STEP_CNT_STOP + 125)
stepper_direction_t step_direction = dir_open;
-inline void stop_stepper(void)
+inline void stepper_stop(void)
{
STEPPER_PORT &= ~(0xF << STEPPER_FIRST_BIT | 1<<STEPPER_ENABLE_BIT);
TCCR1B = 0; // no clock source
TIMSK1 = 0; // disable timer interrupt
}
-static inline uint8_t handle_step(void)
+static inline uint8_t stepper_handle(void)
{
static uint8_t step_idx = 0;
@@ -89,13 +89,13 @@ static inline uint8_t handle_step(void)
return 1;
}
-void init_stepper(void)
+void stepper_init(void)
{
STEPPER_PORT &= ~(0xF << STEPPER_FIRST_BIT | 1<<STEPPER_ENABLE_BIT);
STEPPER_DDR |= (0xF << STEPPER_FIRST_BIT) | (1<<STEPPER_ENABLE_BIT);
}
-uint8_t start_stepper(stepper_direction_t direction)
+uint8_t stepper_start(stepper_direction_t direction)
{
step_cnt = 0;
step_direction = direction;
@@ -111,6 +111,6 @@ uint8_t start_stepper(stepper_direction_t direction)
ISR(TIMER1_COMPA_vect)
{
- if(!handle_step())
- stop_stepper();
+ if(!stepper_handle())
+ stepper_stop();
}
diff --git a/usb-i2c-sl018/stepper.h b/usb-i2c-sl018/stepper.h
index 531bf9e..df8d38d 100644
--- a/usb-i2c-sl018/stepper.h
+++ b/usb-i2c-sl018/stepper.h
@@ -26,7 +26,7 @@
#include <stdint.h>
typedef enum { dir_open = 0, dir_close = 1 } stepper_direction_t;
-void init_stepper(void);
-uint8_t start_stepper(stepper_direction_t direction);
+void stepper_init(void);
+uint8_t stepper_start(stepper_direction_t direction);
#endif
diff --git a/usb-i2c-sl018/tuer-rfid.c b/usb-i2c-sl018/tuer-rfid.c
index 53c3435..bdb6532 100644
--- a/usb-i2c-sl018/tuer-rfid.c
+++ b/usb-i2c-sl018/tuer-rfid.c
@@ -124,7 +124,7 @@ int main(void)
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 200000));
heartbeat_init();
- init_stepper();
+ stepper_init();
init_ledmatrix();
init_eventqueue();
init_limits();