stepper18 2.0.0.0
Stepper 18 Click Driver

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

Functions

void stepper18_cfg_setup (stepper18_cfg_t *cfg)
 Stepper 18 configuration object setup function.
 
err_t stepper18_init (stepper18_t *ctx, stepper18_cfg_t *cfg)
 Stepper 18 initialization function.
 
err_t stepper18_default_cfg (stepper18_t *ctx)
 Stepper 18 default configuration function.
 
err_t stepper18_generic_write (stepper18_t *ctx, uint8_t *tx_buf, uint8_t tx_len)
 Writing function.
 
err_t stepper18_set_out_voltage (stepper18_t *ctx, uint16_t voltage)
 Set voltage reference.
 
void stepper18_set_dir (stepper18_t *ctx, uint8_t value)
 Set direction.
 
void stepper18_set_slp (stepper18_t *ctx, uint8_t value)
 Set sleep.
 
void stepper18_set_en (stepper18_t *ctx, uint8_t value)
 Set enable.
 
void stepper18_set_stp (stepper18_t *ctx, uint8_t value)
 Set step state.
 
uint8_t stepper18_get_flt (stepper18_t *ctx)
 Get fault.
 
void stepper18_move_motor_angle (stepper18_t *ctx, float degree, uint8_t step_res, uint8_t speed)
 Move motor in angle value.
 
void stepper18_move_motor_step (stepper18_t *ctx, uint16_t steps, uint8_t step_res, uint8_t speed)
 Move motor in step value.
 
void stepper18_calculate_resolution (stepper18_t *ctx)
 Calculate step-degree resolution.
 

Detailed Description

API for configuring and manipulating Stepper 18 Click driver.

Function Documentation

◆ stepper18_calculate_resolution()

void stepper18_calculate_resolution ( stepper18_t * ctx)

Calculate step-degree resolution.

This function calculates resolution of selected motor steps.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
Returns
Nothing.
Note
It calculates steps set from context object and sets resolution of it's member.

◆ stepper18_cfg_setup()

void stepper18_cfg_setup ( stepper18_cfg_t * cfg)

Stepper 18 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper18_default_cfg()

err_t stepper18_default_cfg ( stepper18_t * ctx)

Stepper 18 default configuration function.

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

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

◆ stepper18_generic_write()

err_t stepper18_generic_write ( stepper18_t * ctx,
uint8_t * tx_buf,
uint8_t tx_len )

Writing function.

This function writes a desired number of data bytes by using I2C serial interface.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ stepper18_get_flt()

uint8_t stepper18_get_flt ( stepper18_t * ctx)

Get fault.

This function gets a flt pin.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
Returns
Logic state of pin.

◆ stepper18_init()

err_t stepper18_init ( stepper18_t * ctx,
stepper18_cfg_t * cfg )

Stepper 18 initialization function.

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

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

◆ stepper18_move_motor_angle()

void stepper18_move_motor_angle ( stepper18_t * ctx,
float degree,
uint8_t step_res,
uint8_t speed )

Move motor in angle value.

This function moves motor for desired angle value.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]degree: Degrees to move.
[in]step_res: Step resolution refrence:
  • 1 - Full step,
  • 2 - Half step,
  • 4 - Quarter step,
  • 8 - 1/8 step,
  • 16 - 1/16 step,
  • 32 - 1/32 step,
  • 64 - 1/64 step,
  • 128 - 1/128 step,
  • 256 - 1/256 step.
[in]speed: Predefined speed macros:
  • 1 - Very Slow,
  • 2 - Slow,
  • 3 - Normal,
  • 4 - Fast,
  • 5 - Very Fast.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
Step resolution depends on postion on M0, M1 switches.

◆ stepper18_move_motor_step()

void stepper18_move_motor_step ( stepper18_t * ctx,
uint16_t steps,
uint8_t step_res,
uint8_t speed )

Move motor in step value.

This function moves motor for desired step value.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]steps: Steps to move.
[in]step_res: Step resolution refrence:
  • 1 - Full step,
  • 2 - Half step,
  • 4 - Quarter step,
  • 8 - 1/8 step,
  • 16 - 1/16 step,
  • 32 - 1/32 step,
  • 64 - 1/64 step,
  • 128 - 1/128 step,
  • 256 - 1/256 step.
[in]speed: Predefined speed macros:
  • 1 - Very Slow,
  • 2 - Slow,
  • 3 - Normal,
  • 4 - Fast,
  • 5 - Very Fast.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
Step resolution depends on postion on M0, M1 switches.

◆ stepper18_set_dir()

void stepper18_set_dir ( stepper18_t * ctx,
uint8_t value )

Set direction.

This function sets a dir pin to high/low state.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]value: Logic state to set.
Returns
Nothing.

◆ stepper18_set_en()

void stepper18_set_en ( stepper18_t * ctx,
uint8_t value )

Set enable.

This function sets a en pin to high/low state.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]value: Logic state to set.
Returns
Nothing.

◆ stepper18_set_out_voltage()

err_t stepper18_set_out_voltage ( stepper18_t * ctx,
uint16_t voltage )

Set voltage reference.

This function sets a desired reference voltage of device.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]voltage: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ stepper18_set_slp()

void stepper18_set_slp ( stepper18_t * ctx,
uint8_t value )

Set sleep.

This function sets a slp pin to high/low state.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]value: Logic state to set.
Returns
Nothing.

◆ stepper18_set_stp()

void stepper18_set_stp ( stepper18_t * ctx,
uint8_t value )

Set step state.

This function sets a stp pin to high/low state.

Parameters
[in]ctx: Click context object. See stepper18_t object definition for detailed explanation.
[in]value: Logic state to set.
Returns
Nothing.