stepper10 2.1.0.0
Stepper 10 Click Driver

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

Topics

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

Functions

void stepper10_cfg_setup (stepper10_cfg_t *cfg)
 Stepper 10 configuration object setup function.
 
err_t stepper10_init (stepper10_t *ctx, stepper10_cfg_t *cfg)
 Stepper 10 initialization function.
 
err_t stepper10_default_cfg (stepper10_t *ctx)
 Stepper 10 default configuration function.
 
err_t stepper10_write_spi_bank0 (stepper10_t *ctx, uint32_t data_in)
 Stepper 10 write spi bank0 function.
 
err_t stepper10_write_spi_bank1 (stepper10_t *ctx, uint32_t data_in)
 Stepper 10 write spi bank1 function.
 
err_t stepper10_tca_write_reg (stepper10_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 10 tca write reg function.
 
err_t stepper10_tca_read_reg (stepper10_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 10 tca read reg function.
 
err_t stepper10_get_step_mode (stepper10_t *ctx, uint8_t *mode)
 Stepper 10 get step mode function.
 
err_t stepper10_set_step_mode (stepper10_t *ctx, uint8_t mode)
 Stepper 10 set step mode function.
 
err_t stepper10_get_sleep_pin (stepper10_t *ctx, uint8_t *state)
 Stepper 10 get sleep pin function.
 
err_t stepper10_set_sleep_pin (stepper10_t *ctx, uint8_t state)
 Stepper 10 set sleep pin function.
 
err_t stepper10_get_mixed_decay (stepper10_t *ctx, uint8_t *mode)
 Stepper 10 get mixed decay function.
 
err_t stepper10_set_mixed_decay (stepper10_t *ctx, uint8_t mode)
 Stepper 10 set mixed decay function.
 
err_t stepper10_get_agc_pin (stepper10_t *ctx, uint8_t *state)
 Stepper 10 get agc pin function.
 
err_t stepper10_set_agc_pin (stepper10_t *ctx, uint8_t state)
 Stepper 10 set agc pin function.
 
err_t stepper10_select_gpio (stepper10_t *ctx)
 Stepper 10 select GPIO function.
 
err_t stepper10_select_spi (stepper10_t *ctx)
 Stepper 10 select SPI function.
 
err_t stepper10_get_torque (stepper10_t *ctx, uint8_t *mode)
 Stepper 10 get torque function.
 
err_t stepper10_set_torque (stepper10_t *ctx, uint8_t mode)
 Stepper 10 set torque function.
 
err_t stepper10_get_clim0_pin (stepper10_t *ctx, uint8_t *state)
 Stepper 10 get clim0 pin function.
 
err_t stepper10_set_clim0_pin (stepper10_t *ctx, uint8_t state)
 Stepper 10 set clim0 pin function.
 
err_t stepper10_get_edg_sel_pin (stepper10_t *ctx, uint8_t *state)
 Stepper 10 get edg_sel pin function.
 
err_t stepper10_set_edg_sel_pin (stepper10_t *ctx, uint8_t state)
 Stepper 10 set edg_sel pin function.
 
err_t stepper10_get_mo_pin (stepper10_t *ctx, uint8_t *state)
 Stepper 10 get mo pin function.
 
err_t stepper10_get_lo_state (stepper10_t *ctx, uint8_t *state)
 Stepper 10 get LO function.
 
void stepper10_enable_device (stepper10_t *ctx)
 Stepper 10 enable device function.
 
void stepper10_disable_device (stepper10_t *ctx)
 Stepper 10 disable device function.
 
uint8_t stepper10_get_int_pin (stepper10_t *ctx)
 Stepper 10 get INT pin function.
 
void stepper10_set_direction (stepper10_t *ctx, uint8_t dir)
 Stepper 10 set direction function.
 
void stepper10_set_rst_pin (stepper10_t *ctx, uint8_t state)
 Stepper 10 set rst pin function.
 
void stepper10_reset_device (stepper10_t *ctx)
 Stepper 10 reset device function.
 
void stepper10_set_step_pin (stepper10_t *ctx, uint8_t state)
 Stepper 10 set step pin function.
 
err_t stepper10_drive_motor (stepper10_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 10 driver motor function.
 

Detailed Description

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

◆ stepper10_cfg_setup()

void stepper10_cfg_setup ( stepper10_cfg_t * cfg)

Stepper 10 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper10_default_cfg()

err_t stepper10_default_cfg ( stepper10_t * ctx)

Stepper 10 default configuration function.

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

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

◆ stepper10_disable_device()

void stepper10_disable_device ( stepper10_t * ctx)

Stepper 10 disable device function.

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

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

◆ stepper10_drive_motor()

err_t stepper10_drive_motor ( stepper10_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 10 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 stepper10_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.

◆ stepper10_enable_device()

void stepper10_enable_device ( stepper10_t * ctx)

Stepper 10 enable device function.

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

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

◆ stepper10_get_agc_pin()

err_t stepper10_get_agc_pin ( stepper10_t * ctx,
uint8_t * state )

Stepper 10 get agc pin function.

This function reads the agc pin logic state.

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

◆ stepper10_get_clim0_pin()

err_t stepper10_get_clim0_pin ( stepper10_t * ctx,
uint8_t * state )

Stepper 10 get clim0 pin function.

This function reads the CLIM0 pin logic state.

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

◆ stepper10_get_edg_sel_pin()

err_t stepper10_get_edg_sel_pin ( stepper10_t * ctx,
uint8_t * state )

Stepper 10 get edg_sel pin function.

This function reads the EDG_SEL pin logic state.

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

◆ stepper10_get_int_pin()

uint8_t stepper10_get_int_pin ( stepper10_t * ctx)

Stepper 10 get INT pin function.

This function returns the INT pin logic state.

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

◆ stepper10_get_lo_state()

err_t stepper10_get_lo_state ( stepper10_t * ctx,
uint8_t * state )

Stepper 10 get LO function.

This function reads the LO error detect flag state.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[out]state: LO error detect flag:
  • 0 - Detected thermal shutdown (TSD),
  • 1 - Detected motor load open (OPD),
  • 2 - Detected over current (ISD),
  • 3 - Normal status (Normal operation).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper10_get_mixed_decay()

err_t stepper10_get_mixed_decay ( stepper10_t * ctx,
uint8_t * mode )

Stepper 10 get mixed decay function.

This function reads the mixed decay settings.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[out]mode: Mixed decay mode:
  • 0 - Fast Decay: 37.5% (Fast Decay = OSCM � 6),
  • 1 - Fast Decay: 50% (Fast Decay = OSCM � 8),
  • 2 - Fast Decay only,
  • 3 - ADMD.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper10_get_mo_pin()

err_t stepper10_get_mo_pin ( stepper10_t * ctx,
uint8_t * state )

Stepper 10 get mo pin function.

This function reads the MO pin logic state.

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

◆ stepper10_get_sleep_pin()

err_t stepper10_get_sleep_pin ( stepper10_t * ctx,
uint8_t * state )

Stepper 10 get sleep pin function.

This function reads the sleep pin logic state.

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

◆ stepper10_get_step_mode()

err_t stepper10_get_step_mode ( stepper10_t * ctx,
uint8_t * mode )

Stepper 10 get step mode function.

This function reads the step mode resolution settings.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[out]mode: Step mode resolution:
  • 0 - Full step resolution (2-phase excitation),
  • 1 - 1/2 step resolution (1-2-phase excitation),
  • 2 - 1/4 step resolution (W1-2-phase excitation),
  • 3 - 1/8 step resolution (2W1-2-phase excitation),
  • 4 - 1/16 step resolution (4W1-2-phase excitation),
  • 5 - 1/32 step resolution (8W1-2-phase excitation),
  • 6 - 1/64 step resolution (16W1-2-phase excitation),
  • 7 - 1/128 step resolution (32W1-2-phase excitation).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper10_get_torque()

err_t stepper10_get_torque ( stepper10_t * ctx,
uint8_t * mode )

Stepper 10 get torque function.

This function reads the torque mode settings.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[out]mode: Torque settings:
  • 0 - 100%,
  • 1 - 85%,
  • 2 - 70%,
  • 3 - 60%,
  • 4 - 50%,
  • 5 - 40%,
  • 6 - 25%,
  • 7 - 10%.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper10_init()

err_t stepper10_init ( stepper10_t * ctx,
stepper10_cfg_t * cfg )

Stepper 10 initialization function.

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

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

◆ stepper10_reset_device()

void stepper10_reset_device ( stepper10_t * ctx)

Stepper 10 reset device function.

This function resets the device by toggling the RST pin.

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

◆ stepper10_select_gpio()

err_t stepper10_select_gpio ( stepper10_t * ctx)

Stepper 10 select GPIO function.

This function selects GPIO communication by setting the IF_SEL pin to low logic state.

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

◆ stepper10_select_spi()

err_t stepper10_select_spi ( stepper10_t * ctx)

Stepper 10 select SPI function.

This function selects SPI communication by setting the IF_SEL pin to high logic state.

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

◆ stepper10_set_agc_pin()

err_t stepper10_set_agc_pin ( stepper10_t * ctx,
uint8_t state )

Stepper 10 set agc pin function.

This function sets the agc pin logic state.

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

◆ stepper10_set_clim0_pin()

err_t stepper10_set_clim0_pin ( stepper10_t * ctx,
uint8_t state )

Stepper 10 set clim0 pin function.

This function sets the CLIM0 pin logic state.

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

◆ stepper10_set_direction()

void stepper10_set_direction ( stepper10_t * ctx,
uint8_t dir )

Stepper 10 set direction function.

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

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

◆ stepper10_set_edg_sel_pin()

err_t stepper10_set_edg_sel_pin ( stepper10_t * ctx,
uint8_t state )

Stepper 10 set edg_sel pin function.

This function sets the EDG_SEL pin logic state.

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

◆ stepper10_set_mixed_decay()

err_t stepper10_set_mixed_decay ( stepper10_t * ctx,
uint8_t mode )

Stepper 10 set mixed decay function.

This function sets the mixed decay settings.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[in]mode: Mixed decay mode:
  • 0 - Fast Decay: 37.5% (Fast Decay = OSCM � 6),
  • 1 - Fast Decay: 50% (Fast Decay = OSCM � 8),
  • 2 - Fast Decay only,
  • 3 - ADMD.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper10_set_rst_pin()

void stepper10_set_rst_pin ( stepper10_t * ctx,
uint8_t state )

Stepper 10 set rst pin function.

This function sets the RST pin logic state.

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

◆ stepper10_set_sleep_pin()

err_t stepper10_set_sleep_pin ( stepper10_t * ctx,
uint8_t state )

Stepper 10 set sleep pin function.

This function sets the sleep pin logic state.

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

◆ stepper10_set_step_mode()

err_t stepper10_set_step_mode ( stepper10_t * ctx,
uint8_t mode )

Stepper 10 set step mode function.

This function sets the step mode resolution settings.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[in]mode: Step mode resolution:
  • 0 - Full step resolution (2-phase excitation),
  • 1 - 1/2 step resolution (1-2-phase excitation),
  • 2 - 1/4 step resolution (W1-2-phase excitation),
  • 3 - 1/8 step resolution (2W1-2-phase excitation),
  • 4 - 1/16 step resolution (4W1-2-phase excitation),
  • 5 - 1/32 step resolution (8W1-2-phase excitation),
  • 6 - 1/64 step resolution (16W1-2-phase excitation),
  • 7 - 1/128 step resolution (32W1-2-phase excitation).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper10_set_step_pin()

void stepper10_set_step_pin ( stepper10_t * ctx,
uint8_t state )

Stepper 10 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper10_set_torque()

err_t stepper10_set_torque ( stepper10_t * ctx,
uint8_t mode )

Stepper 10 set torque function.

This function sets the torque mode settings.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[in]mode: Torque settings:
  • 0 - 100%,
  • 1 - 85%,
  • 2 - 70%,
  • 3 - 60%,
  • 4 - 50%,
  • 5 - 40%,
  • 6 - 25%,
  • 7 - 10%.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper10_tca_read_reg()

err_t stepper10_tca_read_reg ( stepper10_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 10 tca read reg function.

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

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

◆ stepper10_tca_write_reg()

err_t stepper10_tca_write_reg ( stepper10_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 10 tca write reg function.

This function writes a desired data byte to the selected TCA9534A register by using I2C serial interface.

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

◆ stepper10_write_spi_bank0()

err_t stepper10_write_spi_bank0 ( stepper10_t * ctx,
uint32_t data_in )

Stepper 10 write spi bank0 function.

This function writes a 32-bit command to BANK0 by using SPI serial interface.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[in]data_in: 32-bit SPI data command, D0-D31, where D0 is a MSB.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The stepper10_select_spi command needs to be called before this function call.

◆ stepper10_write_spi_bank1()

err_t stepper10_write_spi_bank1 ( stepper10_t * ctx,
uint32_t data_in )

Stepper 10 write spi bank1 function.

This function writes a 32-bit command to BANK1 by using SPI serial interface.

Parameters
[in]ctx: Click context object. See stepper10_t object definition for detailed explanation.
[in]data_in: 32-bit SPI data command, D0-D31, where D0 is a MSB.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The stepper10_select_spi command needs to be called before this function call.