silentstep4 2.1.0.0
silentstep4.h File Reference

This file contains API for Silent Step 4 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  silentstep4_s
 Silent Step 4 Click context object. More...
 
struct  silentstep4_cfg_t
 Silent Step 4 Click configuration object. More...
 

Macros

#define SILENTSTEP4_REG_GCONF   0x00
 Silent Step 4 registers.
 
#define SILENTSTEP4_REG_GSTAT   0x01
 
#define SILENTSTEP4_REG_IFCNT   0x02
 
#define SILENTSTEP4_REG_NODECONF   0x03
 
#define SILENTSTEP4_REG_IOIN   0x04
 
#define SILENTSTEP4_REG_DRV_CONF   0x0A
 
#define SILENTSTEP4_REG_GLOBAL_SCALER   0x0B
 
#define SILENTSTEP4_REG_IHOLD_IRUN   0x10
 
#define SILENTSTEP4_REG_TPOWERDOWN   0x11
 
#define SILENTSTEP4_REG_TSTEP   0x12
 
#define SILENTSTEP4_REG_TPWMTHRS   0x13
 
#define SILENTSTEP4_REG_TCOOLTHRS   0x14
 
#define SILENTSTEP4_REG_THIGH   0x15
 
#define SILENTSTEP4_REG_DIRECT_MODE   0x2D
 
#define SILENTSTEP4_REG_ENCMODE   0x38
 
#define SILENTSTEP4_REG_X_ENC   0x39
 
#define SILENTSTEP4_REG_ENC_CONST   0x3A
 
#define SILENTSTEP4_REG_ENC_STATUS   0x3B
 
#define SILENTSTEP4_REG_ENC_LATCH   0x3C
 
#define SILENTSTEP4_REG_ADC_VSUPPLY_AIN   0x50
 
#define SILENTSTEP4_REG_ADC_TEMP   0x51
 
#define SILENTSTEP4_REG_OTW_OV_VTH   0x52
 
#define SILENTSTEP4_REG_MSLUT_0   0x60
 
#define SILENTSTEP4_REG_MSLUT_1   0x61
 
#define SILENTSTEP4_REG_MSLUT_2   0x62
 
#define SILENTSTEP4_REG_MSLUT_3   0x63
 
#define SILENTSTEP4_REG_MSLUT_4   0x64
 
#define SILENTSTEP4_REG_MSLUT_5   0x65
 
#define SILENTSTEP4_REG_MSLUT_6   0x66
 
#define SILENTSTEP4_REG_MSLUT_7   0x67
 
#define SILENTSTEP4_REG_MSLUTSEL   0x68
 
#define SILENTSTEP4_REG_MSLUTSTART   0x69
 
#define SILENTSTEP4_REG_MSCNT   0x6A
 
#define SILENTSTEP4_REG_MSCURACT   0x6B
 
#define SILENTSTEP4_REG_CHOPCONF   0x6C
 
#define SILENTSTEP4_REG_COOLCONF   0x6D
 
#define SILENTSTEP4_REG_DRV_STATUS   0x6F
 
#define SILENTSTEP4_REG_PWMCONF   0x70
 
#define SILENTSTEP4_REG_PWM_SCALE   0x71
 
#define SILENTSTEP4_REG_PWM_AUTO   0x72
 
#define SILENTSTEP4_REG_SG4_THRS   0x74
 
#define SILENTSTEP4_REG_SG4_RESULT   0x75
 
#define SILENTSTEP4_REG_SG4_IND   0x76
 
#define SILENTSTEP4_PCA9538A_REG_INPUT   0x00
 Silent Step 4 PCA9538A registers.
 
#define SILENTSTEP4_PCA9538A_REG_OUTPUT   0x01
 
#define SILENTSTEP4_PCA9538A_REG_POLARITY   0x02
 
#define SILENTSTEP4_PCA9538A_REG_CONFIG   0x03
 
#define SILENTSTEP4_IOIN_VERSION_MASK   0xFF000000ul
 Silent Step 4 version settings.
 
#define SILENTSTEP4_IOIN_VERSION_DEFAULT   0x40000000ul
 
#define SILENTSTEP4_PIN_EN   0x01
 Silent Step 4 PCA9538A pin mask.
 
#define SILENTSTEP4_PIN_SLEEP   0x02
 
#define SILENTSTEP4_PIN_DIAG0   0x04
 
#define SILENTSTEP4_PIN_DIAG1   0x08
 
#define SILENTSTEP4_PIN_OV   0x10
 
#define SILENTSTEP4_PCA9538A_DEFAULT_CONFIG   0xFC
 Silent Step 4 PCA9538A pin direction config.
 
#define SILENTSTEP4_DIR_CW   0
 Silent Step 4 direction setting.
 
#define SILENTSTEP4_DIR_CCW   1
 
#define SILENTSTEP4_PIN_STATE_LOW   0
 Silent Step 4 pin logic state setting.
 
#define SILENTSTEP4_PIN_STATE_HIGH   1
 
#define SILENTSTEP4_SPEED_VERY_SLOW   0
 Silent Step 4 device speed settings.
 
#define SILENTSTEP4_SPEED_SLOW   1
 
#define SILENTSTEP4_SPEED_MEDIUM   2
 
#define SILENTSTEP4_SPEED_FAST   3
 
#define SILENTSTEP4_SPEED_VERY_FAST   4
 
#define SILENTSTEP4_TOFF_MASK   0x0000000Ful
 Silent Step 4 off time settings.
 
#define SILENTSTEP4_TOFF_SHIFT   0
 
#define SILENTSTEP4_TOFF_DRIVER_DISABLE   0
 
#define SILENTSTEP4_TOFF_MIN   1
 
#define SILENTSTEP4_TOFF_DEFAULT   4
 
#define SILENTSTEP4_TOFF_MAX   15
 
#define SILENTSTEP4_MRES_MASK   0x0F000000ul
 Silent Step 4 step resolution settings.
 
#define SILENTSTEP4_MRES_SHIFT   24
 
#define SILENTSTEP4_MRES_256   0
 
#define SILENTSTEP4_MRES_128   1
 
#define SILENTSTEP4_MRES_64   2
 
#define SILENTSTEP4_MRES_32   3
 
#define SILENTSTEP4_MRES_16   4
 
#define SILENTSTEP4_MRES_8   5
 
#define SILENTSTEP4_MRES_4   6
 
#define SILENTSTEP4_MRES_2   7
 
#define SILENTSTEP4_MRES_FULLSTEP   8
 
#define SILENTSTEP4_IRUN_MASK   0x00000F00ul
 Silent Step 4 run current settings.
 
#define SILENTSTEP4_IRUN_SHIFT   8
 
#define SILENTSTEP4_IRUN_MIN   0
 
#define SILENTSTEP4_IRUN_DEFAULT   16
 
#define SILENTSTEP4_IRUN_MAX   31
 
#define SILENTSTEP4_DEVICE_ADDRESS_A1A0_00   0x70
 Silent Step 4 device address setting.
 
#define SILENTSTEP4_DEVICE_ADDRESS_A1A0_01   0x71
 
#define SILENTSTEP4_DEVICE_ADDRESS_A1A0_10   0x72
 
#define SILENTSTEP4_DEVICE_ADDRESS_A1A0_11   0x73
 
#define SILENTSTEP4_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define SILENTSTEP4_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define SILENTSTEP4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef struct silentstep4_s silentstep4_t
 Silent Step 4 Click context object.
 

Enumerations

enum  silentstep4_return_value_t { SILENTSTEP4_OK = 0 , SILENTSTEP4_ERROR = -1 }
 Silent Step 4 Click return value data. More...
 

Functions

void silentstep4_cfg_setup (silentstep4_cfg_t *cfg)
 Silent Step 4 configuration object setup function.
 
err_t silentstep4_init (silentstep4_t *ctx, silentstep4_cfg_t *cfg)
 Silent Step 4 initialization function.
 
err_t silentstep4_default_cfg (silentstep4_t *ctx)
 Silent Step 4 default configuration function.
 
err_t silentstep4_write_reg (silentstep4_t *ctx, uint8_t reg, uint32_t data_in)
 Silent Step 4 write reg function.
 
err_t silentstep4_read_reg (silentstep4_t *ctx, uint8_t reg, uint32_t *data_out)
 Silent Step 4 read reg function.
 
err_t silentstep4_pca_write_reg (silentstep4_t *ctx, uint8_t reg, uint8_t data_in)
 Silent Step 4 pca write reg function.
 
err_t silentstep4_pca_read_reg (silentstep4_t *ctx, uint8_t reg, uint8_t *data_out)
 Silent Step 4 pca read reg function.
 
err_t silentstep4_check_com (silentstep4_t *ctx)
 Silent Step 4 check com function.
 
err_t silentstep4_get_en_pin (silentstep4_t *ctx, uint8_t *state)
 Silent Step 4 get en pin function.
 
err_t silentstep4_set_en_pin (silentstep4_t *ctx, uint8_t state)
 Silent Step 4 set en pin function.
 
err_t silentstep4_get_sleep_pin (silentstep4_t *ctx, uint8_t *state)
 Silent Step 4 get sleep pin function.
 
err_t silentstep4_set_sleep_pin (silentstep4_t *ctx, uint8_t state)
 Silent Step 4 set sleep pin function.
 
err_t silentstep4_get_diag0_pin (silentstep4_t *ctx, uint8_t *state)
 Silent Step 4 get diag0 pin function.
 
err_t silentstep4_get_diag1_pin (silentstep4_t *ctx, uint8_t *state)
 Silent Step 4 get diag1 pin function.
 
err_t silentstep4_get_ov_pin (silentstep4_t *ctx, uint8_t *state)
 Silent Step 4 get ov pin function.
 
err_t silentstep4_enable_device (silentstep4_t *ctx)
 Silent Step 4 enable device function.
 
err_t silentstep4_disable_device (silentstep4_t *ctx)
 Silent Step 4 disable device function.
 
void silentstep4_set_direction (silentstep4_t *ctx, uint8_t dir)
 Silent Step 4 set direction function.
 
void silentstep4_switch_direction (silentstep4_t *ctx)
 Silent Step 4 switch direction function.
 
void silentstep4_reset_pca (silentstep4_t *ctx)
 Silent Step 4 reset device function.
 
void silentstep4_set_rst_pin (silentstep4_t *ctx, uint8_t state)
 Silent Step 4 set rst pin function.
 
uint8_t silentstep4_get_int_pin (silentstep4_t *ctx)
 Silent Step 4 get int pin function.
 
void silentstep4_set_step_pin (silentstep4_t *ctx, uint8_t state)
 Silent Step 4 set step pin function.
 
err_t silentstep4_set_toff (silentstep4_t *ctx, uint8_t toff)
 Silent Step 4 set toff function.
 
err_t silentstep4_set_step_res (silentstep4_t *ctx, uint8_t mres)
 Silent Step 4 set step res function.
 
err_t silentstep4_set_run_current (silentstep4_t *ctx, uint8_t irun)
 Silent Step 4 set run current function.
 
void silentstep4_drive_motor (silentstep4_t *ctx, uint32_t steps, uint8_t speed)
 Silent Step 4 driver motor function.
 

Detailed Description

This file contains API for Silent Step 4 Click Driver.