stepper16 2.0.0.0
Stepper16 Click Driver

API for configuring and manipulating Stepper16 Click driver. More...

Topics

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

Functions

void stepper16_cfg_setup (stepper16_cfg_t *cfg)
 Stepper16 configuration object setup function.
 
err_t stepper16_init (stepper16_t *ctx, stepper16_cfg_t *cfg)
 Stepper16 initialization function.
 
err_t stepper16_default_cfg (stepper16_t *ctx)
 Stepper16 default configuration function.
 
err_t stepper16_generic_write (stepper16_t *ctx, uint8_t reg, uint16_t data_in)
 Stepper16 data writing function.
 
err_t stepper16_generic_read (stepper16_t *ctx, uint8_t reg, uint16_t *data_out)
 Stepper16 data reading function.
 
void stepper16_set_next (stepper16_t *ctx, uint8_t value)
 Set next step state.
 
void stepper16_set_dir (stepper16_t *ctx, uint8_t value)
 Set direction.
 
uint8_t stepper16_get_error_flag (stepper16_t *ctx)
 Get error.
 
void stepper16_hard_reset (stepper16_t *ctx)
 Resets device.
 
void stepper16_wake_up (stepper16_t *ctx)
 Transimt wake up signal.
 
void stepper16_set_step_resolution (stepper16_t *ctx, uint8_t step_res)
 Set step resolution.
 
void stepper16_move_motor_angle (stepper16_t *ctx, float degree, uint8_t speed)
 Move motor in angle value.
 
void stepper16_move_motor_step (stepper16_t *ctx, uint16_t steps, uint8_t speed)
 Move motor in step value.
 
void stepper16_calculate_resolution (stepper16_t *ctx)
 Calculate step-degree resolution.
 

Detailed Description

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

◆ stepper16_calculate_resolution()

void stepper16_calculate_resolution ( stepper16_t * ctx)

Calculate step-degree resolution.

This function calculates resolution of selected motor steps.

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

◆ stepper16_cfg_setup()

void stepper16_cfg_setup ( stepper16_cfg_t * cfg)

Stepper16 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ stepper16_default_cfg()

err_t stepper16_default_cfg ( stepper16_t * ctx)

Stepper16 default configuration function.

This function executes a default configuration of Stepper16 click board.

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

◆ stepper16_generic_read()

err_t stepper16_generic_read ( stepper16_t * ctx,
uint8_t reg,
uint16_t * data_out )

Stepper16 data reading function.

This function reads a data from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See stepper16_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ stepper16_generic_write()

err_t stepper16_generic_write ( stepper16_t * ctx,
uint8_t reg,
uint16_t data_in )

Stepper16 data writing function.

This function writes a data to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See stepper16_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ stepper16_get_error_flag()

uint8_t stepper16_get_error_flag ( stepper16_t * ctx)

Get error.

This function gets a err pin.

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

◆ stepper16_hard_reset()

void stepper16_hard_reset ( stepper16_t * ctx)

Resets device.

This function resets device.

Parameters
[in]ctx: Click context object. See #stepper18_t object definition for detailed explanation.
Returns
Nothing.
Note
Uppon powerup device user need to call this function and to read STEPPER16_REG_SR1 to clear under voltage error.

◆ stepper16_init()

err_t stepper16_init ( stepper16_t * ctx,
stepper16_cfg_t * cfg )

Stepper16 initialization function.

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

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

◆ stepper16_move_motor_angle()

void stepper16_move_motor_angle ( stepper16_t * ctx,
float degree,
uint8_t speed )

Move motor in angle value.

This function moves motor for desired angle value.

Parameters
[in]ctx: Click context object. See stepper16_t object definition for detailed explanation.
[in]degree: Degrees to move.
[in]speed: Predefined speed macros:
  • 1 - Very Slow,
  • 2 - Slow,
  • 3 - Normal,
  • 4 - Fast,
  • 5 - Very Fast.
Returns
Nothing

◆ stepper16_move_motor_step()

void stepper16_move_motor_step ( stepper16_t * ctx,
uint16_t steps,
uint8_t speed )

Move motor in step value.

This function moves motor for desired step value.

Parameters
[in]ctx: Click context object. See stepper16_t object definition for detailed explanation.
[in]steps: Steps to move.
[in]speed: Predefined speed macros:
  • 1 - Very Slow,
  • 2 - Slow,
  • 3 - Normal,
  • 4 - Fast,
  • 5 - Very Fast.
Returns
Nothing

◆ stepper16_set_dir()

void stepper16_set_dir ( stepper16_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.

◆ stepper16_set_next()

void stepper16_set_next ( stepper16_t * ctx,
uint8_t value )

Set next step state.

This function sets a nxt 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.

◆ stepper16_set_step_resolution()

void stepper16_set_step_resolution ( stepper16_t * ctx,
uint8_t step_res )

Set step resolution.

This function set step resolution fo motor control.

Parameters
[in]ctx: Click context object. See #stepper18_t object definition for detailed explanation.
[in]step_res: Step resolution:
  • 7 - Full step,
  • 3 - Half step,
  • 2 - Quarter step,
  • 1 - 1/8 step,
  • 0 - 1/16 step.
Returns
Nothing.

◆ stepper16_wake_up()

void stepper16_wake_up ( stepper16_t * ctx)

Transimt wake up signal.

This function toggles cs pin to signal wake up.

Parameters
[in]ctx: Click context object. See #stepper18_t object definition for detailed explanation.
Returns
Nothing.