stepper21 2.1.0.0
Stepper 21 Click Driver

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

Topics

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

Functions

void stepper21_cfg_setup (stepper21_cfg_t *cfg)
 Stepper 21 configuration object setup function.
 
err_t stepper21_init (stepper21_t *ctx, stepper21_cfg_t *cfg)
 Stepper 21 initialization function.
 
err_t stepper21_default_cfg (stepper21_t *ctx)
 Stepper 21 default configuration function.
 
err_t stepper21_write_register (stepper21_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 21 write register function.
 
err_t stepper21_read_register (stepper21_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 21 read register function.
 
err_t stepper21_get_step_mode (stepper21_t *ctx, uint8_t *mode)
 Stepper 21 get step mode function.
 
err_t stepper21_set_step_mode (stepper21_t *ctx, uint8_t mode)
 Stepper 21 set step mode function.
 
err_t stepper21_get_sleep_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get sleep pin function.
 
err_t stepper21_set_sleep_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set sleep pin function.
 
err_t stepper21_get_fault_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get fault pin function.
 
err_t stepper21_get_decay_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get decay pin function.
 
err_t stepper21_set_decay_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set decay pin function.
 
err_t stepper21_get_enable_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get enable pin function.
 
err_t stepper21_set_enable_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set enable pin function.
 
err_t stepper21_get_home_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get home pin function.
 
void stepper21_drive_motor (stepper21_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 21 driver motor function.
 
err_t stepper21_enable_device (stepper21_t *ctx)
 Stepper 21 enable device function.
 
err_t stepper21_disable_device (stepper21_t *ctx)
 Stepper 21 disable device function.
 
void stepper21_set_direction (stepper21_t *ctx, uint8_t dir)
 Stepper 21 set direction function.
 
void stepper21_switch_direction (stepper21_t *ctx)
 Stepper 21 switch direction function.
 
void stepper21_set_rst_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set rst pin function.
 
void stepper21_reset_device (stepper21_t *ctx)
 Stepper 21 reset device function.
 
uint8_t stepper21_get_int_pin (stepper21_t *ctx)
 Stepper 21 get int pin function.
 
void stepper21_set_step_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set step pin function.
 

Detailed Description

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

◆ stepper21_cfg_setup()

void stepper21_cfg_setup ( stepper21_cfg_t * cfg)

Stepper 21 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper21_default_cfg()

err_t stepper21_default_cfg ( stepper21_t * ctx)

Stepper 21 default configuration function.

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

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

◆ stepper21_disable_device()

err_t stepper21_disable_device ( stepper21_t * ctx)

Stepper 21 disable device function.

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

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

◆ stepper21_drive_motor()

void stepper21_drive_motor ( stepper21_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 21 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 stepper21_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.

◆ stepper21_enable_device()

err_t stepper21_enable_device ( stepper21_t * ctx)

Stepper 21 enable device function.

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

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

◆ stepper21_get_decay_pin()

err_t stepper21_get_decay_pin ( stepper21_t * ctx,
uint8_t * state )

Stepper 21 get decay pin function.

This function reads the decay pin logic state.

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

◆ stepper21_get_enable_pin()

err_t stepper21_get_enable_pin ( stepper21_t * ctx,
uint8_t * state )

Stepper 21 get enable pin function.

This function reads the enable pin logic state.

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

◆ stepper21_get_fault_pin()

err_t stepper21_get_fault_pin ( stepper21_t * ctx,
uint8_t * state )

Stepper 21 get fault pin function.

This function reads the fault pin logic state.

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

◆ stepper21_get_home_pin()

err_t stepper21_get_home_pin ( stepper21_t * ctx,
uint8_t * state )

Stepper 21 get home pin function.

This function reads the home pin logic state.

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

◆ stepper21_get_int_pin()

uint8_t stepper21_get_int_pin ( stepper21_t * ctx)

Stepper 21 get int pin function.

This function returns the INT pin logic state.

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

◆ stepper21_get_sleep_pin()

err_t stepper21_get_sleep_pin ( stepper21_t * ctx,
uint8_t * state )

Stepper 21 get sleep pin function.

This function reads the sleep pin logic state.

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

◆ stepper21_get_step_mode()

err_t stepper21_get_step_mode ( stepper21_t * ctx,
uint8_t * mode )

Stepper 21 get step mode function.

This function reads the step mode resolution settings.

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

◆ stepper21_init()

err_t stepper21_init ( stepper21_t * ctx,
stepper21_cfg_t * cfg )

Stepper 21 initialization function.

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

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

◆ stepper21_read_register()

err_t stepper21_read_register ( stepper21_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 21 read register function.

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

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

◆ stepper21_reset_device()

void stepper21_reset_device ( stepper21_t * ctx)

Stepper 21 reset device function.

This function resets the device by toggling the RST pin.

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

◆ stepper21_set_decay_pin()

err_t stepper21_set_decay_pin ( stepper21_t * ctx,
uint8_t state )

Stepper 21 set decay pin function.

This function sets the decay pin logic state.

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

◆ stepper21_set_direction()

void stepper21_set_direction ( stepper21_t * ctx,
uint8_t dir )

Stepper 21 set direction function.

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

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

◆ stepper21_set_enable_pin()

err_t stepper21_set_enable_pin ( stepper21_t * ctx,
uint8_t state )

Stepper 21 set enable pin function.

This function sets the enable pin logic state.

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

◆ stepper21_set_rst_pin()

void stepper21_set_rst_pin ( stepper21_t * ctx,
uint8_t state )

Stepper 21 set rst pin function.

This function sets the RST pin logic state.

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

◆ stepper21_set_sleep_pin()

err_t stepper21_set_sleep_pin ( stepper21_t * ctx,
uint8_t state )

Stepper 21 set sleep pin function.

This function sets the sleep pin logic state.

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

◆ stepper21_set_step_mode()

err_t stepper21_set_step_mode ( stepper21_t * ctx,
uint8_t mode )

Stepper 21 set step mode function.

This function sets the step mode resolution settings.

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

◆ stepper21_set_step_pin()

void stepper21_set_step_pin ( stepper21_t * ctx,
uint8_t state )

Stepper 21 set step pin function.

This function sets the STEP pin logic state.

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

◆ stepper21_switch_direction()

void stepper21_switch_direction ( stepper21_t * ctx)

Stepper 21 switch direction function.

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

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

◆ stepper21_write_register()

err_t stepper21_write_register ( stepper21_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 21 write register 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 stepper21_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.