stepper2 2.1.0.0
Stepper 2 Click Driver

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

Topics

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

Functions

void stepper2_cfg_setup (stepper2_cfg_t *cfg)
 Stepper 2 configuration object setup function.
 
err_t stepper2_init (stepper2_t *ctx, stepper2_cfg_t *cfg)
 Stepper 2 initialization function.
 
void stepper2_default_cfg (stepper2_t *ctx)
 Stepper 2 default configuration function.
 
void stepper2_drive_motor (stepper2_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 2 driver motor function.
 
void stepper2_enable_reset (stepper2_t *ctx)
 Stepper 2 enable reset function.
 
void stepper2_disable_reset (stepper2_t *ctx)
 Stepper 2 disable reset function.
 
void stepper2_enable_sleep (stepper2_t *ctx)
 Stepper 2 enable sleep function.
 
void stepper2_disable_sleep (stepper2_t *ctx)
 Stepper 2 disable sleep function.
 
void stepper2_enable_device (stepper2_t *ctx)
 Stepper 2 enable device function.
 
void stepper2_disable_device (stepper2_t *ctx)
 Stepper 2 disable device function.
 
void stepper2_set_direction (stepper2_t *ctx, uint8_t dir)
 Stepper 2 set direction function.
 
void stepper2_switch_direction (stepper2_t *ctx)
 Stepper 2 switch direction function.
 
void stepper2_set_step_pin (stepper2_t *ctx, uint8_t state)
 Stepper 2 set step pin function.
 

Detailed Description

API for configuring and manipulating Stepper 2 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

◆ stepper2_cfg_setup()

void stepper2_cfg_setup ( stepper2_cfg_t * cfg)

Stepper 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper2_default_cfg()

void stepper2_default_cfg ( stepper2_t * ctx)

Stepper 2 default configuration function.

This function executes a default configuration of Stepper 2 click board.

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

◆ stepper2_disable_device()

void stepper2_disable_device ( stepper2_t * ctx)

Stepper 2 disable device function.

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

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

◆ stepper2_disable_reset()

void stepper2_disable_reset ( stepper2_t * ctx)

Stepper 2 disable reset function.

This function disables the reset by setting the RESET pin to high logic state.

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

◆ stepper2_disable_sleep()

void stepper2_disable_sleep ( stepper2_t * ctx)

Stepper 2 disable sleep function.

This function disables the sleep by setting the SLEEP pin to high logic state.

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

◆ stepper2_drive_motor()

void stepper2_drive_motor ( stepper2_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 2 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 stepper2_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.

◆ stepper2_enable_device()

void stepper2_enable_device ( stepper2_t * ctx)

Stepper 2 enable device function.

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

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

◆ stepper2_enable_reset()

void stepper2_enable_reset ( stepper2_t * ctx)

Stepper 2 enable reset function.

This function enables the reset by setting the RESET pin to low logic state.

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

◆ stepper2_enable_sleep()

void stepper2_enable_sleep ( stepper2_t * ctx)

Stepper 2 enable sleep function.

This function enables the sleep by setting the SLEEP pin to low logic state.

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

◆ stepper2_init()

err_t stepper2_init ( stepper2_t * ctx,
stepper2_cfg_t * cfg )

Stepper 2 initialization function.

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

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

◆ stepper2_set_direction()

void stepper2_set_direction ( stepper2_t * ctx,
uint8_t dir )

Stepper 2 set direction function.

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

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

◆ stepper2_set_step_pin()

void stepper2_set_step_pin ( stepper2_t * ctx,
uint8_t state )

Stepper 2 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper2_switch_direction()

void stepper2_switch_direction ( stepper2_t * ctx)

Stepper 2 switch direction function.

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

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