stepper15 2.0.0.0
stepper15.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  stepper15_s
 Stepper 15 Click context object. More...
 
struct  stepper15_cfg_t
 Stepper 15 Click configuration object. More...
 

Macros

#define STEPPER15_REG_INPUT_PORT   0x00
 Stepper 15 description PCA9538A register.
 
#define STEPPER15_REG_OUTPUT_PORT   0x01
 
#define STEPPER15_REG_POLARITY_INVERSION   0x02
 
#define STEPPER15_REG_CONFIGURATION   0x03
 
#define STEPPER15_REG_FAULT_STATUS   0x00
 Stepper 15 description DRV8889A-Q1 register.
 
#define STEPPER15_REG_DIAG_STATUS_1   0x01
 
#define STEPPER15_REG_DIAG_STATUS_2   0x02
 
#define STEPPER15_REG_CTRL_1   0x03
 
#define STEPPER15_REG_CTRL_2   0x04
 
#define STEPPER15_REG_CTRL_3   0x05
 
#define STEPPER15_REG_CTRL_4   0x06
 
#define STEPPER15_REG_CTRL_5   0x07
 
#define STEPPER15_REG_CTRL_6   0x08
 
#define STEPPER15_REG_CTRL_7   0x09
 
#define STEPPER15_REG_CTRL_8   0x0A
 
#define STEPPER15_SET_DIRECTION_BIT_MASK   0xFB
 Stepper 15 direction description setting.
 
#define STEPPER15_SET_DIRECTION_CCW   0x00
 
#define STEPPER15_SET_DIRECTION_CW   0x04
 
#define STEPPER15_SET_WORK_MODE_BIT_MASK   0xFE
 Stepper 15 work mode description setting.
 
#define STEPPER15_SET_WORK_MODE_SLEEP   0x00
 
#define STEPPER15_SET_WORK_MODE_ENABLE_DEVICE   0x01
 
#define STEPPER15_SET_OUT_MODE_BIT_MASK   0xFD
 Stepper 15 work mode description setting.
 
#define STEPPER15_SET_OUT_MODE_DEVICE_OUTPUTS_ENABLE   0x00
 
#define STEPPER15_SET_OUT_MODE_DEVICE_OUTPUTS_DISABLE   0x02
 
#define STEPPER15_SET_CONFIG_DEFAULT   0xF8
 Stepper 15 configuration description setting.
 
#define STEPPER15_FAULT_ST_OL_MASK   0x01
 Stepper 15 IC fault status register description setting.
 
#define STEPPER15_FAULT_ST_OT_MASK   0x02
 
#define STEPPER15_FAULT_ST_STL_SLIP_MASK   0x04
 
#define STEPPER15_FAULT_ST_OCP_MASK   0x08
 
#define STEPPER15_FAULT_ST_CPUV_MASK   0x10
 
#define STEPPER15_FAULT_ST_UVLO_MASK   0x20
 
#define STEPPER15_FAULT_ST_SPI_ERROR_MASK   0x40
 
#define STEPPER15_FAULT_ST_FAULT_MASK   0x80
 
#define STEPPER15_DIAG_1_OCP_HS1_A_MASK   0x01
 Stepper 15 Diagnostic register 1 description setting.
 
#define STEPPER15_DIAG_1_OCP_LS1_A_MASK   0x02
 
#define STEPPER15_DIAG_1_OCP_HS2_A_MASK   0x04
 
#define STEPPER15_DIAG_1_OCP_LS2_A_MASK   0x08
 
#define STEPPER15_DIAG_1_OCP_HS1_B_MASK   0x10
 
#define STEPPER15_DIAG_1_OCP_LS1_B_MASK   0x20
 
#define STEPPER15_DIAG_1_OCP_HS2_B_MASK   0x40
 
#define STEPPER15_DIAG_1_OCP_LS2_B_MASK   0x80
 
#define STEPPER15_DIAG_2_OL_A_MASK   0x01
 Stepper 15 Diagnostic register 2 description setting.
 
#define STEPPER15_DIAG_2_OL_B_MASK   0x02
 
#define STEPPER15_DIAG_2_SLIP_MASK   0x04
 
#define STEPPER15_DIAG_2_STALL_MASK   0x08
 
#define STEPPER15_DIAG_2_STL_LRN_OK_MASK   0x10
 
#define STEPPER15_DIAG_2_OTS_MASK   0x20
 
#define STEPPER15_DIAG_2_OTW_MASK   0x40
 
#define STEPPER15_DIAG_2_UTW_MASK   0x80
 
#define STEPPER15_CTRL1_SLEW_RATE_MASK   0x03
 Stepper 15 CTRL1 register description setting.
 
#define STEPPER15_CTRL1_EN_NSR_MASK   0x04
 
#define STEPPER15_CTRL1_RSVD1_MASK   0x08
 
#define STEPPER15_CTRL1_TRQ_DAC_MASK   0xF0
 
#define STEPPER15_SET_CTRL1_TRQ_100   0x00
 
#define STEPPER15_SET_CTRL1_TRQ_93_75   0x10
 
#define STEPPER15_SET_CTRL1_TRQ_87_5   0x20
 
#define STEPPER15_SET_CTRL1_TRQ_81_25   0x30
 
#define STEPPER15_SET_CTRL1_TRQ_75   0x40
 
#define STEPPER15_SET_CTRL1_TRQ_68_75   0x50
 
#define STEPPER15_SET_CTRL1_TRQ_62_5   0x60
 
#define STEPPER15_SET_CTRL1_TRQ_56_25   0x70
 
#define STEPPER15_SET_CTRL1_TRQ_50   0x80
 
#define STEPPER15_SET_CTRL1_TRQ_43_75   0x90
 
#define STEPPER15_SET_CTRL1_TRQ_37_5   0xA0
 
#define STEPPER15_SET_CTRL1_TRQ_31_25   0xB0
 
#define STEPPER15_SET_CTRL1_TRQ_25   0xC0
 
#define STEPPER15_SET_CTRL1_TRQ_18_75   0xD0
 
#define STEPPER15_SET_CTRL1_TRQ_12_5   0xE0
 
#define STEPPER15_SET_CTRL1_TRQ_6_25   0xF0
 
#define STEPPER15_CTRL2_DECAY_MASK   0x07
 Stepper 15 CTRL2 register description setting.
 
#define STEPPER15_CTRL2_TOFF_MASK   0x18
 
#define STEPPER15_CTRL2_RSVD2_MASK   0x60
 
#define STEPPER15_CTRL2_DIS_OUT_MASK   0x80
 
#define STEPPER15_SET_CTRL2_OUTPUT_ENABLE   0x00
 
#define STEPPER15_SET_CTRL2_OUTPUT_DISABLE   0x80
 
#define STEPPER15_SET_CTRL2_TOFF_7_us   0x00
 
#define STEPPER15_SET_CTRL2_TOFF_16_us   0x08
 
#define STEPPER15_SET_CTRL2_TOFF_24_us   0x10
 
#define STEPPER15_SET_CTRL2_TOFF_32_us   0x18
 
#define STEPPER15_SET_CTRL2_SMART_TUNE_RIPPLE_CTRL   0x07
 
#define STEPPER15_CTRL3_MICROSTEP_MODE_MASK   0x0F
 Stepper 15 CTRL3 register description setting.
 
#define STEPPER15_CTRL3_SPI_STEP_MASK   0x10
 
#define STEPPER15_CTRL3_SPI_DIR_MASK   0x20
 
#define STEPPER15_CTRL3_STEP_MASK   0x40
 
#define STEPPER15_CTRL3_DIR_MASK   0x80
 
#define STEPPER15_SET_SPI_DIR_INPUT_PIN   0x00
 
#define STEPPER15_SET_SPI_DIR_SPI   0x80
 
#define STEPPER15_SET_SPI_STEP_INPUT_PIN   0x00
 
#define STEPPER15_SET_SPI_STEP_SPI   0x40
 
#define STEPPER15_SET_CTRL3_SET_MICROSTEP_MODE_FULL_STEP   0x00
 
#define STEPPER15_CTRL4_TW_REP_MASK   0x01
 Stepper 15 CTRL4 register description setting.
 
#define STEPPER15_CTRL4_OTSD_MODE_MASK   0x02
 
#define STEPPER15_CTRL4_OCP_MODE_MASK   0x04
 
#define STEPPER15_CTRL4_EN_OL_MASK   0x08
 
#define STEPPER15_CTRL4_LOCK_MASK   0x70
 
#define STEPPER15_CTRL4_CLR_FLT_MASK   0x80
 
#define STEPPER15_SET_CTRL4_CLR_FLT   0x80
 
#define STEPPER15_SET_CTRL4_UNLOCK_ALL_REG   0x30
 
#define STEPPER15_CTRL5_SLIP_REP_MASK   0x01
 Stepper 15 CTRL5 register description setting.
 
#define STEPPER15_CTRL5_EN_SLIP_MASK   0x02
 
#define STEPPER15_CTRL5_EN_STLFCHG_MASK   0x04
 
#define STEPPER15_CTRL5_STL_REP_MASK   0x08
 
#define STEPPER15_SET_CTRL5_REPORTED_ON_FAULT   0x08
 
#define STEPPER15_CTRL6_STALL_TH_MASK   0xFF
 Stepper 15 CTRL6 register description setting.

 
#define STEPPER15_CTRL7_STALL_TH_MASK   0xFF
 Stepper 15 CTRL7 register description setting.

 
#define STEPPER15_CTRL8_REV_ID_MASK   0x0F
 Stepper 15 CTRL8 register description setting.
 
#define STEPPER15_CTRL8_STL_UPDATE_MODE_MASK   0x10
 
#define STEPPER15_CTRL8_UTW_REP_MASK   0x20
 
#define STEPPER15_CTRL8_RSVD3_MASK   0xC0
 
#define STEPPER15_SET_DEV_ADDR   0x70
 Stepper 15 device address setting.
 
#define STEPPER15_DIRECTION_COUNTERCLOCKWISE   0
 Stepper 15 direction description setting.
 
#define STEPPER15_DIRECTION_CLOCKWISE   1
 
#define STEPPER15_WORK_MODE_SLEEP   0
 Stepper 15 work mode description setting.
 
#define STEPPER15_WORK_MODE_ENABLE_DEVICE   1
 
#define STEPPER15_OUTPUT_MODE_OUTPUTS_DISABLE   0
 Stepper 15 outpu mode description setting.
 
#define STEPPER15_OUTPUT_MODE_OUTPUTS_ENABLE   1
 
#define STEPPER15_FAULT_CONDITION   0
 Stepper 15 fault condition state description setting.
 
#define STEPPER15_CORRECT_CONDITION   1
 
#define STEPPER15_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef struct stepper15_s stepper15_t
 Stepper 15 Click context object.
 

Enumerations

enum  stepper15_return_value_t { STEPPER15_OK = 0 , STEPPER15_ERROR = -1 }
 Stepper 15 Click return value data. More...
 

Functions

void stepper15_cfg_setup (stepper15_cfg_t *cfg)
 Stepper 15 configuration object setup function.
 
err_t stepper15_init (stepper15_t *ctx, stepper15_cfg_t *cfg)
 Stepper 15 initialization function.
 
err_t stepper15_default_cfg (stepper15_t *ctx)
 Stepper 15 default configuration function.
 
err_t stepper15_i2c_write (stepper15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Stepper 15 I2C writing function.
 
err_t stepper15_i2c_read (stepper15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Stepper 15 I2C reading function.
 
err_t stepper15_spi_write (stepper15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Stepper 15 SPI writing function.
 
err_t stepper15_spi_read (stepper15_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 15 SPI reading function.
 
void stepper15_reset (stepper15_t *ctx)
 Stepper 15 reset function.
 
void stepper15_motor_stop (stepper15_t *ctx)
 Stepper 15 motor stop function.
 
uint8_t stepper15_get_interrupt (stepper15_t *ctx)
 Stepper 15 get interrupt function.
 
err_t stepper15_make_one_step (stepper15_t *ctx, uint8_t step_speed)
 Stepper 15 make one step function.
 
err_t stepper15_set_direction (stepper15_t *ctx, uint8_t direction)
 Stepper 15 set direction function.
 
err_t stepper15_set_work_mode (stepper15_t *ctx, uint8_t work_mode)
 Stepper 15 set work mode function.
 
err_t stepper15_set_output_mode (stepper15_t *ctx, uint8_t output_mode)
 Stepper 15 set output mode function.
 
err_t stepper15_set_torque_dac (stepper15_t *ctx, uint8_t trq_data)
 Stepper 15 set torque DAC function.
 
err_t stepper15_set_counts (stepper15_t *ctx, uint8_t counts)
 Stepper 15 set counts function.
 
uint8_t stepper15_get_fault_condition (stepper15_t *ctx)
 Stepper 15 get fault condition function.
 
err_t stepper15_step_by_angle (stepper15_t *ctx, uint8_t step_speed, float angle, uint16_t step_360)
 Stepper 15 step by angle function.
 

Detailed Description

This file contains API for Stepper 15 Click Driver.

Typedef Documentation

◆ stepper15_t

typedef struct stepper15_s stepper15_t

Stepper 15 Click context object.

Context object definition of Stepper 15 Click driver.

Enumeration Type Documentation

◆ stepper15_return_value_t

Stepper 15 Click return value data.

Predefined enum values for driver return values.

Enumerator
STEPPER15_OK 
STEPPER15_ERROR