diff options
-rw-r--r-- | tube-rotator/stepper.c | 5 | ||||
-rw-r--r-- | tube-rotator/stepper.h | 1 | ||||
-rw-r--r-- | tube-rotator/tube-rotator.c | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/tube-rotator/stepper.c b/tube-rotator/stepper.c index 83b1026..80f4d8d 100644 --- a/tube-rotator/stepper.c +++ b/tube-rotator/stepper.c @@ -110,3 +110,8 @@ void stepper_dec_speed(void) { target_speed = (target_speed <= STEPPER_SPEED_MIN) ? target_speed : target_speed - 1; } + +uint16_t stepper_get_speed(void) +{ + return target_speed; +} diff --git a/tube-rotator/stepper.h b/tube-rotator/stepper.h index 2e95736..5b236b9 100644 --- a/tube-rotator/stepper.h +++ b/tube-rotator/stepper.h @@ -39,5 +39,6 @@ void stepper_stop(void); void stepper_set_speed(uint16_t new_speed); void stepper_inc_speed(void); void stepper_dec_speed(void); +uint16_t stepper_get_speed(void); #endif diff --git a/tube-rotator/tube-rotator.c b/tube-rotator/tube-rotator.c index de2bd49..b5a6bd6 100644 --- a/tube-rotator/tube-rotator.c +++ b/tube-rotator/tube-rotator.c @@ -47,6 +47,7 @@ void handle_cmd(uint8_t cmd) case '3': stepper_set_speed(STEPPER_SPEED_180RPM); break; default: printf("Error(cmd): unknown command %02X '%c'\r\n", cmd, cmd); return; } + printf("current speed: %d \r", stepper_get_speed()); } int main(void) |