stepper5 2.1.0.0
stepper5.h File Reference

This file contains API for Stepper 5 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  stepper5_t
 Stepper 5 Click context object. More...
 
struct  stepper5_cfg_t
 Stepper 5 Click configuration object. More...
 

Macros

#define STEPPER5_REG_GCONF   0x00
 Stepper 5 registers.
 
#define STEPPER5_REG_GSTAT   0x01
 
#define STEPPER5_REG_IFCNT   0x02
 
#define STEPPER5_REG_SLAVECONF   0x03
 
#define STEPPER5_REG_OTP_PROG   0x04
 
#define STEPPER5_REG_OTP_READ   0x05
 
#define STEPPER5_REG_IOIN   0x06
 
#define STEPPER5_REG_FACTORY_CONF   0x07
 
#define STEPPER5_REG_IHOLD_IRUN   0x10
 
#define STEPPER5_REG_TPOWERDOWN   0x11
 
#define STEPPER5_REG_TSTEP   0x12
 
#define STEPPER5_REG_TPWMTHRS   0x13
 
#define STEPPER5_REG_VACTUAL   0x22
 
#define STEPPER5_REG_MSCNT   0x6A
 
#define STEPPER5_REG_MSCURACT   0x6B
 
#define STEPPER5_REG_CHOPCONF   0x6C
 
#define STEPPER5_REG_COOLCONF   0x6D
 
#define STEPPER5_REG_DRV_STATUS   0x6F
 
#define STEPPER5_REG_PWMCONF   0x70
 
#define STEPPER5_REG_PWM_SCALE   0x71
 
#define STEPPER5_REG_PWM_AUTO   0x72
 
#define STEPPER5_IOIN_VERSION_MASK   0xFF000000ul
 Stepper 5 version settings.
 
#define STEPPER5_IOIN_VERSION_DEFAULT   0x20000000ul
 
#define STEPPER5_DIR_CW   0
 Stepper 5 direction setting.
 
#define STEPPER5_DIR_CCW   1
 
#define STEPPER5_PIN_STATE_LOW   0
 Stepper 5 pin logic state setting.
 
#define STEPPER5_PIN_STATE_HIGH   1
 
#define STEPPER5_SPEED_VERY_SLOW   0
 Stepper 5 device speed settings.
 
#define STEPPER5_SPEED_SLOW   1
 
#define STEPPER5_SPEED_MEDIUM   2
 
#define STEPPER5_SPEED_FAST   3
 
#define STEPPER5_SPEED_VERY_FAST   4
 
#define STEPPER5_GCONF_I_SCALE_ANALOG_INT_5V   0x00000000ul
 Stepper 5 GCONF register settings.
 
#define STEPPER5_GCONF_I_SCALE_ANALOG_EXT_VREF   0x00000001ul
 
#define STEPPER5_GCONF_INTERNAL_RSENSE_EXT   0x00000000ul
 
#define STEPPER5_GCONF_INTERNAL_RSENSE_INT   0x00000002ul
 
#define STEPPER5_GCONF_EN_SPREAD_CYCLE_SCHOP   0x00000000ul
 
#define STEPPER5_GCONF_EN_SPREAD_CYCLE_SCYCLE   0x00000004ul
 
#define STEPPER5_GCONF_SHAFT_INVERSE   0x00000008ul
 
#define STEPPER5_GCONF_INDEX_OTPW_FIRST_MSTEP   0x00000000ul
 
#define STEPPER5_GCONF_INDEX_OTPW_OVERTEMP   0x00000010ul
 
#define STEPPER5_GCONF_INDEX_STEP_OTPW   0x00000000ul
 
#define STEPPER5_GCONF_INDEX_STEP_INT   0x00000020ul
 
#define STEPPER5_GCONF_PDN_DISABLE_SSC_REDUCT   0x00000000ul
 
#define STEPPER5_GCONF_PDN_DISABLE_UART_EN   0x00000040ul
 
#define STEPPER5_GCONF_MSTEP_REG_SELECT_MS_PINS   0x00000000ul
 
#define STEPPER5_GCONF_MSTEP_REG_SELECT_MSTEP   0x00000080ul
 
#define STEPPER5_GCONF_MULTISTEP_FILT_DIS   0x00000000ul
 
#define STEPPER5_GCONF_MULTISTEP_FILT_EN   0x00000100ul
 
#define STEPPER5_GCONF_TEST_MODE_NORMAL   0x00000000ul
 
#define STEPPER5_GCONF_TEST_MODE_ENN   0x00000200ul
 
#define STEPPER5_TOFF_MASK   0x0000000Ful
 Stepper 5 off time settings.
 
#define STEPPER5_TOFF_SHIFT   0
 
#define STEPPER5_TOFF_DRIVER_DISABLE   0
 
#define STEPPER5_TOFF_MIN   1
 
#define STEPPER5_TOFF_DEFAULT   4
 
#define STEPPER5_TOFF_MAX   15
 
#define STEPPER5_MRES_MASK   0x0F000000ul
 Stepper 5 step resolution settings.
 
#define STEPPER5_MRES_SHIFT   24
 
#define STEPPER5_MRES_256   0
 
#define STEPPER5_MRES_128   1
 
#define STEPPER5_MRES_64   2
 
#define STEPPER5_MRES_32   3
 
#define STEPPER5_MRES_16   4
 
#define STEPPER5_MRES_8   5
 
#define STEPPER5_MRES_4   6
 
#define STEPPER5_MRES_2   7
 
#define STEPPER5_MRES_FULLSTEP   8
 
#define STEPPER5_IRUN_MASK   0x00000F00ul
 Stepper 5 run current settings.
 
#define STEPPER5_IRUN_SHIFT   8
 
#define STEPPER5_IRUN_MIN   0
 
#define STEPPER5_IRUN_DEFAULT   16
 
#define STEPPER5_IRUN_MAX   31
 
#define STEPPER5_UART_SYNC_BYTE   0x05
 Stepper 5 UART settings.
 
#define STEPPER5_UART_SLAVE_ADDRESS   0x00
 
#define STEPPER5_UART_WRITE_BIT   0x80
 
#define STEPPER5_TX_DRV_BUFFER_SIZE   100
 Stepper 5 driver buffer size.
 
#define STEPPER5_RX_DRV_BUFFER_SIZE   300
 
#define STEPPER5_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  stepper5_return_value_t { STEPPER5_OK = 0 , STEPPER5_ERROR = -1 }
 Stepper 5 Click return value data. More...
 

Functions

void stepper5_cfg_setup (stepper5_cfg_t *cfg)
 Stepper 5 configuration object setup function.
 
err_t stepper5_init (stepper5_t *ctx, stepper5_cfg_t *cfg)
 Stepper 5 initialization function.
 
err_t stepper5_default_cfg (stepper5_t *ctx)
 Stepper 5 default configuration function.
 
void stepper5_write_reg (stepper5_t *ctx, uint8_t reg, uint32_t data_in)
 Stepper 5 write reg function.
 
err_t stepper5_read_reg (stepper5_t *ctx, uint8_t reg, uint32_t *data_out)
 Stepper 5 read reg function.
 
err_t stepper5_check_com (stepper5_t *ctx)
 Stepper 5 check com function.
 
void stepper5_enable_device (stepper5_t *ctx)
 Stepper 5 enable device function.
 
void stepper5_disable_device (stepper5_t *ctx)
 Stepper 5 disable device function.
 
void stepper5_set_direction (stepper5_t *ctx, uint8_t dir)
 Stepper 5 set direction function.
 
void stepper5_switch_direction (stepper5_t *ctx)
 Stepper 5 switch direction function.
 
void stepper5_set_step_pin (stepper5_t *ctx, uint8_t state)
 Stepper 5 set step pin function.
 
uint8_t stepper5_get_diag_pin (stepper5_t *ctx)
 Stepper 5 get diag pin function.
 
uint8_t stepper5_get_index_pin (stepper5_t *ctx)
 Stepper 5 get index pin function.
 
err_t stepper5_set_toff (stepper5_t *ctx, uint8_t toff)
 Stepper 5 set toff function.
 
err_t stepper5_set_step_res (stepper5_t *ctx, uint8_t mres)
 Stepper 5 set step res function.
 
err_t stepper5_set_run_current (stepper5_t *ctx, uint8_t irun)
 Stepper 5 set run current function.
 
void stepper5_drive_motor (stepper5_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 5 driver motor function.
 

Detailed Description

This file contains API for Stepper 5 Click Driver.

Enumeration Type Documentation

◆ stepper5_return_value_t

Stepper 5 Click return value data.

Predefined enum values for driver return values.

Enumerator
STEPPER5_OK 
STEPPER5_ERROR