libpynq  (release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
STEPPER library

Functions

void stepper_init (void)
 
void stepper_destroy (void)
 
void stepper_enable (void)
 
void stepper_disable (void)
 
void stepper_reset (void)
 
void stepper_set_speed (uint16_t left, uint16_t right)
 
void stepper_steps (int16_t left, int16_t right)
 
void stepper_get_steps (int16_t *left, int16_t *right)
 
bool stepper_steps_done (void)
 

Detailed Description

stepper library only for balancing robot.

requires 0.3.0

Function Documentation

◆ stepper_destroy()

void stepper_destroy ( void  )

Cleanup the stepper driver.

Definition at line 99 of file stepper.c.

◆ stepper_disable()

void stepper_disable ( void  )

Disable the steppers. This toggles the enable pin on the physical drivers. If disabled, the wheels freely spin.

Definition at line 91 of file stepper.c.

◆ stepper_enable()

void stepper_enable ( void  )

Enable the steppers. This toggles the enable pin on the physical drivers. If enabled the wheels be locked into position.

Definition at line 84 of file stepper.c.

◆ stepper_get_steps()

void stepper_get_steps ( int16_t *  left,
int16_t *  right 
)
Parameters
leftThe number of steps for the left wheel
rightThe number of steps for the right wheel

The steps remaining to take in the current command.

Definition at line 163 of file stepper.c.

◆ stepper_init()

void stepper_init ( void  )

Initialize the stepper driver.

Definition at line 69 of file stepper.c.

◆ stepper_reset()

void stepper_reset ( void  )

Emergency reset the whole stepper module. This will disable the drivers and discard any command currently being queued or processed.

Definition at line 109 of file stepper.c.

◆ stepper_set_speed()

void stepper_set_speed ( uint16_t  left,
uint16_t  right 
)
Parameters
leftThe speed for the left wheel
rightThe speed for the right wheel

The value set indicates the time between pulses. The shorter the value, the faster the stepper steps.

Definition at line 147 of file stepper.c.

◆ stepper_steps()

void stepper_steps ( int16_t  left,
int16_t  right 
)
Parameters
leftThe number of steps for the left wheel
rightThe number of steps for the right wheel

This sets the number of steps to take for each wheel. The start is always synchronized.

Once it starts to process this, it stores the speed and number of steps. You can prepare a next command before it finishes processing. It only starts on the next command if both left/right steps are taken. To make sure that both wheels rotate the full command adjust the speed accordingly. For example to turn nicely: left speed X, steps Y, then right steps Y/2, speed X*2 (so goes 1/2 as fast)

Definition at line 132 of file stepper.c.

◆ stepper_steps_done()

bool stepper_steps_done ( void  )
Returns
true if stepper is idle, false when processing a command.

Definition at line 117 of file stepper.c.