stepper14 2.1.0.0
Stepper 14 Click Driver

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

Topics

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

Functions

void stepper14_cfg_setup (stepper14_cfg_t *cfg)
 Stepper 14 configuration object setup function.
 
err_t stepper14_init (stepper14_t *ctx, stepper14_cfg_t *cfg)
 Stepper 14 initialization function.
 
err_t stepper14_default_cfg (stepper14_t *ctx)
 Stepper 14 default configuration function.
 
err_t stepper14_pca_write_reg (stepper14_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 14 pca write reg function.
 
err_t stepper14_pca_read_reg (stepper14_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 14 pca read reg function.
 
void stepper14_set_rst_pin (stepper14_t *ctx, uint8_t state)
 Stepper 14 set rst pin function.
 
void stepper14_reset_pca (stepper14_t *ctx)
 Stepper 14 reset device function.
 
uint8_t stepper14_get_fault_pin (stepper14_t *ctx)
 Stepper 14 get FAULT pin function.
 
void stepper14_enable_device (stepper14_t *ctx)
 Stepper 14 enable device function.
 
void stepper14_disable_device (stepper14_t *ctx)
 Stepper 14 disable device function.
 
err_t stepper14_set_in1_pin (stepper14_t *ctx, uint8_t state)
 Stepper 14 set IN1 pin function.
 
err_t stepper14_set_in2_pin (stepper14_t *ctx, uint8_t state)
 Stepper 14 set IN2 pin function.
 
err_t stepper14_set_in3_pin (stepper14_t *ctx, uint8_t state)
 Stepper 14 set IN3 pin function.
 
err_t stepper14_set_in4_pin (stepper14_t *ctx, uint8_t state)
 Stepper 14 set IN4 pin function.
 
err_t stepper14_set_mode_pin (stepper14_t *ctx, uint8_t state)
 Stepper 14 set MODE pin function.
 
err_t stepper14_set_trq_pin (stepper14_t *ctx, uint8_t state)
 Stepper 14 set TRQ pin function.
 
err_t stepper14_set_interface_mode (stepper14_t *ctx, uint8_t mode)
 Stepper 14 set interface mode function.
 
void stepper14_set_step_mode (stepper14_t *ctx, uint8_t mode)
 Stepper 14 set step mode function.
 
void stepper14_set_direction (stepper14_t *ctx, uint8_t dir)
 Stepper 14 set direction function.
 
void stepper14_switch_direction (stepper14_t *ctx)
 Stepper 14 switch direction function.
 
err_t stepper14_drive_motor (stepper14_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 14 driver motor function.
 

Detailed Description

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

◆ stepper14_cfg_setup()

void stepper14_cfg_setup ( stepper14_cfg_t * cfg)

Stepper 14 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper14_default_cfg()

err_t stepper14_default_cfg ( stepper14_t * ctx)

Stepper 14 default configuration function.

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

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

◆ stepper14_disable_device()

void stepper14_disable_device ( stepper14_t * ctx)

Stepper 14 disable device function.

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

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

◆ stepper14_drive_motor()

err_t stepper14_drive_motor ( stepper14_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 14 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 stepper14_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.

◆ stepper14_enable_device()

void stepper14_enable_device ( stepper14_t * ctx)

Stepper 14 enable device function.

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

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

◆ stepper14_get_fault_pin()

uint8_t stepper14_get_fault_pin ( stepper14_t * ctx)

Stepper 14 get FAULT pin function.

This function returns the FAULT pin logic state.

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

◆ stepper14_init()

err_t stepper14_init ( stepper14_t * ctx,
stepper14_cfg_t * cfg )

Stepper 14 initialization function.

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

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

◆ stepper14_pca_read_reg()

err_t stepper14_pca_read_reg ( stepper14_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 14 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 stepper14_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.

◆ stepper14_pca_write_reg()

err_t stepper14_pca_write_reg ( stepper14_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 14 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 stepper14_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.

◆ stepper14_reset_pca()

void stepper14_reset_pca ( stepper14_t * ctx)

Stepper 14 reset device function.

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

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

◆ stepper14_set_direction()

void stepper14_set_direction ( stepper14_t * ctx,
uint8_t dir )

Stepper 14 set direction function.

This function sets the motor direction to clockwise or counter-clockwise in ctx->direction.

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

◆ stepper14_set_in1_pin()

err_t stepper14_set_in1_pin ( stepper14_t * ctx,
uint8_t state )

Stepper 14 set IN1 pin function.

This function sets the IN1 pin logic state.

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

◆ stepper14_set_in2_pin()

err_t stepper14_set_in2_pin ( stepper14_t * ctx,
uint8_t state )

Stepper 14 set IN2 pin function.

This function sets the IN2 pin logic state.

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

◆ stepper14_set_in3_pin()

err_t stepper14_set_in3_pin ( stepper14_t * ctx,
uint8_t state )

Stepper 14 set IN3 pin function.

This function sets the IN3 pin logic state.

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

◆ stepper14_set_in4_pin()

err_t stepper14_set_in4_pin ( stepper14_t * ctx,
uint8_t state )

Stepper 14 set IN4 pin function.

This function sets the IN4 pin logic state.

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

◆ stepper14_set_interface_mode()

err_t stepper14_set_interface_mode ( stepper14_t * ctx,
uint8_t mode )

Stepper 14 set interface mode function.

This function sets the interface mode settings in ctx->pin_mode.

Parameters
[in]ctx: Click context object. See stepper14_t object definition for detailed explanation.
[in]mode: Interface mode settings.
  • 0 - 4-pin interface,
  • 1 - 2-pin interface.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper14_set_mode_pin()

err_t stepper14_set_mode_pin ( stepper14_t * ctx,
uint8_t state )

Stepper 14 set MODE pin function.

This function sets the MODE pin logic state.

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

◆ stepper14_set_rst_pin()

void stepper14_set_rst_pin ( stepper14_t * ctx,
uint8_t state )

Stepper 14 set rst pin function.

This function sets the RST pin logic state.

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

◆ stepper14_set_step_mode()

void stepper14_set_step_mode ( stepper14_t * ctx,
uint8_t mode )

Stepper 14 set step mode function.

This function sets the step mode resolution settings in ctx->step_mode.

Parameters
[in]ctx: Click context object. See stepper14_t object definition for detailed explanation.
[in]mode: Step mode resolution.
  • 0 - Full step,
  • 1 - Half step.
Returns
None.
Note
None.

◆ stepper14_set_trq_pin()

err_t stepper14_set_trq_pin ( stepper14_t * ctx,
uint8_t state )

Stepper 14 set TRQ pin function.

This function sets the TRQ pin logic state.

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

◆ stepper14_switch_direction()

void stepper14_switch_direction ( stepper14_t * ctx)

Stepper 14 switch direction function.

This function switches the motor direction in ctx->direction.

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