diff options
Diffstat (limited to 'usb-i2c-sl018')
-rw-r--r-- | usb-i2c-sl018/statemachine.c | 4 | ||||
-rw-r--r-- | usb-i2c-sl018/stepper.c | 12 | ||||
-rw-r--r-- | usb-i2c-sl018/stepper.h | 4 | ||||
-rw-r--r-- | usb-i2c-sl018/tuer-rfid.c | 2 |
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(); |