stepper7 2.1.0.0
Stepper 7 Click Driver

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

Topics

 Stepper 7 Registers List
 List of registers of Stepper 7 Click driver.
 
 Stepper 7 Registers Settings
 Settings for registers of Stepper 7 Click driver.
 
 Stepper 7 MikroBUS Map
 MikroBUS pin mapping of Stepper 7 Click driver.
 

Functions

void stepper7_cfg_setup (stepper7_cfg_t *cfg)
 Stepper 7 configuration object setup function.
 
err_t stepper7_init (stepper7_t *ctx, stepper7_cfg_t *cfg)
 Stepper 7 initialization function.
 
err_t stepper7_default_cfg (stepper7_t *ctx)
 Stepper 7 default configuration function.
 
err_t stepper7_write_reg (stepper7_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 7 write reg function.
 
err_t stepper7_read_reg (stepper7_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 7 read reg function.
 
void stepper7_set_rst_pin (stepper7_t *ctx, uint8_t state)
 Stepper 7 set rst pin function.
 
void stepper7_reset_device (stepper7_t *ctx)
 Stepper 7 reset device function.
 
err_t stepper7_set_phase2_pin (stepper7_t *ctx, uint8_t state)
 Stepper 7 set PHASE2 pin function.
 
err_t stepper7_set_phase1_pin (stepper7_t *ctx, uint8_t state)
 Stepper 7 set PHASE1 pin function.
 
err_t stepper7_set_i12_pin (stepper7_t *ctx, uint8_t state)
 Stepper 7 set I12 pin function.
 
err_t stepper7_set_i02_pin (stepper7_t *ctx, uint8_t state)
 Stepper 7 set I02 pin function.
 
err_t stepper7_set_i11_pin (stepper7_t *ctx, uint8_t state)
 Stepper 7 set I11 pin function.
 
err_t stepper7_set_i01_pin (stepper7_t *ctx, uint8_t state)
 Stepper 7 set I01 pin function.
 
err_t stepper7_enable_device (stepper7_t *ctx)
 Stepper 7 enable device function.
 
err_t stepper7_disable_device (stepper7_t *ctx)
 Stepper 7 disable device function.
 
void stepper7_set_step_mode (stepper7_t *ctx, uint8_t mode)
 Stepper 7 set step mode function.
 
void stepper7_set_direction (stepper7_t *ctx, uint8_t dir)
 Stepper 7 set direction function.
 
void stepper7_switch_direction (stepper7_t *ctx)
 Stepper 7 switch direction function.
 
err_t stepper7_drive_motor (stepper7_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 7 driver motor function.
 

Detailed Description

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

◆ stepper7_cfg_setup()

void stepper7_cfg_setup ( stepper7_cfg_t * cfg)

Stepper 7 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper7_default_cfg()

err_t stepper7_default_cfg ( stepper7_t * ctx)

Stepper 7 default configuration function.

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

Parameters
[in]ctx: Click context object. See stepper7_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ stepper7_disable_device()

err_t stepper7_disable_device ( stepper7_t * ctx)

Stepper 7 disable device function.

This function disables the device by setting all pins to high logic state.

Parameters
[in]ctx: Click context object. See stepper7_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper7_drive_motor()

err_t stepper7_drive_motor ( stepper7_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 7 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 stepper7_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
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper7_enable_device()

err_t stepper7_enable_device ( stepper7_t * ctx)

Stepper 7 enable device function.

This function enables the device by setting all pins to low logic state.

Parameters
[in]ctx: Click context object. See stepper7_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper7_init()

err_t stepper7_init ( stepper7_t * ctx,
stepper7_cfg_t * cfg )

Stepper 7 initialization function.

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

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

◆ stepper7_read_reg()

err_t stepper7_read_reg ( stepper7_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 7 read reg function.

This function reads data from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See stepper7_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper7_reset_device()

void stepper7_reset_device ( stepper7_t * ctx)

Stepper 7 reset device function.

This function resets the device by toggling the RST pin.

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

◆ stepper7_set_direction()

void stepper7_set_direction ( stepper7_t * ctx,
uint8_t dir )

Stepper 7 set direction function.

This function sets the motor direction to clockwise or counter-clockwise in ctx->direction.

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

◆ stepper7_set_i01_pin()

err_t stepper7_set_i01_pin ( stepper7_t * ctx,
uint8_t state )

Stepper 7 set I01 pin function.

This function sets the I01 pin logic state.

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

◆ stepper7_set_i02_pin()

err_t stepper7_set_i02_pin ( stepper7_t * ctx,
uint8_t state )

Stepper 7 set I02 pin function.

This function sets the I02 pin logic state.

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

◆ stepper7_set_i11_pin()

err_t stepper7_set_i11_pin ( stepper7_t * ctx,
uint8_t state )

Stepper 7 set I11 pin function.

This function sets the I11 pin logic state.

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

◆ stepper7_set_i12_pin()

err_t stepper7_set_i12_pin ( stepper7_t * ctx,
uint8_t state )

Stepper 7 set I12 pin function.

This function sets the I12 pin logic state.

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

◆ stepper7_set_phase1_pin()

err_t stepper7_set_phase1_pin ( stepper7_t * ctx,
uint8_t state )

Stepper 7 set PHASE1 pin function.

This function sets the PHASE1 pin logic state.

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

◆ stepper7_set_phase2_pin()

err_t stepper7_set_phase2_pin ( stepper7_t * ctx,
uint8_t state )

Stepper 7 set PHASE2 pin function.

This function sets the PHASE2 pin logic state.

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

◆ stepper7_set_rst_pin()

void stepper7_set_rst_pin ( stepper7_t * ctx,
uint8_t state )

Stepper 7 set rst pin function.

This function sets the RST pin logic state.

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

◆ stepper7_set_step_mode()

void stepper7_set_step_mode ( stepper7_t * ctx,
uint8_t mode )

Stepper 7 set step mode function.

This function sets the step mode resolution settings in ctx->step_mode.

Parameters
[in]ctx: Click context object. See stepper7_t object definition for detailed explanation.
[in]mode: Step mode resolution.
  • 0 - Full step,
  • 1 - Half step,
  • 2 - 1/8th step.
Returns
None.
Note
None.

◆ stepper7_switch_direction()

void stepper7_switch_direction ( stepper7_t * ctx)

Stepper 7 switch direction function.

This function switches the motor direction in ctx->direction.

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

◆ stepper7_write_reg()

err_t stepper7_write_reg ( stepper7_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 7 write reg function.

This function writes data to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See stepper7_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.