stepper5 2.1.0.0
Stepper 5 Click Driver

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

Topics

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

Functions

void stepper5_cfg_setup (stepper5_cfg_t *cfg)
 Stepper 5 configuration object setup function.
 
err_t stepper5_init (stepper5_t *ctx, stepper5_cfg_t *cfg)
 Stepper 5 initialization function.
 
err_t stepper5_default_cfg (stepper5_t *ctx)
 Stepper 5 default configuration function.
 
void stepper5_write_reg (stepper5_t *ctx, uint8_t reg, uint32_t data_in)
 Stepper 5 write reg function.
 
err_t stepper5_read_reg (stepper5_t *ctx, uint8_t reg, uint32_t *data_out)
 Stepper 5 read reg function.
 
err_t stepper5_check_com (stepper5_t *ctx)
 Stepper 5 check com function.
 
void stepper5_enable_device (stepper5_t *ctx)
 Stepper 5 enable device function.
 
void stepper5_disable_device (stepper5_t *ctx)
 Stepper 5 disable device function.
 
void stepper5_set_direction (stepper5_t *ctx, uint8_t dir)
 Stepper 5 set direction function.
 
void stepper5_switch_direction (stepper5_t *ctx)
 Stepper 5 switch direction function.
 
void stepper5_set_step_pin (stepper5_t *ctx, uint8_t state)
 Stepper 5 set step pin function.
 
uint8_t stepper5_get_diag_pin (stepper5_t *ctx)
 Stepper 5 get diag pin function.
 
uint8_t stepper5_get_index_pin (stepper5_t *ctx)
 Stepper 5 get index pin function.
 
err_t stepper5_set_toff (stepper5_t *ctx, uint8_t toff)
 Stepper 5 set toff function.
 
err_t stepper5_set_step_res (stepper5_t *ctx, uint8_t mres)
 Stepper 5 set step res function.
 
err_t stepper5_set_run_current (stepper5_t *ctx, uint8_t irun)
 Stepper 5 set run current function.
 
void stepper5_drive_motor (stepper5_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 5 driver motor function.
 

Detailed Description

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

◆ stepper5_cfg_setup()

void stepper5_cfg_setup ( stepper5_cfg_t * cfg)

Stepper 5 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper5_check_com()

err_t stepper5_check_com ( stepper5_t * ctx)

Stepper 5 check com function.

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

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

◆ stepper5_default_cfg()

err_t stepper5_default_cfg ( stepper5_t * ctx)

Stepper 5 default configuration function.

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

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

◆ stepper5_disable_device()

void stepper5_disable_device ( stepper5_t * ctx)

Stepper 5 disable device function.

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

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

◆ stepper5_drive_motor()

void stepper5_drive_motor ( stepper5_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 5 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 stepper5_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.

◆ stepper5_enable_device()

void stepper5_enable_device ( stepper5_t * ctx)

Stepper 5 enable device function.

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

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

◆ stepper5_get_diag_pin()

uint8_t stepper5_get_diag_pin ( stepper5_t * ctx)

Stepper 5 get diag pin function.

This function returns the DIAG pin logic state.

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

◆ stepper5_get_index_pin()

uint8_t stepper5_get_index_pin ( stepper5_t * ctx)

Stepper 5 get index pin function.

This function returns the INDEX pin logic state.

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

◆ stepper5_init()

err_t stepper5_init ( stepper5_t * ctx,
stepper5_cfg_t * cfg )

Stepper 5 initialization function.

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

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

◆ stepper5_read_reg()

err_t stepper5_read_reg ( stepper5_t * ctx,
uint8_t reg,
uint32_t * data_out )

Stepper 5 read reg function.

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

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

◆ stepper5_set_direction()

void stepper5_set_direction ( stepper5_t * ctx,
uint8_t dir )

Stepper 5 set direction function.

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

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

◆ stepper5_set_run_current()

err_t stepper5_set_run_current ( stepper5_t * ctx,
uint8_t irun )

Stepper 5 set run current function.

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

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

◆ stepper5_set_step_pin()

void stepper5_set_step_pin ( stepper5_t * ctx,
uint8_t state )

Stepper 5 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper5_set_step_res()

err_t stepper5_set_step_res ( stepper5_t * ctx,
uint8_t mres )

Stepper 5 set step res function.

This function sets the microstep resolution bits in CHOPCONF register.

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

◆ stepper5_set_toff()

err_t stepper5_set_toff ( stepper5_t * ctx,
uint8_t toff )

Stepper 5 set toff function.

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

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

◆ stepper5_switch_direction()

void stepper5_switch_direction ( stepper5_t * ctx)

Stepper 5 switch direction function.

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

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

◆ stepper5_write_reg()

void stepper5_write_reg ( stepper5_t * ctx,
uint8_t reg,
uint32_t data_in )

Stepper 5 write reg function.

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

Parameters
[in]ctx: Click context object. See stepper5_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: 32-bit data to be written.
Returns
None.
Note
None.