stepper6 2.1.0.0
Stepper 6 Click Driver

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

Topics

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

Functions

void stepper6_cfg_setup (stepper6_cfg_t *cfg)
 Stepper 6 configuration object setup function.
 
err_t stepper6_init (stepper6_t *ctx, stepper6_cfg_t *cfg)
 Stepper 6 initialization function.
 
err_t stepper6_default_cfg (stepper6_t *ctx)
 Stepper 6 default configuration function.
 
err_t stepper6_set_dac (stepper6_t *ctx, uint16_t dac_cmd)
 Stepper 6 set dac function.
 
err_t stepper6_pca_write_reg (stepper6_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 6 pca write reg function.
 
err_t stepper6_pca_read_reg (stepper6_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 6 pca read reg function.
 
err_t stepper6_get_trq_pin (stepper6_t *ctx, uint8_t *state)
 Stepper 6 get trq pin function.
 
err_t stepper6_set_trq_pin (stepper6_t *ctx, uint8_t state)
 Stepper 6 set trq pin function.
 
err_t stepper6_get_m1_pin (stepper6_t *ctx, uint8_t *state)
 Stepper 6 get M1 pin function.
 
err_t stepper6_set_m1_pin (stepper6_t *ctx, uint8_t state)
 Stepper 6 set M1 pin function.
 
err_t stepper6_get_m0_pin (stepper6_t *ctx, uint8_t *state)
 Stepper 6 get M0 pin function.
 
err_t stepper6_set_m0_pin (stepper6_t *ctx, uint8_t state)
 Stepper 6 set M0 pin function.
 
err_t stepper6_get_sleep_pin (stepper6_t *ctx, uint8_t *state)
 Stepper 6 get sleep pin function.
 
err_t stepper6_set_sleep_pin (stepper6_t *ctx, uint8_t state)
 Stepper 6 set sleep pin function.
 
err_t stepper6_get_fault_pin (stepper6_t *ctx, uint8_t *state)
 Stepper 6 get fault pin function.
 
void stepper6_enable_device (stepper6_t *ctx)
 Stepper 6 enable device function.
 
void stepper6_disable_device (stepper6_t *ctx)
 Stepper 6 disable device function.
 
void stepper6_set_direction (stepper6_t *ctx, uint8_t dir)
 Stepper 6 set direction function.
 
void stepper6_switch_direction (stepper6_t *ctx)
 Stepper 6 switch direction function.
 
void stepper6_reset_pca (stepper6_t *ctx)
 Stepper 6 reset device function.
 
void stepper6_set_rst_pin (stepper6_t *ctx, uint8_t state)
 Stepper 6 set rst pin function.
 
void stepper6_set_step_pin (stepper6_t *ctx, uint8_t state)
 Stepper 6 set step pin function.
 
err_t stepper6_get_step_mode (stepper6_t *ctx, uint8_t *mode)
 Stepper 6 get step mode function.
 
err_t stepper6_set_step_mode (stepper6_t *ctx, uint8_t mode)
 Stepper 6 set step mode function.
 
void stepper6_drive_motor (stepper6_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 6 driver motor function.
 

Detailed Description

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

◆ stepper6_cfg_setup()

void stepper6_cfg_setup ( stepper6_cfg_t * cfg)

Stepper 6 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper6_default_cfg()

err_t stepper6_default_cfg ( stepper6_t * ctx)

Stepper 6 default configuration function.

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

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

◆ stepper6_disable_device()

void stepper6_disable_device ( stepper6_t * ctx)

Stepper 6 disable device function.

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

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

◆ stepper6_drive_motor()

void stepper6_drive_motor ( stepper6_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 6 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 stepper6_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.

◆ stepper6_enable_device()

void stepper6_enable_device ( stepper6_t * ctx)

Stepper 6 enable device function.

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

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

◆ stepper6_get_fault_pin()

err_t stepper6_get_fault_pin ( stepper6_t * ctx,
uint8_t * state )

Stepper 6 get fault pin function.

This function reads the FAULT pin logic state.

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

◆ stepper6_get_m0_pin()

err_t stepper6_get_m0_pin ( stepper6_t * ctx,
uint8_t * state )

Stepper 6 get M0 pin function.

This function reads the M0 pin logic state.

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

◆ stepper6_get_m1_pin()

err_t stepper6_get_m1_pin ( stepper6_t * ctx,
uint8_t * state )

Stepper 6 get M1 pin function.

This function reads the M1 pin logic state.

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

◆ stepper6_get_sleep_pin()

err_t stepper6_get_sleep_pin ( stepper6_t * ctx,
uint8_t * state )

Stepper 6 get sleep pin function.

This function reads the SLEEP pin logic state.

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

◆ stepper6_get_step_mode()

err_t stepper6_get_step_mode ( stepper6_t * ctx,
uint8_t * mode )

Stepper 6 get step mode function.

This function reads the step mode resolution settings.

Parameters
[in]ctx: Click context object. See stepper6_t object definition for detailed explanation.
[out]mode: Step mode resolution:
  • 0 - Full step (2-phase excitation) with 71% current,
  • 1 - 1/16 step,
  • 2 - 1/2 step,
  • 3 - 1/4 step,
  • 4 - 1/8 step,
  • 5 - Non-circular 1/2 step.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper6_get_trq_pin()

err_t stepper6_get_trq_pin ( stepper6_t * ctx,
uint8_t * state )

Stepper 6 get trq pin function.

This function reads the TRQ pin logic state.

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

◆ stepper6_init()

err_t stepper6_init ( stepper6_t * ctx,
stepper6_cfg_t * cfg )

Stepper 6 initialization function.

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

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

◆ stepper6_pca_read_reg()

err_t stepper6_pca_read_reg ( stepper6_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 6 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 stepper6_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.

◆ stepper6_pca_write_reg()

err_t stepper6_pca_write_reg ( stepper6_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 6 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 stepper6_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.

◆ stepper6_reset_pca()

void stepper6_reset_pca ( stepper6_t * ctx)

Stepper 6 reset device function.

This function resets the PCA9538A device by toggling the RST pin.

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

◆ stepper6_set_dac()

err_t stepper6_set_dac ( stepper6_t * ctx,
uint16_t dac_cmd )

Stepper 6 set dac function.

This function writes a 16-bit command to DAC register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See stepper6_t object definition for detailed explanation.
[in]dac_cmd: 16-bit DAC command.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
DAC command is in format: B15 (!A/B -> default !A, i.e. 0), B14 (BUF -> VREF buffered - 1, not buffered - 0), B13 (GA -> Output gain 1x - 1, 2x - 0), B12 (SHDN -> 1 enable, 0 disable), B11-B0 (DAC data).

◆ stepper6_set_direction()

void stepper6_set_direction ( stepper6_t * ctx,
uint8_t dir )

Stepper 6 set direction function.

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

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

◆ stepper6_set_m0_pin()

err_t stepper6_set_m0_pin ( stepper6_t * ctx,
uint8_t state )

Stepper 6 set M0 pin function.

This function sets the M0 pin logic state.

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

◆ stepper6_set_m1_pin()

err_t stepper6_set_m1_pin ( stepper6_t * ctx,
uint8_t state )

Stepper 6 set M1 pin function.

This function sets the M1 pin logic state.

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

◆ stepper6_set_rst_pin()

void stepper6_set_rst_pin ( stepper6_t * ctx,
uint8_t state )

Stepper 6 set rst pin function.

This function sets the RST pin logic state.

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

◆ stepper6_set_sleep_pin()

err_t stepper6_set_sleep_pin ( stepper6_t * ctx,
uint8_t state )

Stepper 6 set sleep pin function.

This function sets the SLEEP pin logic state.

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

◆ stepper6_set_step_mode()

err_t stepper6_set_step_mode ( stepper6_t * ctx,
uint8_t mode )

Stepper 6 set step mode function.

This function sets the step mode resolution settings.

Parameters
[in]ctx: Click context object. See stepper6_t object definition for detailed explanation.
[in]mode: Step mode resolution:
  • 0 - Full step (2-phase excitation) with 71% current,
  • 1 - 1/16 step,
  • 2 - 1/2 step,
  • 3 - 1/4 step,
  • 4 - 1/8 step,
  • 5 - Non-circular 1/2 step.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper6_set_step_pin()

void stepper6_set_step_pin ( stepper6_t * ctx,
uint8_t state )

Stepper 6 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper6_set_trq_pin()

err_t stepper6_set_trq_pin ( stepper6_t * ctx,
uint8_t state )

Stepper 6 set trq pin function.

This function sets the TRQ pin logic state.

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

◆ stepper6_switch_direction()

void stepper6_switch_direction ( stepper6_t * ctx)

Stepper 6 switch direction function.

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

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