stepper 2.1.0.0
Stepper Click Driver

API for configuring and manipulating Stepper Click driver. More...

Topics

 Stepper Settings
 Settings of Stepper Click driver.
 
 Stepper MikroBUS Map
 MikroBUS pin mapping of Stepper Click driver.
 

Functions

void stepper_cfg_setup (stepper_cfg_t *cfg)
 Stepper configuration object setup function.
 
err_t stepper_init (stepper_t *ctx, stepper_cfg_t *cfg)
 Stepper initialization function.
 
void stepper_default_cfg (stepper_t *ctx)
 Stepper default configuration function.
 
void stepper_set_step_mode (stepper_t *ctx, uint8_t mode)
 Stepper set step mode function.
 
void stepper_drive_motor (stepper_t *ctx, uint32_t steps, uint8_t speed)
 Stepper driver motor function.
 
void stepper_enable_device (stepper_t *ctx)
 Stepper enable device function.
 
void stepper_disable_device (stepper_t *ctx)
 Stepper disable device function.
 
void stepper_set_direction (stepper_t *ctx, uint8_t dir)
 Stepper set direction function.
 
void stepper_switch_direction (stepper_t *ctx)
 Stepper switch direction function.
 
void stepper_set_step_pin (stepper_t *ctx, uint8_t state)
 Stepper set step pin function.
 

Detailed Description

API for configuring and manipulating Stepper Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ stepper_cfg_setup()

void stepper_cfg_setup ( stepper_cfg_t * cfg)

Stepper configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See stepper_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ stepper_default_cfg()

void stepper_default_cfg ( stepper_t * ctx)

Stepper default configuration function.

This function executes a default configuration of Stepper click board.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
Returns
None.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ stepper_disable_device()

void stepper_disable_device ( stepper_t * ctx)

Stepper disable device function.

This function disables the device by setting the ENABLE pin to high logic state.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ stepper_drive_motor()

void stepper_drive_motor ( stepper_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper driver motor function.

This function drives the motor for the specific number of steps at the selected speed.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
[in]steps: Number of steps to rotate motor.
[in]speed: Motor rotation speed:
  • 0 - Very slow,
  • 1 - Slow,
  • 2 - Medium,
  • 3 - Fast,
  • 4 - Very fast,
Returns
None.
Note
None.

◆ stepper_enable_device()

void stepper_enable_device ( stepper_t * ctx)

Stepper enable device function.

This function enables the device by setting the ENABLE pin to low logic state.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ stepper_init()

err_t stepper_init ( stepper_t * ctx,
stepper_cfg_t * cfg )

Stepper initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See stepper_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See stepper_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper_set_direction()

void stepper_set_direction ( stepper_t * ctx,
uint8_t dir )

Stepper set direction function.

This function sets the motor direction by setting the DIR pin logic state.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
[in]dir:
  • 0 - Clockwise,
  • 1 - Counter-Clockwise.
Returns
None.
Note
None.

◆ stepper_set_step_mode()

void stepper_set_step_mode ( stepper_t * ctx,
uint8_t mode )

Stepper set step mode function.

This function sets the step mode resolution settings.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
[in]mode: Step mode resolution.
Returns
None.
Note
None.

◆ stepper_set_step_pin()

void stepper_set_step_pin ( stepper_t * ctx,
uint8_t state )

Stepper set step pin function.

This function sets the STEP pin logic state.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
[in]state:
  • 0 - Low logic state,
  • 1 - High logic state.
Returns
None.
Note
None.

◆ stepper_switch_direction()

void stepper_switch_direction ( stepper_t * ctx)

Stepper switch direction function.

This function switches the motor direction by toggling the DIR pin.

Parameters
[in]ctx: Click context object. See stepper_t object definition for detailed explanation.
Returns
None.
Note
None.