haptic 2.0.0.0
Public function

Functions

void haptic_cfg_setup (haptic_cfg_t *cfg)
 Config Object Initialization function.
 
HAPTIC_RETVAL haptic_init (haptic_t *ctx, haptic_cfg_t *cfg)
 Initialization function.
 
void haptic_generic_write (haptic_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void haptic_generic_read (haptic_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void haptic_enable (haptic_t *ctx)
 Enable the device function.
 
void haptic_disable (haptic_t *ctx)
 Disable the device function.
 
void haptic_write_byte (haptic_t *ctx, uint8_t reg_address, uint8_t write_data)
 Generic write the byte of data function.
 
uint8_t haptic_read_byte (haptic_t *ctx, uint8_t reg_address)
 Generic read the byte of data function.
 
void haptic_set_mode (haptic_t *ctx, uint8_t sel_mode)
 Sets the Haptic click to desired mode function.
 
void haptic_soft_reset (haptic_t *ctx)
 Resets all the registers function.
 
uint8_t haptic_get_status (haptic_t *ctx)
 Get status register value function.
 
void haptic_set_rtp_input (haptic_t *ctx, uint8_t input)
 Sets the desired input for RTP mode function.
 
void haptic_set_state_hi (haptic_t *ctx)
 Generic read function.
 
uint8_t haptic_set_library (haptic_t *ctx, uint8_t library)
 Sets the desired library of vibrating patterns to read function.
 
void haptic_start_motor (haptic_t *ctx)
 Starts moving the motor function.
 
void haptic_set_overdrive_offset (haptic_t *ctx, uint8_t temp_data)
 Sets overdrive offset function.
 
void haptic_set_sustain_offset_positive (haptic_t *ctx, uint8_t temp_data)
 Sets desired sustain offset - positive function.
 
void haptic_set_sustain_offset_negative (haptic_t *ctx, uint8_t temp_data)
 Sets desired sustain offset - negative function.
 
void haptic_set_brake_time_offset (haptic_t *ctx, uint8_t temp_data)
 Sets desired brake time offset function.
 
void haptic_set_audio_minimum_input (haptic_t *ctx, uint8_t temp_data)
 Sets minimum input for audio to vibe mode function.
 
void haptic_set_audio_maximum_input (haptic_t *ctx, uint8_t temp_data)
 Sets maximum input for audio to vibe mode function.
 
void haptic_set_audio_minimum_output (haptic_t *ctx, uint8_t temp_data)
 Sets minimum output for audio to vibe mode function.
 
void haptic_set_audio_maximum_output (haptic_t *ctx, uint8_t temp_data)
 Sets maximum output for audio to vibe mode function.
 
void haptic_set_rated_voltage (haptic_t *ctx, uint8_t temp_data)
 Sets the reference voltage function.
 
void haptic_set_overdrive_clamp_voltage (haptic_t *ctx, uint8_t temp_data)
 Sets a clamp function.
 
uint8_t haptic_set_audio_peak_time (haptic_t *ctx, uint8_t temp_data)
 Sets the peak detection time function.
 
uint8_t haptic_set_audio_low_pass_filter (haptic_t *ctx, uint8_t temp_data)
 Sets the low-pass filter frequency function.
 
uint8_t haptic_get_calibration_result_comp (haptic_t *ctx)
 Reads the voltage-compensation function.
 
uint8_t haptic_get_calibration_result_emf (haptic_t *ctx)
 Reads the rated back - EMF function.
 
uint8_t haptic_get_supply_voltage_value (haptic_t *ctx)
 Reading of the supply voltage function.
 
uint8_t haptic_get_lra_resonance_period (haptic_t *ctx)
 Reads the measurement of the LRA resonance period function.
 
void haptic_set_to_erm_mode (haptic_t *ctx)
 Sets the Haptic click in ERM mode function.
 
void haptic_set_to_lra_mode (haptic_t *ctx)
 Sets the Haptic click in LRA mode function.
 
uint8_t haptic_setBrakeFactor (haptic_t *ctx, uint8_t brake_factor)
 Sets the feedback gain ratio function.
 
uint8_t haptic_set_loop_gain (haptic_t *ctx, uint8_t gain)
 Selects a loop gain function.
 
void haptic_set_input_to_analog (haptic_t *ctx)
 Sets the input to analog function.
 
void haptic_set_input_to_pwm (haptic_t *ctx)
 Sets the input for PWM control function.
 
void haptic_set_sequence (haptic_t *ctx, uint8_t temp_data)
 Sets the waveform identifier function.
 
void haptic_enable_ac_coulping (haptic_t *ctx)
 Applies a 0.9-V common mode voltage function.
 
void haptic_set_duty_cycle (haptic_t *ctx, float duty_cycle)
 Generic sets PWM duty cycle.
 
void haptic_pwm_stop (haptic_t *ctx)
 Stop PWM module.
 
void haptic_pwm_start (haptic_t *ctx)
 Start PWM module.
 

Detailed Description

Function Documentation

◆ haptic_cfg_setup()

void haptic_cfg_setup ( haptic_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ haptic_disable()

void haptic_disable ( haptic_t * ctx)

Disable the device function.

Parameters
ctxClick object.

@description Function disable the device function on the DRV2605 chip by clear RST pin ( low ) on Haptic Click board.

◆ haptic_enable()

void haptic_enable ( haptic_t * ctx)

Enable the device function.

Parameters
ctxClick object.

@description Function enable the device on the DRV2605 chip by set RST pin ( high ) on Haptic Click board.

Note
After calling this function, you must call delay for approximately 200 ms.

◆ haptic_enable_ac_coulping()

void haptic_enable_ac_coulping ( haptic_t * ctx)

Applies a 0.9-V common mode voltage function.

Parameters
ctxClick object.

@description Function applies a 0.9-V common mode voltage to the IN/TRIG pin by write value of 0xB3 to control 1 register address of DRV2605 chip on Haptic Click board.

◆ haptic_generic_read()

void haptic_generic_read ( haptic_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ haptic_generic_write()

void haptic_generic_write ( haptic_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ haptic_get_calibration_result_comp()

uint8_t haptic_get_calibration_result_comp ( haptic_t * ctx)

Reads the voltage-compensation function.

Parameters
ctxClick object.
Returns
result
8-bit value contained in the register

@description Function get the voltage-compensation result after execution of auto calibration by read value from the target register address of DRV2605 chip on Haptic Click board.

◆ haptic_get_calibration_result_emf()

uint8_t haptic_get_calibration_result_emf ( haptic_t * ctx)

Reads the rated back - EMF function.

Parameters
ctxClick object.
Returns
result 8-bit value contained in the register

@description Function get the rated back - EMF result after execution of auto calibration by read value from the target register address of DRV2605 chip on Haptic Click board.

◆ haptic_get_lra_resonance_period()

uint8_t haptic_get_lra_resonance_period ( haptic_t * ctx)

Reads the measurement of the LRA resonance period function.

Parameters
ctxClick object.
Returns
result 8-bit voltage on VDD pin

@description Function gets the measurement of the LRA resonance period by read value from the LRA resonance register of DRV2605 chip on Haptic Click board.

Note
The device must be actively sending a waveform to take a reading.

◆ haptic_get_status()

uint8_t haptic_get_status ( haptic_t * ctx)

Get status register value function.

Parameters
ctxClick object.
Returns
result 8-bit read status data.

@description Function reads the value from the status register of DRV2605 chip on Haptic Click board.

◆ haptic_get_supply_voltage_value()

uint8_t haptic_get_supply_voltage_value ( haptic_t * ctx)

Reading of the supply voltage function.

Parameters
ctxClick object.
Returns
result 8-bit voltage on VDD pin

@description Function does a real-time reading of the supply voltage at the VDD pin of DRV2605 chip on Haptic Click board.

◆ haptic_init()

HAPTIC_RETVAL haptic_init ( haptic_t * ctx,
haptic_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ haptic_pwm_start()

void haptic_pwm_start ( haptic_t * ctx)

Start PWM module.

Parameters
ctxClick object.

@description This function starts PWM module.

◆ haptic_pwm_stop()

void haptic_pwm_stop ( haptic_t * ctx)

Stop PWM module.

Parameters
ctxClick object.

@description This function stops PWM module.

◆ haptic_read_byte()

uint8_t haptic_read_byte ( haptic_t * ctx,
uint8_t reg_address )

Generic read the byte of data function.

Parameters
ctxClick object.
reg_address8-bit register address.
Returns
result 8-bit read data from given address

@description Function read the byte of data from given 8-bit register address of DRV2605 chip on Haptic Click board.

◆ haptic_set_audio_low_pass_filter()

uint8_t haptic_set_audio_low_pass_filter ( haptic_t * ctx,
uint8_t temp_data )

Sets the low-pass filter frequency function.

Parameters
ctxClick object.
temp_data8-bit desired value.

@description Function sets the low-pass filter frequency for the audio-to-vibe signal path by write desired value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_audio_maximum_input()

void haptic_set_audio_maximum_input ( haptic_t * ctx,
uint8_t temp_data )

Sets maximum input for audio to vibe mode function.

Parameters
ctxClick object.
temp_data8-bit desired maximum input.

@description Function sets maximum input for audio to vibe mode by write desired maximum input value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_audio_maximum_output()

void haptic_set_audio_maximum_output ( haptic_t * ctx,
uint8_t temp_data )

Sets maximum output for audio to vibe mode function.

Parameters
ctxClick object.
temp_data8-bit desired maximum output

@description Function sets maximum output for audio to vibe mode by write desired maximum output value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_audio_minimum_input()

void haptic_set_audio_minimum_input ( haptic_t * ctx,
uint8_t temp_data )

Sets minimum input for audio to vibe mode function.

Parameters
ctxClick object.
temp_data8-bit desired minimum input

@description Function sets minimum input for audio to vibe mode by write desired minimum input value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_audio_minimum_output()

void haptic_set_audio_minimum_output ( haptic_t * ctx,
uint8_t temp_data )

Sets minimum output for audio to vibe mode function.

Parameters
ctxClick object.
temp_data8-bit desired minimum output.

@description Function sets minimum output for audio to vibe mode by write desired minimum output value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_audio_peak_time()

uint8_t haptic_set_audio_peak_time ( haptic_t * ctx,
uint8_t temp_data )

Sets the peak detection time function.

Parameters
ctxClick object.
temp_data8-bit desired value.
Returns
result
  • 0 : if successful.

@description Function sets the peak detection time for the audio-to-vibe signal path by write desired value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_brake_time_offset()

void haptic_set_brake_time_offset ( haptic_t * ctx,
uint8_t temp_data )

Sets desired brake time offset function.

Parameters
ctxClick object.
temp_data8-bit desired brake time offset.

@description Function sets desired brake time offset by write desired brake time value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_duty_cycle()

void haptic_set_duty_cycle ( haptic_t * ctx,
float duty_cycle )

Generic sets PWM duty cycle.

Parameters
ctxClick object.
duty_cycleDuty cycle.

@description This function sets the PWM duty cycle.

◆ haptic_set_input_to_analog()

void haptic_set_input_to_analog ( haptic_t * ctx)

Sets the input to analog function.

Parameters
ctxClick object.

@description Function sets the input of the Haptic click to analog by set second lowest bit of control 3 register of DRV2605 chip on Haptic Click board.

◆ haptic_set_input_to_pwm()

void haptic_set_input_to_pwm ( haptic_t * ctx)

Sets the input for PWM control function.

Parameters
ctxClick object.

@description Function sets the input for PWM control of the motor by clear second lowest bit of control 3 register of DRV2605 chip on Haptic Click board.

◆ haptic_set_library()

uint8_t haptic_set_library ( haptic_t * ctx,
uint8_t library )

Sets the desired library of vibrating patterns to read function.

Parameters
ctxClick object.
library8-bit desired pattern library for reading.

@description Function sets the desired library of vibrating patterns to read register of DRV2605 chip on Haptic Click board.

◆ haptic_set_loop_gain()

uint8_t haptic_set_loop_gain ( haptic_t * ctx,
uint8_t gain )

Selects a loop gain function.

Parameters
ctxClick object.
gain8-bit desired gain
Returns
  • 0 if failed.
  • 1 if successful.

@description Function selects a loop gain for the feedback control of DRV2605 chip on Haptic Click board.

◆ haptic_set_mode()

void haptic_set_mode ( haptic_t * ctx,
uint8_t sel_mode )

Sets the Haptic click to desired mode function.

Parameters
ctxClick object.
sel_modeSelect mode.

@description Function sets the desired mode by write mode register of the DRV2605 chip on Haptic Click board.

◆ haptic_set_overdrive_clamp_voltage()

void haptic_set_overdrive_clamp_voltage ( haptic_t * ctx,
uint8_t temp_data )

Sets a clamp function.

Parameters
ctxClick object.
temp_data8-bit desired value.

@description Function sets a clamp so that the automatic overdrive is bounded by write desired value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_overdrive_offset()

void haptic_set_overdrive_offset ( haptic_t * ctx,
uint8_t temp_data )

Sets overdrive offset function.

Parameters
ctxClick object.
temp_data8-bit desired overdrive offset.

@description Function sets overdrive offset by write desired overdrive value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_rated_voltage()

void haptic_set_rated_voltage ( haptic_t * ctx,
uint8_t temp_data )

Sets the reference voltage function.

Parameters
ctxClick object.
temp_data8-bit desired value.

@description Function sets the reference voltage for full-scale output during closed-loop by write desired value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_rtp_input()

void haptic_set_rtp_input ( haptic_t * ctx,
uint8_t input )

Sets the desired input for RTP mode function.

Parameters
ctxClick object.
input8-bit desired input for RTP mode.

@description Function sets the desired input for RTP mode of DRV2605 chip on Haptic Click board.

◆ haptic_set_sequence()

void haptic_set_sequence ( haptic_t * ctx,
uint8_t temp_data )

Sets the waveform identifier function.

Parameters
ctxClick object.
temp_data8-bit desired waveform.

@description Function sets the waveform identifier of the waveform to be played of DRV2605 chip on Haptic Click board. A waveform identifier is an integer value referring to the index position of a waveform in a ROM library. Playback begins at register address 0x04 when the user asserts the GO bit ( register 0x0C ). When playback of that waveform ends, the waveform sequencer plays the next waveform identifier held in register 0x05

◆ haptic_set_state_hi()

void haptic_set_state_hi ( haptic_t * ctx)

Generic read function.

Parameters
ctxClick object.

@description Function sets the device in HI state of DRV2605 chip on Haptic Click board.

◆ haptic_set_sustain_offset_negative()

void haptic_set_sustain_offset_negative ( haptic_t * ctx,
uint8_t temp_data )

Sets desired sustain offset - negative function.

Parameters
ctxClick object.
temp_data8-bit desired negative sustain offset.

@description Function sets desired sustain offset - negative by write desired negative sustain value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_sustain_offset_positive()

void haptic_set_sustain_offset_positive ( haptic_t * ctx,
uint8_t temp_data )

Sets desired sustain offset - positive function.

Parameters
ctxClick object.
temp_data8-bit desired positive sustain offset.

@description Function sets desired sustain offset - positive by write desired positive sustain value to address of the target register of DRV2605 chip on Haptic Click board.

◆ haptic_set_to_erm_mode()

void haptic_set_to_erm_mode ( haptic_t * ctx)

Sets the Haptic click in ERM mode function.

Parameters
ctxClick object.

@description Function sets the Haptic click in ERM mode by write clear highest bit of feedback register of DRV2605 chip on Haptic Click board.

◆ haptic_set_to_lra_mode()

void haptic_set_to_lra_mode ( haptic_t * ctx)

Sets the Haptic click in LRA mode function.

Parameters
ctxClick object.

@description Function sets the Haptic click in LRA mode by write set highest bit of feedback register of DRV2605 chip on Haptic Click board.

◆ haptic_setBrakeFactor()

uint8_t haptic_setBrakeFactor ( haptic_t * ctx,
uint8_t brake_factor )

Sets the feedback gain ratio function.

Parameters
ctxClick object.
brake_factor8-bit desired brake factor
Returns
  • 0 if failed.
  • 1 if successful.

@description Function sets the feedback gain ratio between braking gain and driving gain. In general, adding additional feedback gain while braking is desirable so that the actuator brakes as quickly as possible. Large ratios provide less-stable operation than lower ones.

◆ haptic_soft_reset()

void haptic_soft_reset ( haptic_t * ctx)

Resets all the registers function.

Parameters
ctxClick object.

@description Function resets all the registers by set highest bit of mode registe of the DRV2605 chip on Haptic Click board.

◆ haptic_start_motor()

void haptic_start_motor ( haptic_t * ctx)

Starts moving the motor function.

Parameters
ctxClick object.

@description Function starts reading the desired pattern and moving the motor by set lowest bit of go register of DRV2605 chip on Haptic Click board.

◆ haptic_write_byte()

void haptic_write_byte ( haptic_t * ctx,
uint8_t reg_address,
uint8_t write_data )

Generic write the byte of data function.

Parameters
ctxClick object.
reg_address8-bit register address.
write_data8-bit data to write to given address.

@description Function write the byte of data to given 8-bit register address of DRV2605 chip on Haptic Click board.