You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parafraktor-stm32/Inc/stepper.h

30 lines
618 B
C

#include "stm32g0b1xx.h"
#include <stdint.h>
typedef struct {
GPIO_TypeDef* en_port;
uint8_t en_pin;
GPIO_TypeDef* dir_port;
uint8_t dir_pin;
GPIO_TypeDef* step_port;
uint8_t step_pin;
GPIO_TypeDef* home_port;
uint8_t home_pin;
uint8_t homed:1;
uint8_t trigger_step:1;
int32_t home_position;
int32_t pos;
int32_t endless_rot_integrator;
int32_t speed;
int32_t ramp_to_speed;
uint32_t next_step;
} stepper_T;
#define STEPPER_MAX_SPEED 400
#define STEPPER_STEPS_PER_ROTATION 3200*4
void Timer1_Init(void);
void stepper_gpio_init();
void do_steps();