silentstep3 2.1.0.0
Silent Step 3 Click Driver

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

Topics

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

Functions

void silentstep3_cfg_setup (silentstep3_cfg_t *cfg)
 Silent Step 3 configuration object setup function.
 
err_t silentstep3_init (silentstep3_t *ctx, silentstep3_cfg_t *cfg)
 Silent Step 3 initialization function.
 
err_t silentstep3_default_cfg (silentstep3_t *ctx)
 Silent Step 3 default configuration function.
 
err_t silentstep3_write_register (silentstep3_t *ctx, uint8_t reg, uint32_t data_in, uint32_t *data_out)
 Silent Step 3 write command function.
 
err_t silentstep3_set_step_mode (silentstep3_t *ctx, uint8_t mode)
 Silent Step 3 set step mode function.
 
void silentstep3_enable_device (silentstep3_t *ctx)
 Silent Step 3 enable device function.
 
void silentstep3_disable_device (silentstep3_t *ctx)
 Silent Step 3 disable device function.
 
void silentstep3_set_direction (silentstep3_t *ctx, uint8_t dir)
 Silent Step 3 set direction function.
 
void silentstep3_switch_direction (silentstep3_t *ctx)
 Silent Step 3 switch direction function.
 
void silentstep3_set_step_pin (silentstep3_t *ctx, uint8_t state)
 Silent Step 3 set step pin function.
 
uint8_t silentstep3_get_sg_pin (silentstep3_t *ctx)
 Silent Step 3 get sg pin function.
 
void silentstep3_drive_motor (silentstep3_t *ctx, uint32_t steps, uint8_t speed)
 Silent Step 3 driver motor function.
 

Detailed Description

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

◆ silentstep3_cfg_setup()

void silentstep3_cfg_setup ( silentstep3_cfg_t * cfg)

Silent Step 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ silentstep3_default_cfg()

err_t silentstep3_default_cfg ( silentstep3_t * ctx)

Silent Step 3 default configuration function.

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

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

◆ silentstep3_disable_device()

void silentstep3_disable_device ( silentstep3_t * ctx)

Silent Step 3 disable device function.

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

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

◆ silentstep3_drive_motor()

void silentstep3_drive_motor ( silentstep3_t * ctx,
uint32_t steps,
uint8_t speed )

Silent Step 3 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 silentstep3_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.

◆ silentstep3_enable_device()

void silentstep3_enable_device ( silentstep3_t * ctx)

Silent Step 3 enable device function.

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

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

◆ silentstep3_get_sg_pin()

uint8_t silentstep3_get_sg_pin ( silentstep3_t * ctx)

Silent Step 3 get sg pin function.

This function returns the SG pin logic state.

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

◆ silentstep3_init()

err_t silentstep3_init ( silentstep3_t * ctx,
silentstep3_cfg_t * cfg )

Silent Step 3 initialization function.

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

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

◆ silentstep3_set_direction()

void silentstep3_set_direction ( silentstep3_t * ctx,
uint8_t dir )

Silent Step 3 set direction function.

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

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

◆ silentstep3_set_step_mode()

err_t silentstep3_set_step_mode ( silentstep3_t * ctx,
uint8_t mode )

Silent Step 3 set step mode function.

This function sets the microstep resolution bits in DRVCTRL register.

Parameters
[in]ctx: Click context object. See silentstep3_t object definition for detailed explanation.
[in]mode: MODE 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.

◆ silentstep3_set_step_pin()

void silentstep3_set_step_pin ( silentstep3_t * ctx,
uint8_t state )

Silent Step 3 set step pin function.

This function sets the STEP pin logic state.

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

◆ silentstep3_switch_direction()

void silentstep3_switch_direction ( silentstep3_t * ctx)

Silent Step 3 switch direction function.

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

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

◆ silentstep3_write_register()

err_t silentstep3_write_register ( silentstep3_t * ctx,
uint8_t reg,
uint32_t data_in,
uint32_t * data_out )

Silent Step 3 write command function.

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

Parameters
[in]ctx: Click context object. See silentstep3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: 18-bit data to be written.
[out]data_out: 20-bit response data (Optional).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.