stepper13 2.1.0.0
Stepper 13 Click Driver

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

Topics

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

Functions

void stepper13_cfg_setup (stepper13_cfg_t *cfg)
 Stepper 13 configuration object setup function.
 
err_t stepper13_init (stepper13_t *ctx, stepper13_cfg_t *cfg)
 Stepper 13 initialization function.
 
err_t stepper13_default_cfg (stepper13_t *ctx)
 Stepper 13 default configuration function.
 
err_t stepper13_pca_write_reg (stepper13_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 13 pca write reg function.
 
err_t stepper13_pca_read_reg (stepper13_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 13 pca read reg function.
 
err_t stepper13_get_fault_pin (stepper13_t *ctx, uint8_t *state)
 Stepper 13 get fault pin function.
 
err_t stepper13_enable_device (stepper13_t *ctx)
 Stepper 13 enable device function.
 
err_t stepper13_disable_device (stepper13_t *ctx)
 Stepper 13 disable device function.
 
err_t stepper13_enable_sleep (stepper13_t *ctx)
 Stepper 13 enable sleep function.
 
err_t stepper13_disable_sleep (stepper13_t *ctx)
 Stepper 13 disable sleep function.
 
err_t stepper13_set_direction (stepper13_t *ctx, uint8_t dir)
 Stepper 13 set direction function.
 
err_t stepper13_switch_direction (stepper13_t *ctx)
 Stepper 13 switch direction function.
 
void stepper13_set_rst_pin (stepper13_t *ctx, uint8_t state)
 Stepper 13 set rst pin function.
 
void stepper13_reset_pca (stepper13_t *ctx)
 Stepper 13 reset device function.
 
uint8_t stepper13_get_int_pin (stepper13_t *ctx)
 Stepper 13 get INT pin function.
 
void stepper13_set_step_pin (stepper13_t *ctx, uint8_t state)
 Stepper 13 set step pin function.
 
err_t stepper13_get_step_mode (stepper13_t *ctx, uint8_t *mode)
 Stepper 13 get step mode function.
 
err_t stepper13_set_step_mode (stepper13_t *ctx, uint8_t mode)
 Stepper 13 set step mode function.
 
err_t stepper13_drive_motor (stepper13_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 13 driver motor function.
 

Detailed Description

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

◆ stepper13_cfg_setup()

void stepper13_cfg_setup ( stepper13_cfg_t * cfg)

Stepper 13 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper13_default_cfg()

err_t stepper13_default_cfg ( stepper13_t * ctx)

Stepper 13 default configuration function.

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

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

◆ stepper13_disable_device()

err_t stepper13_disable_device ( stepper13_t * ctx)

Stepper 13 disable device function.

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

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

◆ stepper13_disable_sleep()

err_t stepper13_disable_sleep ( stepper13_t * ctx)

Stepper 13 disable sleep function.

This function disables the sleep mode by setting the SLEEP pin to high logic state.

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

◆ stepper13_drive_motor()

err_t stepper13_drive_motor ( stepper13_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 13 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 stepper13_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.

◆ stepper13_enable_device()

err_t stepper13_enable_device ( stepper13_t * ctx)

Stepper 13 enable device function.

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

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

◆ stepper13_enable_sleep()

err_t stepper13_enable_sleep ( stepper13_t * ctx)

Stepper 13 enable sleep function.

This function enables the sleep mode by setting the SLEEP pin to low logic state.

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

◆ stepper13_get_fault_pin()

err_t stepper13_get_fault_pin ( stepper13_t * ctx,
uint8_t * state )

Stepper 13 get fault pin function.

This function reads the FAULT pin logic state.

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

◆ stepper13_get_int_pin()

uint8_t stepper13_get_int_pin ( stepper13_t * ctx)

Stepper 13 get INT pin function.

This function returns the INT pin logic state.

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

◆ stepper13_get_step_mode()

err_t stepper13_get_step_mode ( stepper13_t * ctx,
uint8_t * mode )

Stepper 13 get step mode function.

This function reads the step mode resolution settings.

Parameters
[in]ctx: Click context object. See stepper13_t object definition for detailed explanation.
[out]mode: Step mode resolution:
  • 0 - Full step,
  • 1 - 1/2 step,
  • 2 - 1/4 step,
  • 3 - 1/8 step.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper13_init()

err_t stepper13_init ( stepper13_t * ctx,
stepper13_cfg_t * cfg )

Stepper 13 initialization function.

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

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

◆ stepper13_pca_read_reg()

err_t stepper13_pca_read_reg ( stepper13_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 13 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 stepper13_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.

◆ stepper13_pca_write_reg()

err_t stepper13_pca_write_reg ( stepper13_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 13 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 stepper13_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.

◆ stepper13_reset_pca()

void stepper13_reset_pca ( stepper13_t * ctx)

Stepper 13 reset device function.

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

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

◆ stepper13_set_direction()

err_t stepper13_set_direction ( stepper13_t * ctx,
uint8_t dir )

Stepper 13 set direction function.

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

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

◆ stepper13_set_rst_pin()

void stepper13_set_rst_pin ( stepper13_t * ctx,
uint8_t state )

Stepper 13 set rst pin function.

This function sets the RST pin logic state.

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

◆ stepper13_set_step_mode()

err_t stepper13_set_step_mode ( stepper13_t * ctx,
uint8_t mode )

Stepper 13 set step mode function.

This function sets the step mode resolution settings.

Parameters
[in]ctx: Click context object. See stepper13_t object definition for detailed explanation.
[in]mode: Step mode resolution:
  • 0 - Full step,
  • 1 - 1/2 step,
  • 2 - 1/4 step,
  • 3 - 1/8 step.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ stepper13_set_step_pin()

void stepper13_set_step_pin ( stepper13_t * ctx,
uint8_t state )

Stepper 13 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper13_switch_direction()

err_t stepper13_switch_direction ( stepper13_t * ctx)

Stepper 13 switch direction function.

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

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