vibromotor4 2.0.0.0
vibromotor4.h File Reference

This file contains API for Vibro Motor 4 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_i2c_master.h"
#include "drv_pwm.h"

Go to the source code of this file.

Data Structures

struct  vibromotor4_t
 Vibro Motor 4 Click context object. More...
 
struct  vibromotor4_cfg_t
 Vibro Motor 4 Click configuration object. More...
 

Macros

#define VIBROMOTOR4_STATUS   0x00
 Vibro Motor 4 description register.
 
#define VIBROMOTOR4_MODE   0x01
 
#define VIBROMOTOR4_RT_PB_IN   0x02
 
#define VIBROMOTOR4_LIB_SEL   0x03
 
#define VIBROMOTOR4_WV_SEQ_1   0x04
 
#define VIBROMOTOR4_WV_SEQ_2   0x05
 
#define VIBROMOTOR4_WV_SEQ_3   0x06
 
#define VIBROMOTOR4_WV_SEQ_4   0x07
 
#define VIBROMOTOR4_WV_SEQ_5   0x08
 
#define VIBROMOTOR4_WV_SEQ_6   0x09
 
#define VIBROMOTOR4_WV_SEQ_7   0x0A
 
#define VIBROMOTOR4_WV_SEQ_8   0x0B
 
#define VIBROMOTOR4_REG_GO   0x0C
 
#define VIBROMOTOR4_OVERDRIVE_OFFS   0x0D
 
#define VIBROMOTOR4_SUSTAIN_P_OFFS   0x0E
 
#define VIBROMOTOR4_SUSTAIN_N_OFFS   0x0F
 
#define VIBROMOTOR4_BRAKE_OFF   0x10
 
#define VIBROMOTOR4_A_TO_V_CTRL   0x11
 
#define VIBROMOTOR4_A_TO_V_MIN_INPUT   0x12
 
#define VIBROMOTOR4_A_TO_V_MAX_INPUT   0x13
 
#define VIBROMOTOR4_A_TO_V_MIN_OUT   0x14
 
#define VIBROMOTOR4_A_TO_V_MAX_OUT   0x15
 
#define VIBROMOTOR4_RATED_VOLT   0x16
 
#define VIBROMOTOR4_OD_CLAMP_VOLT   0x17
 
#define VIBROMOTOR4_CAL_COMP   0x18
 
#define VIBROMOTOR4_CAL_BACK_EMF   0x19
 
#define VIBROMOTOR4_FEEDBACK_CTRL   0x1A
 
#define VIBROMOTOR4_CTRL1   0x1B
 
#define VIBROMOTOR4_CTRL2   0x1C
 
#define VIBROMOTOR4_CTRL3   0x1D
 
#define VIBROMOTOR4_CTRL4   0x1E
 
#define VIBROMOTOR4_CTRL5   0x1F
 
#define VIBROMOTOR4_LRA_LOOP_PERIOD   0x20
 
#define VIBROMOTOR4_VBAT_MON   0x21
 
#define VIBROMOTOR4_LRA_RES_PERIOD   0x22
 
#define VIBROMOTOR4_STARTPPBOOST   0x80
 Vibro Motor 4 description setting.
 
#define VIBROMOTOR4_BYPASSCOMP   0x40
 
#define VIBROMOTOR4_AC_COUPLE   0x20
 
#define VIBROMOTOR4_DC_COUPLE   0x00
 
#define VIBROMOTOR4_DRV_TIME_0P5M   0x00
 
#define VIBROMOTOR4_DRV_TIME_0P6M   0x01
 
#define VIBROMOTOR4_DRV_TIME_0P7M   0x02
 
#define VIBROMOTOR4_DRV_TIME_0P8M   0x03
 
#define VIBROMOTOR4_DRV_TIME_0P9M   0x04
 
#define VIBROMOTOR4_DRV_TIME_1P0M   0x05
 
#define VIBROMOTOR4_DRV_TIME_1P1M   0x06
 
#define VIBROMOTOR4_DRV_TIME_1P2M   0x07
 
#define VIBROMOTOR4_DRV_TIME_1P3M   0x08
 
#define VIBROMOTOR4_DRV_TIME_1P4M   0x09
 
#define VIBROMOTOR4_DRV_TIME_1P5M   0x0A
 
#define VIBROMOTOR4_DRV_TIME_1P6M   0x0B
 
#define VIBROMOTOR4_DRV_TIME_1P7M   0x0C
 
#define VIBROMOTOR4_DRV_TIME_1P8M   0x0D
 
#define VIBROMOTOR4_DRV_TIME_1P9M   0x0E
 
#define VIBROMOTOR4_DRV_TIME_2P0M   0x0F
 
#define VIBROMOTOR4_DRV_TIME_2P1M   0x10
 
#define VIBROMOTOR4_DRV_TIME_2P2M   0x11
 
#define VIBROMOTOR4_DRV_TIME_2P3M   0x12
 
#define VIBROMOTOR4_DRV_TIME_2P4M   0x13
 
#define VIBROMOTOR4_DRV_TIME_2P5M   0x14
 
#define VIBROMOTOR4_DRV_TIME_2P6M   0x15
 
#define VIBROMOTOR4_DRV_TIME_2P7M   0x16
 
#define VIBROMOTOR4_DRV_TIME_2P8M   0x17
 
#define VIBROMOTOR4_DRV_TIME_2P9M   0x18
 
#define VIBROMOTOR4_DRV_TIME_3P0M   0x19
 
#define VIBROMOTOR4_DRV_TIME_3P1M   0x1A
 
#define VIBROMOTOR4_DRV_TIME_3P2M   0x1B
 
#define VIBROMOTOR4_DRV_TIME_3P3M   0x1C
 
#define VIBROMOTOR4_DRV_TIME_3P4M   0x1D
 
#define VIBROMOTOR4_DRV_TIME_3P5M   0x1E
 
#define VIBROMOTOR4_DRV_TIME_3P6M   0x1F
 
#define VIBROMOTOR4_BIDIR_IN   0x80
 
#define VIBROMOTOR4_UNIDIR_IN   0x00
 
#define VIBROMOTOR4_BRK_STABIL   0x40
 
#define VIBROMOTOR4_SAMP_TIME_150US   0x00
 
#define VIBROMOTOR4_SAMP_TIME_200US   0x10
 
#define VIBROMOTOR4_SAMP_TIME_250US   0x20
 
#define VIBROMOTOR4_SAMP_TIME_300US   0x30
 
#define VIBROMOTOR4_BLANK_TIME_V_SHORT   0x00
 
#define VIBROMOTOR4_BLANK_TIME_SHORT   0x04
 
#define VIBROMOTOR4_BLANK_TIME_MEDIUM   0x08
 
#define VIBROMOTOR4_BLANK_TIME_LONG   0x0C
 
#define VIBROMOTOR4_I_DIS_TIME_V_SHORT   0x00
 
#define VIBROMOTOR4_I_DIS_TIME_SHORT   0x01
 
#define VIBROMOTOR4_I_DIS_TIME_MEDIUM   0x02
 
#define VIBROMOTOR4_I_DIS_TIME_LONG   0x03
 
#define VIBROMOTOR4_NG_THRESH_OFF   0x00
 
#define VIBROMOTOR4_NG_THRESH_2_PERC   0x40
 
#define VIBROMOTOR4_NG_THRESH_4_PERC   0x80
 
#define VIBROMOTOR4_NG_THRESH_8_PERC   0xC0
 
#define VIBROMOTOR4_ERM_CLOSED_LOOP   0x00
 
#define VIBROMOTOR4_ERM_OPEN_LOOP   0x20
 
#define VIBROMOTOR4_SUP_COMP_DIS   0x10
 
#define VIBROMOTOR4_DATA_FORM_RTP_SIG   0x00
 
#define VIBROMOTOR4_DATA_FORM_RTP_UNS   0x08
 
#define VIBROMOTOR4_LRADRV_MODE   0x04
 
#define VIBROMOTOR4_LRADRV_MODE_ONCE   0x00
 
#define VIBROMOTOR4_LRADRV_MODE_TWICE   0x04
 
#define VIBROMOTOR4_IN_MODE_PWM   0x00
 
#define VIBROMOTOR4_IN_MODE_ANALOG   0x02
 
#define VIBROMOTOR4_LRA_AUTO_RESONA   0x00
 
#define VIBROMOTOR4_LRA_OPEN_LOOP   0x01
 
#define VIBROMOTOR4_LRA_CLOSED_LOOP   0x00
 
#define VIBROMOTOR4_DEV_RESRT   0x80
 Vibro Motor 4 Mode register bits.
 
#define VIBROMOTOR4_STANDBY   0x40
 
#define VIBROMOTOR4_ACTIVE   0x00
 
#define VIBROMOTOR4_INT_TRIG   0x00
 
#define VIBROMOTOR4_EXT_TRIG_EDGE   0x01
 
#define VIBROMOTOR4_EXT_TRIG_LEVEL   0x02
 
#define VIBROMOTOR4_PWM_ANALOG   0x03
 
#define VIBROMOTOR4_AUDIO2HAPTIC   0x04
 
#define VIBROMOTOR4_RTP   0x05
 
#define VIBROMOTOR4_DIAGNOSTICS   0x06
 
#define VIBROMOTOR4_AUTO_CALIBRATION   0x07
 
#define VIBROMOTOR4_HIZ   0x10
 Vibro Motor 4 Library selection register bits.
 
#define VIBROMOTOR4_RAM   0x00
 
#define VIBROMOTOR4_ROM_A   0x01
 
#define VIBROMOTOR4_ROM_B   0x02
 
#define VIBROMOTOR4_ROM_C   0x03
 
#define VIBROMOTOR4_ROM_D   0x04
 
#define VIBROMOTOR4_ROM_E   0x05
 
#define VIBROMOTOR4_ROM_LRA   0x06
 
#define VIBROMOTOR4_STOP   0x00
 Vibro Motor 4 GO register bits.
 
#define VIBROMOTOR4_GO   0x01
 
#define VIBROMOTOR4_ERM_MODE   0x00
 Vibro Motor 4 Feedback control register bits.
 
#define VIBROMOTOR4_LRA_MODE   0x80
 
#define VIBROMOTOR4_FB_BRAKE_FAC_1X   0x00
 
#define VIBROMOTOR4_FB_BRAKE_FAC_2X   0x10
 
#define VIBROMOTOR4_FB_BRAKE_FAC_3X   0x20
 
#define VIBROMOTOR4_FB_BRAKE_FAC_4X   0x30
 
#define VIBROMOTOR4_FB_BRAKE_FAC_6X   0x40
 
#define VIBROMOTOR4_FB_BRAKE_FAC_8X   0x50
 
#define VIBROMOTOR4_FB_BRAKE_FAC_16X   0x60
 
#define VIBROMOTOR4_FB_BRAKE_FAC_DIS   0x70
 
#define VIBROMOTOR4_LOOP_RESP_SLOW   0x00
 
#define VIBROMOTOR4_LOOP_RESP_MEDIUM   0x04
 
#define VIBROMOTOR4_LOOP_RESP_FAST   0x08
 
#define VIBROMOTOR4_LOOP_RESP_V_FAST   0x0C
 
#define VIBROMOTOR4_BEMF_GAIN_ERM_0P3X   0x00
 
#define VIBROMOTOR4_BEMF_GAIN_ERM_1X   0x01
 
#define VIBROMOTOR4_BEMF_GAIN_ERM_1P8X   0x02
 
#define VIBROMOTOR4_BEMF_GAIN_ERM_4X   0x03
 
#define VIBROMOTOR4_BEMF_GAIN_LRA_5X   0x00
 
#define VIBROMOTOR4_BEMF_GAIN_LRA_10X   0x01
 
#define VIBROMOTOR4_BEMF_GAIN_LRA_20X   0x02
 
#define VIBROMOTOR4_BEMF_GAIN_LRA_30X   0x03
 
#define VIBROMOTOR4_AUTO_CAL_TIME_150ms   0x00
 Vibro Motor 4 Auto calibration memory interface register.
 
#define VIBROMOTOR4_AUTO_CAL_TIME_250ms   0x10
 
#define VIBROMOTOR4_AUTO_CAL_TIME_500ms   0x20
 
#define VIBROMOTOR4_AUTO_CAL_TIME_1000ms   0x30
 
#define VIBROMOTOR4_OTP_PROG   0x01
 
#define VIBROMOTOR4_SET_DEV_ADDR   0x5A
 Vibro Motor 4 device address setting.
 
#define VIBROMOTOR4_DEFAULT_FREQUENCY   175
 Vibro Motor 4 default PWM frequency.
 
#define VIBROMOTOR4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  vibromotor4_return_value_t { VIBROMOTOR4_OK = 0 , VIBROMOTOR4_ERROR = -1 }
 Vibro Motor 4 Click return value data. More...
 
enum  vibromotor4_property_mode_t { VIBROMOTOR4_PROPERTY_DISABLE = 0 , VIBROMOTOR4_PROPERTY_ENABLE }
 Vibro Motor 4 Click property data. More...
 

Functions

void vibromotor4_cfg_setup (vibromotor4_cfg_t *cfg)
 Vibro Motor 4 configuration object setup function.
 
err_t vibromotor4_init (vibromotor4_t *ctx, vibromotor4_cfg_t *cfg)
 Vibro Motor 4 initialization function.
 
err_t vibromotor4_default_cfg (vibromotor4_t *ctx)
 Vibro Motor 4 default configuration function.
 
err_t vibromotor4_generic_write (vibromotor4_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Vibro Motor 4 I2C writing function.
 
err_t vibromotor4_generic_read (vibromotor4_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Vibro Motor 4 I2C reading function.
 
err_t vibromotor4_enable (vibromotor4_t *ctx, vibromotor4_property_mode_t pr_mode)
 Vibro Motor 4 enable the device function.
 
err_t vibromotor4_write_byte (vibromotor4_t *ctx, uint8_t reg, uint8_t tx_buf)
 Vibro Motor 4 I2C writing function.
 
err_t vibromotor4_read_byte (vibromotor4_t *ctx, uint8_t reg, uint8_t *rx_buf)
 Vibro Motor 4 I2C reading function.
 
err_t vibromotor4_set_mode (vibromotor4_t *ctx, uint8_t mode_sel)
 Vibro Motor 4 sets the desired mode function.
 
err_t vibromotor4_soft_rst (vibromotor4_t *ctx)
 Vibro Motor 4 software reset function.
 
err_t vibromotor4_stb_mode (vibromotor4_t *ctx, uint8_t state)
 Vibro Motor 4 software standby mode function.
 
err_t vibromotor4_get_stat (vibromotor4_t *ctx, uint8_t *status)
 Vibro Motor 4 get status function.
 
err_t vibromotor4_set_rtp_input (vibromotor4_t *ctx, uint8_t rtp_input)
 Vibro Motor 4 sets the desired input for RTP mode function.
 
err_t vibromotor4_set_state_hi_z (vibromotor4_t *ctx, uint8_t state)
 Vibro Motor 4 sets the devices in HI-Z state function.
 
err_t vibromotor4_set_library (vibromotor4_t *ctx, uint8_t lib_sel)
 Vibro Motor 4 sets the desired vibrating patterns library function.
 
err_t vibromotor4_start_motor (vibromotor4_t *ctx, uint8_t state)
 Vibro Motor 4 starts the motor function.
 
err_t vibromotor4_set_ovdr_offset (vibromotor4_t *ctx, uint8_t ovdr_offset)
 Vibro Motor 4 sets overdrive offset function.
 
err_t vibromotor4_set_sustain_offset_pos (vibromotor4_t *ctx, uint8_t sustain_offset_pos)
 Vibro Motor 4 sets sustain offset - positive function.
 
err_t vibromotor4_set_sustain_offset_neg (vibromotor4_t *ctx, uint8_t sustain_offset_neg)
 Vibro Motor 4 sets sustain offset - negative function.
 
err_t vibromotor4_set_brake_time_offset (vibromotor4_t *ctx, uint8_t brake_time_offset)
 Vibro Motor 4 sets brake time offset function.
 
err_t vibromotor4_set_rated_volt (vibromotor4_t *ctx, uint8_t rated_volt)
 Vibro Motor 4 sets reference voltage function.
 
err_t vibromotor4_set_ovdrv_clamp_volt (vibromotor4_t *ctx, uint8_t ovdrv_clamp_volt)
 Vibro Motor 4 sets a clamp function.
 
err_t vibromotor4_get_calib_res_comp (vibromotor4_t *ctx, uint8_t *calib_res_comp)
 Vibro Motor 4 get voltage-compensation function.
 
err_t vibromotor4_get_supply_volt_val (vibromotor4_t *ctx, float *supply_volt)
 Vibro Motor 4 get the supply voltage function.
 
err_t vibromotor4_get_lra_resonance_period (vibromotor4_t *ctx, float *lra_res)
 Vibro Motor 4 get the measurement of the LRA resonance period function.
 
err_t vibromotor4_set_lra_mode (vibromotor4_t *ctx, uint8_t lra_mode)
 Vibro Motor 4 sets the device in LRA mode function.
 
err_t vibromotor4_set_brake_factor (vibromotor4_t *ctx, uint8_t brk_fac)
 Vibro Motor 4 set brake factor function.
 
err_t vibromotor4_set_loop_gain (vibromotor4_t *ctx, uint8_t gain)
 Vibro Motor 4 selects a loop gain function.
 
err_t vibromotor4_set_input (vibromotor4_t *ctx, uint8_t state)
 Vibro Motor 4 sets the input to PWM or analog function.
 
err_t vibromotor4_enable_ac_coulping (vibromotor4_t *ctx)
 Vibro Motor 4 enable AC coulping function.
 
err_t vibromotor4_set_duty_cycle (vibromotor4_t *ctx, float duty_cycle)
 Vibro Motor 4 sets PWM duty cycle.
 
err_t vibromotor4_pwm_stop (vibromotor4_t *ctx)
 Vibro Motor 4 stop PWM module.
 
err_t vibromotor4_pwm_start (vibromotor4_t *ctx)
 Vibro Motor 4 start PWM module.
 

Detailed Description

This file contains API for Vibro Motor 4 Click Driver.

Enumeration Type Documentation

◆ vibromotor4_property_mode_t

Vibro Motor 4 Click property data.

Predefined enum values for driver property values.

Enumerator
VIBROMOTOR4_PROPERTY_DISABLE 
VIBROMOTOR4_PROPERTY_ENABLE 

◆ vibromotor4_return_value_t

Vibro Motor 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
VIBROMOTOR4_OK 
VIBROMOTOR4_ERROR