stepper8 2.1.0.0
Stepper 8 Click Driver

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

Topics

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

Functions

void stepper8_cfg_setup (stepper8_cfg_t *cfg)
 Stepper 8 configuration object setup function.
 
err_t stepper8_init (stepper8_t *ctx, stepper8_cfg_t *cfg)
 Stepper 8 initialization function.
 
err_t stepper8_default_cfg (stepper8_t *ctx)
 Stepper 8 default configuration function.
 
err_t stepper8_write_spi (stepper8_t *ctx, uint32_t data_in)
 Stepper 8 write spi function.
 
err_t stepper8_pca_write_reg (stepper8_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 8 pca write reg function.
 
err_t stepper8_pca_read_reg (stepper8_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 8 pca read reg function.
 
err_t stepper8_enable_standby (stepper8_t *ctx)
 Stepper 8 enable standby function.
 
err_t stepper8_disable_standby (stepper8_t *ctx)
 Stepper 8 disable standby function.
 
err_t stepper8_select_gpio (stepper8_t *ctx)
 Stepper 8 select GPIO function.
 
err_t stepper8_select_spi (stepper8_t *ctx)
 Stepper 8 select SPI function.
 
err_t stepper8_disable_device (stepper8_t *ctx)
 Stepper 8 disable device function.
 
err_t stepper8_enable_device (stepper8_t *ctx)
 Stepper 8 enable device function.
 
void stepper8_set_md0_pin (stepper8_t *ctx, uint8_t state)
 Stepper 8 set MD0 pin function.
 
void stepper8_set_md1_pin (stepper8_t *ctx, uint8_t state)
 Stepper 8 set MD1 pin function.
 
void stepper8_set_md2_pin (stepper8_t *ctx, uint8_t state)
 Stepper 8 set MD2 pin function.
 
void stepper8_set_md3_pin (stepper8_t *ctx, uint8_t state)
 Stepper 8 set MD3 pin function.
 
uint8_t stepper8_get_err_pin (stepper8_t *ctx)
 Stepper 8 get ERR pin function.
 
void stepper8_set_direction (stepper8_t *ctx, uint8_t dir)
 Stepper 8 set direction function.
 
void stepper8_set_rst_pin (stepper8_t *ctx, uint8_t state)
 Stepper 8 set rst pin function.
 
void stepper8_set_step_pin (stepper8_t *ctx, uint8_t state)
 Stepper 8 set step pin function.
 
err_t stepper8_set_step_mode (stepper8_t *ctx, uint8_t mode)
 Stepper 8 set step mode function.
 
err_t stepper8_drive_motor (stepper8_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 8 driver motor function.
 

Detailed Description

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

◆ stepper8_cfg_setup()

void stepper8_cfg_setup ( stepper8_cfg_t * cfg)

Stepper 8 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper8_default_cfg()

err_t stepper8_default_cfg ( stepper8_t * ctx)

Stepper 8 default configuration function.

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

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

◆ stepper8_disable_device()

err_t stepper8_disable_device ( stepper8_t * ctx)

Stepper 8 disable device function.

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

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

◆ stepper8_disable_standby()

err_t stepper8_disable_standby ( stepper8_t * ctx)

Stepper 8 disable standby function.

This function disables the standby by setting the STBY pin to high logic state.

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

◆ stepper8_drive_motor()

err_t stepper8_drive_motor ( stepper8_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 8 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 stepper8_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.

◆ stepper8_enable_device()

err_t stepper8_enable_device ( stepper8_t * ctx)

Stepper 8 enable device function.

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

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

◆ stepper8_enable_standby()

err_t stepper8_enable_standby ( stepper8_t * ctx)

Stepper 8 enable standby function.

This function enables the standby by setting the STBY pin to low logic state.

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

◆ stepper8_get_err_pin()

uint8_t stepper8_get_err_pin ( stepper8_t * ctx)

Stepper 8 get ERR pin function.

This function returns the ERR pin logic state.

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

◆ stepper8_init()

err_t stepper8_init ( stepper8_t * ctx,
stepper8_cfg_t * cfg )

Stepper 8 initialization function.

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

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

◆ stepper8_pca_read_reg()

err_t stepper8_pca_read_reg ( stepper8_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 8 pca read reg function.

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

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

◆ stepper8_pca_write_reg()

err_t stepper8_pca_write_reg ( stepper8_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 8 pca write reg function.

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

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

◆ stepper8_select_gpio()

err_t stepper8_select_gpio ( stepper8_t * ctx)

Stepper 8 select GPIO function.

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

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

◆ stepper8_select_spi()

err_t stepper8_select_spi ( stepper8_t * ctx)

Stepper 8 select SPI function.

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

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

◆ stepper8_set_direction()

void stepper8_set_direction ( stepper8_t * ctx,
uint8_t dir )

Stepper 8 set direction function.

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

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

◆ stepper8_set_md0_pin()

void stepper8_set_md0_pin ( stepper8_t * ctx,
uint8_t state )

Stepper 8 set MD0 pin function.

This function sets the MD0 pin logic state.

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

◆ stepper8_set_md1_pin()

void stepper8_set_md1_pin ( stepper8_t * ctx,
uint8_t state )

Stepper 8 set MD1 pin function.

This function sets the MD1 pin logic state.

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

◆ stepper8_set_md2_pin()

void stepper8_set_md2_pin ( stepper8_t * ctx,
uint8_t state )

Stepper 8 set MD2 pin function.

This function sets the MD2 pin logic state.

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

◆ stepper8_set_md3_pin()

void stepper8_set_md3_pin ( stepper8_t * ctx,
uint8_t state )

Stepper 8 set MD3 pin function.

This function sets the MD3 pin logic state.

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

◆ stepper8_set_rst_pin()

void stepper8_set_rst_pin ( stepper8_t * ctx,
uint8_t state )

Stepper 8 set rst pin function.

This function sets the RST pin logic state.

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

◆ stepper8_set_step_mode()

err_t stepper8_set_step_mode ( stepper8_t * ctx,
uint8_t mode )

Stepper 8 set step mode function.

This function sets the step mode resolution settings.

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

◆ stepper8_set_step_pin()

void stepper8_set_step_pin ( stepper8_t * ctx,
uint8_t state )

Stepper 8 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper8_write_spi()

err_t stepper8_write_spi ( stepper8_t * ctx,
uint32_t data_in )

Stepper 8 write spi function.

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

Parameters
[in]ctx: Click context object. See stepper8_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 stepper8_select_spi command needs to be called before this function call.