silentstep 2.1.0.0
Silent Step Click Driver

API for configuring and manipulating Silent Step Click driver. More...

Topics

 Silent Step Registers List
 List of registers of Silent Step Click driver.
 
 Silent Step Registers Settings
 Settings for registers of Silent Step Click driver.
 
 Silent Step MikroBUS Map
 MikroBUS pin mapping of Silent Step Click driver.
 

Functions

void silentstep_cfg_setup (silentstep_cfg_t *cfg)
 Silent Step configuration object setup function.
 
err_t silentstep_init (silentstep_t *ctx, silentstep_cfg_t *cfg)
 Silent Step initialization function.
 
err_t silentstep_default_cfg (silentstep_t *ctx)
 Silent Step default configuration function.
 
err_t silentstep_write_reg (silentstep_t *ctx, uint8_t reg, uint32_t data_in)
 Silent Step write reg function.
 
err_t silentstep_read_reg (silentstep_t *ctx, uint8_t reg, uint32_t *data_out)
 Silent Step read reg function.
 
err_t silentstep_check_com (silentstep_t *ctx)
 Silent Step check com function.
 
void silentstep_set_direction (silentstep_t *ctx, uint8_t dir)
 Silent Step set direction function.
 
void silentstep_switch_direction (silentstep_t *ctx)
 Silent Step switch direction function.
 
void silentstep_set_spm_pin (silentstep_t *ctx, uint8_t state)
 Silent Step set spm pin function.
 
void silentstep_set_sdm_pin (silentstep_t *ctx, uint8_t state)
 Silent Step set sdm pin function.
 
void silentstep_set_step_pin (silentstep_t *ctx, uint8_t state)
 Silent Step set step pin function.
 
err_t silentstep_set_toff (silentstep_t *ctx, uint8_t toff)
 Silent Step set toff function.
 
err_t silentstep_set_step_res (silentstep_t *ctx, uint8_t mres)
 Silent Step set step res function.
 
err_t silentstep_set_run_current (silentstep_t *ctx, uint8_t irun)
 Silent Step set run current function.
 
void silentstep_drive_motor (silentstep_t *ctx, uint32_t steps, uint8_t speed)
 Silent Step driver motor function.
 

Detailed Description

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

◆ silentstep_cfg_setup()

void silentstep_cfg_setup ( silentstep_cfg_t * cfg)

Silent Step configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ silentstep_check_com()

err_t silentstep_check_com ( silentstep_t * ctx)

Silent Step check com function.

This function checks the SPI communication by reading and verifying the device version.

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

◆ silentstep_default_cfg()

err_t silentstep_default_cfg ( silentstep_t * ctx)

Silent Step default configuration function.

This function executes a default configuration of Silent Step click board.

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

◆ silentstep_drive_motor()

void silentstep_drive_motor ( silentstep_t * ctx,
uint32_t steps,
uint8_t speed )

Silent Step 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 silentstep_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.

◆ silentstep_init()

err_t silentstep_init ( silentstep_t * ctx,
silentstep_cfg_t * cfg )

Silent Step initialization function.

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

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

◆ silentstep_read_reg()

err_t silentstep_read_reg ( silentstep_t * ctx,
uint8_t reg,
uint32_t * data_out )

Silent Step read reg function.

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

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

◆ silentstep_set_direction()

void silentstep_set_direction ( silentstep_t * ctx,
uint8_t dir )

Silent Step set direction function.

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

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

◆ silentstep_set_run_current()

err_t silentstep_set_run_current ( silentstep_t * ctx,
uint8_t irun )

Silent Step set run current function.

This function sets the motor run current bits in IHOLD_IRUN register.

Parameters
[in]ctx: Click context object. See silentstep_t object definition for detailed explanation.
[in]irun: IRUN bits setting [0-31].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ silentstep_set_sdm_pin()

void silentstep_set_sdm_pin ( silentstep_t * ctx,
uint8_t state )

Silent Step set sdm pin function.

This function sets the SDM pin logic state.

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

◆ silentstep_set_spm_pin()

void silentstep_set_spm_pin ( silentstep_t * ctx,
uint8_t state )

Silent Step set spm pin function.

This function sets the SPM pin logic state.

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

◆ silentstep_set_step_pin()

void silentstep_set_step_pin ( silentstep_t * ctx,
uint8_t state )

Silent Step set step pin function.

This function sets the STEP pin logic state.

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

◆ silentstep_set_step_res()

err_t silentstep_set_step_res ( silentstep_t * ctx,
uint8_t mres )

Silent Step set step res function.

This function sets the microstep resolution bits in CHOPCONF register.

Parameters
[in]ctx: Click context object. See silentstep_t object definition for detailed explanation.
[in]mres: MRES bits setting:
  • 0 - 1/256 microsteps,
  • 1 - 1/128 microsteps,
  • 2 - 1/64 microsteps,
  • 3 - 1/32 microsteps,
  • 4 - 1/16 microsteps,
  • 5 - 1/8 microsteps,
  • 6 - quarter step,
  • 7 - half step,
  • 8 - full step.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ silentstep_set_toff()

err_t silentstep_set_toff ( silentstep_t * ctx,
uint8_t toff )

Silent Step set toff function.

This function sets the off time and driver enable bits in CHOPCONF register.

Parameters
[in]ctx: Click context object. See silentstep_t object definition for detailed explanation.
[in]toff: TOFF bits setting [0-15].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ silentstep_switch_direction()

void silentstep_switch_direction ( silentstep_t * ctx)

Silent Step switch direction function.

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

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

◆ silentstep_write_reg()

err_t silentstep_write_reg ( silentstep_t * ctx,
uint8_t reg,
uint32_t data_in )

Silent Step write reg function.

This function writes a desired 32-bit data to the selected register by using SPI serial interface.

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