stepper12 2.1.0.0
Stepper 12 Click Driver

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

Topics

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

Functions

void stepper12_cfg_setup (stepper12_cfg_t *cfg)
 Stepper 12 configuration object setup function.
 
err_t stepper12_init (stepper12_t *ctx, stepper12_cfg_t *cfg)
 Stepper 12 initialization function.
 
err_t stepper12_default_cfg (stepper12_t *ctx)
 Stepper 12 default configuration function.
 
err_t stepper12_write_register (stepper12_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 12 write register function.
 
err_t stepper12_read_register (stepper12_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 12 read register function.
 
err_t stepper12_get_step_mode (stepper12_t *ctx, uint8_t *mode)
 Stepper 12 get step mode function.
 
err_t stepper12_set_step_mode (stepper12_t *ctx, uint8_t mode)
 Stepper 12 set step mode function.
 
err_t stepper12_get_torque (stepper12_t *ctx, uint8_t *torque)
 Stepper 12 get torque function.
 
err_t stepper12_set_torque (stepper12_t *ctx, uint8_t torque)
 Stepper 12 set torque function.
 
err_t stepper12_get_decay_pin (stepper12_t *ctx, uint8_t *state)
 Stepper 12 get decay pin function.
 
err_t stepper12_set_decay_pin (stepper12_t *ctx, uint8_t state)
 Stepper 12 set decay pin function.
 
err_t stepper12_get_sleep_x_pin (stepper12_t *ctx, uint8_t *state)
 Stepper 12 get sleep x pin function.
 
err_t stepper12_set_sleep_x_pin (stepper12_t *ctx, uint8_t state)
 Stepper 12 set sleep x pin function.
 
err_t stepper12_get_lo_pin (stepper12_t *ctx, uint8_t *state)
 Stepper 12 get lo pin function.
 
err_t stepper12_get_mo_pin (stepper12_t *ctx, uint8_t *state)
 Stepper 12 get mo pin function.
 
void stepper12_drive_motor (stepper12_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 12 driver motor function.
 
void stepper12_enable_device (stepper12_t *ctx)
 Stepper 12 enable device function.
 
void stepper12_disable_device (stepper12_t *ctx)
 Stepper 12 disable device function.
 
void stepper12_set_direction (stepper12_t *ctx, uint8_t dir)
 Stepper 12 set direction function.
 
void stepper12_switch_direction (stepper12_t *ctx)
 Stepper 12 switch direction function.
 
void stepper12_reset_device (stepper12_t *ctx)
 Stepper 12 reset device function.
 
uint8_t stepper12_get_int_pin (stepper12_t *ctx)
 Stepper 12 get int pin function.
 
void stepper12_set_clk_pin (stepper12_t *ctx, uint8_t state)
 Stepper 12 set clk pin function.
 

Detailed Description

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

◆ stepper12_cfg_setup()

void stepper12_cfg_setup ( stepper12_cfg_t * cfg)

Stepper 12 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper12_default_cfg()

err_t stepper12_default_cfg ( stepper12_t * ctx)

Stepper 12 default configuration function.

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

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

◆ stepper12_disable_device()

void stepper12_disable_device ( stepper12_t * ctx)

Stepper 12 disable device function.

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

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

◆ stepper12_drive_motor()

void stepper12_drive_motor ( stepper12_t * ctx,
uint32_t steps,
uint8_t speed )

Stepper 12 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 stepper12_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.

◆ stepper12_enable_device()

void stepper12_enable_device ( stepper12_t * ctx)

Stepper 12 enable device function.

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

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

◆ stepper12_get_decay_pin()

err_t stepper12_get_decay_pin ( stepper12_t * ctx,
uint8_t * state )

Stepper 12 get decay pin function.

This function reads the decay pin logic state.

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

◆ stepper12_get_int_pin()

uint8_t stepper12_get_int_pin ( stepper12_t * ctx)

Stepper 12 get int pin function.

This function returns the INT pin logic state.

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

◆ stepper12_get_lo_pin()

err_t stepper12_get_lo_pin ( stepper12_t * ctx,
uint8_t * state )

Stepper 12 get lo pin function.

This function reads the lo pin logic state.

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

◆ stepper12_get_mo_pin()

err_t stepper12_get_mo_pin ( stepper12_t * ctx,
uint8_t * state )

Stepper 12 get mo pin function.

This function reads the mo pin logic state.

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

◆ stepper12_get_sleep_x_pin()

err_t stepper12_get_sleep_x_pin ( stepper12_t * ctx,
uint8_t * state )

Stepper 12 get sleep x pin function.

This function reads the sleep x pin logic state.

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

◆ stepper12_get_step_mode()

err_t stepper12_get_step_mode ( stepper12_t * ctx,
uint8_t * mode )

Stepper 12 get step mode function.

This function reads the step mode resolution settings.

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

◆ stepper12_get_torque()

err_t stepper12_get_torque ( stepper12_t * ctx,
uint8_t * torque )

Stepper 12 get torque function.

This function reads the motor torque settings.

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

◆ stepper12_init()

err_t stepper12_init ( stepper12_t * ctx,
stepper12_cfg_t * cfg )

Stepper 12 initialization function.

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

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

◆ stepper12_read_register()

err_t stepper12_read_register ( stepper12_t * ctx,
uint8_t reg,
uint8_t * data_out )

Stepper 12 read register function.

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

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

◆ stepper12_reset_device()

void stepper12_reset_device ( stepper12_t * ctx)

Stepper 12 reset device function.

This function resets the device by toggling the RST pin.

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

◆ stepper12_set_clk_pin()

void stepper12_set_clk_pin ( stepper12_t * ctx,
uint8_t state )

Stepper 12 set clk pin function.

This function sets the CLK pin logic state.

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

◆ stepper12_set_decay_pin()

err_t stepper12_set_decay_pin ( stepper12_t * ctx,
uint8_t state )

Stepper 12 set decay pin function.

This function sets the decay pin logic state.

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

◆ stepper12_set_direction()

void stepper12_set_direction ( stepper12_t * ctx,
uint8_t dir )

Stepper 12 set direction function.

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

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

◆ stepper12_set_sleep_x_pin()

err_t stepper12_set_sleep_x_pin ( stepper12_t * ctx,
uint8_t state )

Stepper 12 set sleep x pin function.

This function sets the sleep x pin logic state.

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

◆ stepper12_set_step_mode()

err_t stepper12_set_step_mode ( stepper12_t * ctx,
uint8_t mode )

Stepper 12 set step mode function.

This function sets the step mode resolution settings.

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

◆ stepper12_set_torque()

err_t stepper12_set_torque ( stepper12_t * ctx,
uint8_t torque )

Stepper 12 set torque function.

This function sets the motor torque settings.

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

◆ stepper12_switch_direction()

void stepper12_switch_direction ( stepper12_t * ctx)

Stepper 12 switch direction function.

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

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

◆ stepper12_write_register()

err_t stepper12_write_register ( stepper12_t * ctx,
uint8_t reg,
uint8_t data_in )

Stepper 12 write register function.

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

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