stepper4 2.1.0.0
Stepper 4 Click Driver

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

Topics

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

Functions

void stepper4_cfg_setup (stepper4_cfg_t *cfg)
 Stepper 4 configuration object setup function.
 
err_t stepper4_init (stepper4_t *ctx, stepper4_cfg_t *cfg)
 Stepper 4 initialization function.
 
void stepper4_default_cfg (stepper4_t *ctx)
 Stepper 4 default configuration function.
 
void stepper4_drive_motor (stepper4_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 4 drive motor function.
 
void stepper4_enable_device (stepper4_t *ctx)
 Stepper 4 enable device function.
 
void stepper4_disable_device (stepper4_t *ctx)
 Stepper 4 disable device function.
 
void stepper4_set_direction (stepper4_t *ctx, uint8_t dir)
 Stepper 4 set direction function.
 
void stepper4_switch_direction (stepper4_t *ctx)
 Stepper 4 switch direction function.
 
void stepper4_reset_device (stepper4_t *ctx)
 Stepper 4 reset device function.
 
uint8_t stepper4_get_int_pin (stepper4_t *ctx)
 Stepper 4 get int pin function.
 
void stepper4_set_step_pin (stepper4_t *ctx, uint8_t state)
 Stepper 4 set step pin function.
 

Detailed Description

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

◆ stepper4_cfg_setup()

void stepper4_cfg_setup ( stepper4_cfg_t * cfg)

Stepper 4 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper4_default_cfg()

void stepper4_default_cfg ( stepper4_t * ctx)

Stepper 4 default configuration function.

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

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

◆ stepper4_disable_device()

void stepper4_disable_device ( stepper4_t * ctx)

Stepper 4 disable device function.

This function disables the device by setting the EN pin to low logic state.

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

◆ stepper4_drive_motor()

void stepper4_drive_motor ( stepper4_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 4 drive motor function.

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

Parameters
[in]ctx: Click context object. See stepper4_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.

◆ stepper4_enable_device()

void stepper4_enable_device ( stepper4_t * ctx)

Stepper 4 enable device function.

This function enables the device by setting the EN pin to high logic state.

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

◆ stepper4_get_int_pin()

uint8_t stepper4_get_int_pin ( stepper4_t * ctx)

Stepper 4 get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See stepper4_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ stepper4_init()

err_t stepper4_init ( stepper4_t * ctx,
stepper4_cfg_t * cfg )

Stepper 4 initialization function.

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

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

◆ stepper4_reset_device()

void stepper4_reset_device ( stepper4_t * ctx)

Stepper 4 reset device function.

This function resets the device by toggling the RST pin.

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

◆ stepper4_set_direction()

void stepper4_set_direction ( stepper4_t * ctx,
uint8_t dir )

Stepper 4 set direction function.

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

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

◆ stepper4_set_step_pin()

void stepper4_set_step_pin ( stepper4_t * ctx,
uint8_t state )

Stepper 4 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper4_switch_direction()

void stepper4_switch_direction ( stepper4_t * ctx)

Stepper 4 switch direction function.

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

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